[mapserver-users] the lines one above other

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Fri Feb 13 01:51:08 PST 2015


Hi,

With OSM and Mapnik it is a two phase process. First osm2pgsql tries to generate sensible z-index values and then Mapnik makes “order by” queries to the database. The queries are here https://github.com/gravitystorm/openstreetmap-carto/blob/master/project.yaml and as an example

(SELECT way,
COALESCE((
'highway_' || (CASE WHEN highway IN ('residential', 'unclassified', 'pedestrian', 'service', 'footway', 'cycleway', 'track', 'path', 'platform') THEN highway ELSE NULL END)),
('railway_' || (CASE WHEN railway IN ('platform') THEN railway ELSE NULL END))
) AS feature
FROM planet_osm_polygon
WHERE highway IN ('residential', 'unclassified', 'pedestrian', 'service', 'footway', 'track', 'path', 'platform')
OR railway IN ('platform')
ORDER BY z_order, way_area DESC
) AS highway_area_casing

-Jukka Rahkonen-


Vladimir wrote:


Bobb

Thanks you very much for detailed answer.
I'll have to place the parts of lines in various layers.
There is no other elegant decision as i understood, but I wonder how "web-map-giants" like GOOGLE or OSM get out of this scrape.


Vladimir,



I’ve faked this in the past by drawing the same layer many times in one pass (inside of the same mapfile), you need at least one complete layer pass, with other partial layers for the over/under situations.  You can do the partial layer grouping with attributes on the segments that need to go under or over, and this is a manual process for the most part, but it’s a real pain to keep that up to date over time (I’m talking over years) .  I could probably find a programmer that thought of this as a challenge, but you still need a human to decide what is over something else as a last QA.



The much harder task is defining which layers (partial segments are over/under other layers..  You need to remove some line segments form at least one of the layers in order to make things display correctly.  Sometimes a layer is over, sometime it’s under.  I actually have two instances in my mapping system, where I have three different bridges stacked on top of each other, two of them a roadways, with the odd one in between them.  The other has a Railway bridge over a roadway bridge crossing.



The z-index stuff has always been a painful thing thing to keep updated, but it is doable.



I’ve rencetly been looking at this myself for hardcopy pringing purposes. As well.



Bobb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20150213/715c0cb0/attachment.htm>


More information about the MapServer-users mailing list