[postgis-users] Converting GMaps.getBounds to POLYGON ewkt format
RAVI KUMAR
ravivundavalli at yahoo.com
Mon Sep 17 05:53:34 PDT 2007
Hi,
nice to see some Indians on this wonderful list.
I am a Geologist from Hyderabad. I use OpenJUMP, PostGIS (not very successful though) and GRASS GIS.
Pl give your details.
Namashkar
Ravi Kumar
Babu Naidu <pbnaidu at gmail.com> wrote:
Thanks Robert. That worked and I am going to use the concise format of MakeBox2D.
-Babu
On 9/15/07, Robert Coup < robert.coup at onetrackmind.co.nz> wrote: On 15/09/2007, Babu Naidu < pbnaidu at gmail.com> wrote:
> I am trying to convert Google Maps GMap.getBounds() (which returns LatLng
> for south west and LatLng for north east)
> to POLYGON( ) ewkt format. This is to query for points within that POLYGON.
>
> I think I figured out the format and I would like to verify it with experts
> here. I have southwest Lat Lng and northeast LatLng
> considering Y=Lng and X=Lat
>
> POLYGON(maxY maxX,
> maxY minX,
> minY minX,
> minY maxX,
> maxY maxX)
>
> Is this the right way to create a POLYGON? could you please point me to docs
> if available that explain this format?
X should be Longitude, and Y Latitude. Always.
in WKT you need double-brackets for a polygon, and the common
convention is to do boxes in the following sequence:
POLYGON((minx miny, maxx miny, maxx maxy, minx maxy, minx miny))
If you don't need to make WKT you could do the following instead,
which creates a geometry you can use in queries, etc:
MakeBox2D(MakePoint(minx, miny), MakePoint(maxx, maxy))
hth,
Rob :)
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
---------------------------------
Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070917/afb04da4/attachment.html>
More information about the postgis-users
mailing list