[gdal-dev] OSM driver with z_order values

Even Rouault even.rouault at spatialys.com
Sat Nov 8 12:00:26 PST 2014


Le vendredi 07 novembre 2014 14:48:57, Jeff McKenna a écrit :
> On 2014-11-07 4:49 AM, Even Rouault wrote:
> > The ideal would to find some syntax to do this in osmconf.ini. Actually,
> > Jukka's mention of sqlite makes me think that the syntax could be SQL
> > evaluated by SQLite.
> > Something like :
> > 
> > computed_fields = z_order
> > z_order_type = Integer
> > z_order_sql = "SELECT (CASE [highway] WHEN 'minor' THEN 3 WHEN 'road'
> > THEN 3 WHEN 'tertiary_link' THEN 4 ... ELSE 0) + (CASE WHEN [bridge] IS
> > IN ('yes', 'true', '1') THEN 10 ELSE 0 END) + (CASE WHEN [layer] IS NOT
> > NULL THEN 10 * CAST([layer) AS INTEGER) ELSE 0 END) + ..."
> > 
> > And stuff in [] would be replaced by the corresponding field value.
> > 
> > That's something that could also potentially be done as the ogr2ogr
> > level, since there's hardly anything driver specific in that, but
> > finding the right U.I to specify per-layer computed fields isn't
> > obvious.
> 
> I agree, it would be very cool to be able to configure the z_order field
> in osmconf.ini !!!! I'm not sure what else to add to this discussion,
> other than that I really want this :)

Jeff,

I've implemented the above idea in latest trunk. I've translated the osm2pgsql 
rules (*) for the lines layer. Let me know if that works OK. The 
implementation of the mechanism is rather generic, so it could potentially be 
used to do many other things.

That would be cool if folks could share a link to their "operational" 
osmconf.ini so that we can link to it from the driver documentation page. The 
default one is probably too simple for some uses.

Even

(*) when you compare osm2pgsql and imposm rules, there are differences. 
osm2pgsql uses z_order = 5 for railway, whereas it is 7 for imposm. For 
highway = xxx_link, osm2pgsql uses the z_order of highway = xxx, whereas 
imposm uses 3. And the values of secondary and primary are differents (due to 
the difference for railway likely)

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list