iceland.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. -- Määrame skeemi keskkonnamuutujast või vaikimisi 'public'
  2. local schema = os.getenv("PGSCHEMA") or "public"
  3. -- This config example file is released into the Public Domain.
  4. -- This file shows how to use a locator with a bounding box to import only
  5. -- the data for a region. In this case only highways in Iceland are imported
  6. -- even if you run this on the full planet file.
  7. local iceland = osm2pgsql.define_locator({ name = 'iceland' })
  8. iceland:add_bbox('IS', -25.0, 62.0, -12.0, 68.0)
  9. local highways = osm2pgsql.define_way_table('highways_iceland', {
  10. { column = 'hwtype', type = 'text', not_null = true },
  11. { column = 'name', type = 'text' },
  12. { column = 'ref', type = 'text' },
  13. { column = 'geom', type = 'linestring', not_null = true },
  14. }, {
  15. schema = schema,
  16. proj = 3301
  17. })
  18. function osm2pgsql.process_way(object)
  19. local t = object.tags
  20. if t.highway then
  21. local geom = object:as_linestring()
  22. local region = iceland:first_intersecting(geom)
  23. if region then
  24. highways:insert({
  25. hwtype = t.highway,
  26. name = t.name,
  27. ref = t.ref,
  28. geom = geom,
  29. })
  30. end
  31. end
  32. end