Calculating area / length of a geometry in openstreetmap(osm) x, y coordinates at a given zoomlevel,

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Calculating area / length of a geometry in openstreetmap(osm) x, y coordinates at a given zoomlevel,

Hemant Bist-2
Hi,
I want to figure out how big a geometry (line, polygon) is in osm map for a given zoomlevel. i.e. length of the line, area of the polygon.
The data is stored in  lan/lon coordinates (EPSG:4326). I know I can do something like st_area(st_transform(geometry, 900913)) to get the
numbers in a other projections. But I am not sure if there is some magical projection number for each osm zoomlevel.
I will appreciate any pointers for this.

1) I am not sure if there is a relation between area in 900913 projection and x,y coordinates for osm.

2) If someone has written some pl/sql or any other language utilities to do that,  I can use them as well. I am not necessarily looking for an
easy solution...

3) Here are actual functions that describe how to map the lat  lon to x, y coordinates for a osm zoomlevel. If I remove the int rounding from the following osm link, I would get the x,y coordiantes for a given lat/lon for a given zoomlevel.
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python

Best regards,
Hemant Bist.



_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|

Re: Calculating area / length of a geometry in openstreetmap(osm) x, y coordinates at a given zoomlevel,

Darafei "Komяpa" Praliaskouski
Hi,

World equator width is known in EPSG:3857 Mercator (delete/upgrade the software that calls it 900913) and pixels at the zoom you're interested in.
I've got these in my .psqlrc, so that I can write ST_Buffer(geom, 20 * :at_z12) to buffer something 20px at z12:

\set at_z12 38.22
\set at_z11 76.44
\set at_z10 152.87
\set at_z9 305.75
\set at_z8 611.5
\set at_z7 1222.99
\set at_z6 2445.98
\set at_z5 4891.97
\set at_z4 9783.94
\set at_z3 19567.88
\set at_z2 39135.76
\set at_z1 78271.52
\set at_z0 156543.04

сб, 13 мая 2017 г. в 2:59, Hemant Bist <[hidden email]>:
Hi,
I want to figure out how big a geometry (line, polygon) is in osm map for a given zoomlevel. i.e. length of the line, area of the polygon.
The data is stored in  lan/lon coordinates (EPSG:4326). I know I can do something like st_area(st_transform(geometry, 900913)) to get the
numbers in a other projections. But I am not sure if there is some magical projection number for each osm zoomlevel.
I will appreciate any pointers for this.

1) I am not sure if there is a relation between area in 900913 projection and x,y coordinates for osm.

2) If someone has written some pl/sql or any other language utilities to do that,  I can use them as well. I am not necessarily looking for an
easy solution...

3) Here are actual functions that describe how to map the lat  lon to x, y coordinates for a osm zoomlevel. If I remove the int rounding from the following osm link, I would get the x,y coordiantes for a given lat/lon for a given zoomlevel.
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python

Best regards,
Hemant Bist.


_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users