[gdal-dev] OSM driver with z_order values

Jeff McKenna jmckenna at gatewaygeomatics.com
Mon Nov 10 07:21:22 PST 2014


On 2014-11-08 4:00 PM, Even Rouault wrote:
> 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)
>

Hi Even,

I've updated my GDAL version and am ready to test this change.  I am 
wondering though if this "computed_attributes=z_order" can be applied to 
not only lines, but also points and multipolygons.  I will add that into 
my osmconf.ini and test to see.  I will update this thread with my 
results soon.

PS. thanks for the z_order addition!!!!!!

-jeff






More information about the gdal-dev mailing list