| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- -- Määrame skeemi keskkonnamuutujast või vaikimisi 'public'
- local schema = os.getenv("PGSCHEMA") or "public"
- -- This config example file is released into the Public Domain.
- -- This is a generic configuration that is a good starting point for
- -- real-world projects. Data is split into tables according to geometry type
- -- and most tags are stored in jsonb columns.
- -- Set this to the projection you want to use
- local srid = 3857
- local tables = {}
- tables.points = osm2pgsql.define_node_table('generic_points', {
- { column = 'tags', type = 'jsonb' },
- { column = 'geom', type = 'point', projection = srid, not_null = true },
- }, {
- schema = schema,
- proj = 3301
- })
- tables.lines = osm2pgsql.define_way_table('generic_lines', {
- { column = 'tags', type = 'jsonb' },
- { column = 'geom', type = 'linestring', projection = srid, not_null = true },
- }, {
- schema = schema,
- proj = 3301
- })
- tables.polygons = osm2pgsql.define_area_table('generic_polygons', {
- { column = 'tags', type = 'jsonb' },
- { column = 'geom', type = 'geometry', projection = srid, not_null = true },
- }, {
- schema = schema,
- proj = 3301
- })
- tables.routes = osm2pgsql.define_relation_table('generic_routes', {
- { column = 'tags', type = 'jsonb' },
- { column = 'geom', type = 'multilinestring', projection = srid, not_null = true },
- }, {
- schema = schema,
- proj = 3301
- })
- tables.boundaries = osm2pgsql.define_relation_table('generic_boundaries', {
- { column = 'tags', type = 'jsonb' },
- { column = 'geom', type = 'multilinestring', projection = srid, not_null = true },
- }, {
- schema = schema,
- proj = 3301
- })
- -- These tag keys are generally regarded as useless for most rendering. Most
- -- of them are from imports or intended as internal information for mappers.
- --
- -- If a key ends in '*' it will match all keys with the specified prefix.
- --
- -- If you want some of these keys, perhaps for a debugging layer, just
- -- delete the corresponding lines.
- local delete_keys = {
- -- "mapper" keys
- 'attribution',
- 'comment',
- 'created_by',
- 'fixme',
- 'note',
- 'note:*',
- 'odbl',
- 'odbl:note',
- 'source',
- 'source:*',
- 'source_ref',
- -- "import" keys
- -- Corine Land Cover (CLC) (Europe)
- 'CLC:*',
- -- Geobase (CA)
- 'geobase:*',
- -- CanVec (CA)
- 'canvec:*',
- -- osak (DK)
- 'osak:*',
- -- kms (DK)
- 'kms:*',
- -- ngbe (ES)
- -- See also note:es and source:file above
- 'ngbe:*',
- -- Friuli Venezia Giulia (IT)
- 'it:fvg:*',
- -- KSJ2 (JA)
- -- See also note:ja and source_ref above
- 'KSJ2:*',
- -- Yahoo/ALPS (JA)
- 'yh:*',
- -- LINZ (NZ)
- 'LINZ2OSM:*',
- 'linz2osm:*',
- 'LINZ:*',
- 'ref:linz:*',
- -- WroclawGIS (PL)
- 'WroclawGIS:*',
- -- Naptan (UK)
- 'naptan:*',
- -- TIGER (US)
- 'tiger:*',
- -- GNIS (US)
- 'gnis:*',
- -- National Hydrography Dataset (US)
- 'NHD:*',
- 'nhd:*',
- -- mvdgis (Montevideo, UY)
- 'mvdgis:*',
- -- EUROSHA (Various countries)
- 'project:eurosha_2012',
- -- UrbIS (Brussels, BE)
- 'ref:UrbIS',
- -- NHN (CA)
- 'accuracy:meters',
- 'sub_sea:type',
- 'waterway:type',
- -- StatsCan (CA)
- 'statscan:rbuid',
- -- RUIAN (CZ)
- 'ref:ruian:addr',
- 'ref:ruian',
- 'building:ruian:type',
- -- DIBAVOD (CZ)
- 'dibavod:id',
- -- UIR-ADR (CZ)
- 'uir_adr:ADRESA_KOD',
- -- GST (DK)
- 'gst:feat_id',
- -- Maa-amet (EE)
- 'maaamet:ETAK',
- -- FANTOIR (FR)
- 'ref:FR:FANTOIR',
- -- 3dshapes (NL)
- '3dshapes:ggmodelk',
- -- AND (NL)
- 'AND_nosr_r',
- -- OPPDATERIN (NO)
- 'OPPDATERIN',
- -- Various imports (PL)
- 'addr:city:simc',
- 'addr:street:sym_ul',
- 'building:usage:pl',
- 'building:use:pl',
- -- TERYT (PL)
- 'teryt:simc',
- -- RABA (SK)
- 'raba:id',
- -- DCGIS (Washington DC, US)
- 'dcgis:gis_id',
- -- Building Identification Number (New York, US)
- 'nycdoitt:bin',
- -- Chicago Building Inport (US)
- 'chicago:building_id',
- -- Louisville, Kentucky/Building Outlines Import (US)
- 'lojic:bgnum',
- -- MassGIS (Massachusetts, US)
- 'massgis:way_id',
- -- Los Angeles County building ID (US)
- 'lacounty:*',
- -- Address import from Bundesamt für Eich- und Vermessungswesen (AT)
- 'at_bev:addr_date',
- -- misc
- 'import',
- 'import_uuid',
- 'OBJTYPE',
- 'SK53_bulk:load',
- 'mml:class'
- }
- -- The osm2pgsql.make_clean_tags_func() function takes the list of keys
- -- and key prefixes defined above and returns a function that can be used
- -- to clean those tags out of a Lua table. The clean_tags function will
- -- return true if it removed all tags from the table.
- local clean_tags = osm2pgsql.make_clean_tags_func(delete_keys)
- -- Helper function that looks at the tags and decides if this is possibly
- -- an area.
- local function has_area_tags(tags)
- if tags.area == 'yes' then
- return true
- end
- if tags.area == 'no' then
- return false
- end
- return tags.aeroway
- or tags.amenity
- or tags.building
- or tags.harbour
- or tags.historic
- or tags.landuse
- or tags.leisure
- or tags.man_made
- or tags.military
- or tags.natural
- or tags.office
- or tags.place
- or tags.power
- or tags.public_transport
- or tags.shop
- or tags.sport
- or tags.tourism
- or tags.water
- or tags.waterway
- or tags.wetland
- or tags['abandoned:aeroway']
- or tags['abandoned:amenity']
- or tags['abandoned:building']
- or tags['abandoned:landuse']
- or tags['abandoned:power']
- or tags['area:highway']
- or tags['building:part']
- end
- function osm2pgsql.process_node(object)
- if clean_tags(object.tags) then
- return
- end
- tables.points:insert({
- tags = object.tags,
- geom = object:as_point()
- })
- end
- function osm2pgsql.process_way(object)
- if clean_tags(object.tags) then
- return
- end
- if object.is_closed and has_area_tags(object.tags) then
- tables.polygons:insert({
- tags = object.tags,
- geom = object:as_polygon()
- })
- else
- tables.lines:insert({
- tags = object.tags,
- geom = object:as_linestring()
- })
- end
- end
- function osm2pgsql.process_relation(object)
- local relation_type = object:grab_tag('type')
- if clean_tags(object.tags) then
- return
- end
- if relation_type == 'route' then
- tables.routes:insert({
- tags = object.tags,
- geom = object:as_multilinestring()
- })
- return
- end
- if relation_type == 'boundary' or (relation_type == 'multipolygon' and object.tags.boundary) then
- tables.boundaries:insert({
- tags = object.tags,
- geom = object:as_multilinestring():line_merge()
- })
- return
- end
- if relation_type == 'multipolygon' then
- tables.polygons:insert({
- tags = object.tags,
- geom = object:as_multipolygon()
- })
- end
- end
|