[postgis-users] Plotting PostGIS/Postgress points on a Google Map

Marky Mark markymark9705 at yahoo.com
Wed Oct 10 04:27:28 PDT 2012


Hi,
 
This is
the definition of a newbie question but how do I take a PostGIS-generated
geometry value such as
"0101000020346C0000F5A4B17560061841A3D4467F89992841" and convert it
to a latitide and longitude to plug into a Google Map (as below)? I've tried
using the following code in Postgres to extract lat & long:
 
select ST_X(geo_location),ST_Y(geo_location)
from testdb.places
 
SELECT
ST_X(geo_location::geometry), ST_Y(geo_location::geometry) FROM testdb.places;
 
And these
both produce values 393624.114935472,806084.74858727 for the above geometry
value (I'd expect something like 57.1500,-2.1000)
 
What
incredibly stupid thing am I not grasping here?
 
Many
thanks, Marko
 
   <script
type="text/javascript">
      function initialize() {
        var mapOptions = {
          center: new google.maps.LatLng(-34.397, 150.644),/*
I want to plug in values here*/
          zoom: 8,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById("map_canvas"),
            mapOptions);
      }
    </script>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121010/d5354d5b/attachment.html>


More information about the postgis-users mailing list