[postgis-users] Proposal for a new function ST_GeogFromLatLon

Javier de la Torre jatorre at vizzuality.com
Thu May 31 13:59:41 PDT 2012


Hi all,

We are having lot of new web developers coming to use PostGIS and thats great! One of the first barries I know some people have is how complicate is to create a point on PostGIS. Basically you need to know:

1) In PostGIS first comes Longitude, then Latitude
2) You have to specify an srid, which most people havent heard of

So what I would consider a trivial query looks like this:

SELECT * FROM mytable WHERE the_geom && ST_SetSRID(ST_MakePoint(-123.0,34),4326)

I propose to have a wrapper function called ST_GeogFromLatLon or something similar so that we can do:

SELECT * FROM mytable WHERE the_geom && ST_GeogFromLatLon(34,-123.0)

The ST_GeogFromLatLon will imply 4326 SRID. And the return could be geography, as it cast well to geometry, so it will work in most cases.

I know is not such a big difference, but I think it will help a lot new people and will also make our queries look much better in some scenarios. In my experiences when teaching postgis this is kind of annoying having to go through it.

Does this break the entire GIS world? :D
Just kidding.

Javier de la Torre
@jatorre

Vizzuality
148 Lafayette St. PH, New York, 10013,USA
+1 347 320 7715
www.vizzuality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120531/7a323f16/attachment.html>


More information about the postgis-users mailing list