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

Marky Mark markymark9705 at yahoo.com
Wed Oct 10 05:18:36 PDT 2012


Nicolas, this is perfect - exactly what I needed, and now I understand the issue.

Many thanks!



________________________________
 
 
Hi,

You have to transform your data from their native SRID to 4326 (or
other Lat/Lon CRS).

Looks like testdb.places does not store data in lat/lon but in a
projected coordinate system.

Try: select ST_X(st_transform(geo_location,
4326)),ST_Y(st_transform(geo_location, 4326)) from testdb.places

NIcolas

On 10 October 2012 13:36, Michal Zimmermann <zimmicz at gmail.com> wrote:
> How about ST_AsText(geometry)?
>
> Dne 10.10.2012 13:27 "Marky Mark" <markymark9705 at yahoo.com> napsal(a):
>>
>> 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>
>>
>> _______________________________________________
>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121010/ea98a3fc/attachment.html>


More information about the postgis-users mailing list