[talk-au] Sturt highway
John Smith
delta_foxtrot at yahoo.com
Sat Aug 22 18:06:38 BST 2009
--- On Fri, 21/8/09, BlueMM <bluemm1975-osm at yahoo.com> wrote:
> I think this is why I am concerned about adding the addr:
> tags to the ref
> relations, is it not redundant data given that we have
> suburb boundaries, we
> know with reasonable certainty that a node is in what
> suburb/state/country? I
A little redundancy can save a ton of CPU cycles calculating this every time, this is why tiles get cached rather than drawn on the fly for each request :)
Since we're consolidating all the highway information 1 or 2 extra tags per relation will be less data in total than we started with.
That said I finally figured out a suitable SQL query against pgsql/postgis to calculate it.
select name from planet_osm_polygon where ST_Contains(way, ST_SetSRID(ST_Point(149.8422 * 20037508.34 / 180, ln(tan(((90 + -29.4642) * pi()) / 360)) / (pi() / 180) * 20037508.34 / 180), 900913))
That's for the point -29.4642, 149.8422, but you can use the same ST_Contains() function to compare relations with polygons so it's relatively straight forward to find out what state/country a line falls in.
Once I convert the MySQL queries across to PostGIS queries the lookup times on searches should be less as a result.
More information about the Talk-au
mailing list