updated to lates versions

This commit is contained in:
afischerdev 2024-12-28 10:36:02 +01:00
parent 625ff0c53f
commit f5033ae851
2 changed files with 336 additions and 67 deletions

View file

@ -1,10 +1,12 @@
-- special config to calcule pseudo-tags / "Brouter project"
-- EssBee version 08/05/2023
local srid = 3857
--local srid = 4326
-- 3857 (projection) SHOULD BE USED here for distance calculation ... (not srid = 4326 !)
-- https://gis.stackexchange.com/questions/48949/epsg-3857-or-4326-for-web-mapping
-- https://gis.stackexchange.com/questions/48949/epsg-3857-or-4326-for-web-mapping
local tables = {}
@ -14,6 +16,7 @@ tables.lines = osm2pgsql.define_way_table('lines', {
{ column = 'highway', type = 'text' },
{ column = 'maxspeed', type = 'text' },
{ column = 'waterway', type = 'text' },
{ column = 'natural', type = 'text' },
{ column = 'width', type = 'text' },
{ column = 'way', type = 'linestring', projection = srid, not_null = true },
})
@ -130,15 +133,13 @@ function osm2pgsql.process_node(object)
osm_id = object.id,
way = object:as_point()
})
end
end
function osm2pgsql.process_way(object)
local way_type = object:grab_tag('type')
if ( object.tags.natural == 'water') or (object.tags.landuse ~= nil ) or (object.tags.leisure ~= nil ) then
if (object.tags.natural == 'water') or ( object.tags.natural == 'bay') or ( object.tags.natural == 'beach') or ( object.tags.natural == 'coastline') or ( object.tags.natural == 'wetland') or ( object.tags.landuse ~= nil ) or (object.tags.leisure ~= nil ) then
tables.polygons:insert({
name = object.tags.name,
osm_id = object.id,
@ -156,12 +157,13 @@ function osm2pgsql.process_way(object)
})
end
if ( object.tags.highway ~= nil) or ( object.tags.waterway ~= nil) then
if (object.tags.highway ~= nil) or ( object.tags.waterway ~= nil) or ( object.tags.natural == 'coastline') then
tables.lines:insert({
name = object.tags.name,
osm_id = object.id,
highway = object.tags.highway,
waterway = object.tags.waterway,
natural = object.tags.natural,
width = object.tags.width,
maxspeed = object.tags.maxspeed,
way = object:as_linestring()
@ -193,7 +195,7 @@ function osm2pgsql.process_relation(object)
way = object:as_multipolygon()
})
-- if (relation_type == 'boundary') and has_area_tags(object.tags) then
-- if (relation_type == 'boundary') and has_area_tags(object.tags) then
if (relation_type == 'boundary') then
tables.cities_rel:insert({
reltype = object.tags.relation_type,