[postgis-users] Google Maps Polyline to Postgis with Java/Hibernate

Jason Greenlaw - NOAA Affiliate jason.greenlaw at noaa.gov
Wed Jan 16 11:06:05 PST 2013


There may be a better solution, but what I've done in the past with
JPA/Hibernate is to create a varchar field that you can populate with the
WKT representing the polyline (represented in WKT as a LINESTRING), then
configure an 'AFTER INSERT OR UPDATE' trigger which updates the actual
geometry column with the result of ST_GeometryFromText(wkt, srid).

Jason


On Tue, Jan 15, 2013 at 11:38 AM, Luciano Borges <
lucianosantosborges at gmail.com> wrote:

> Hi Steve,
>
> I took a look at GMapToGPX, but one of the functions it has and I need the
> version 3 of Google Maps already provides me.
>
> Ex:  arrayPoints =
> google.maps.geometry.encoding.decodePath(response.routes[0].overview_polyline.points);
>
> I need to know how to take that route (array) and convert it into a
> polygon that the postgis can understand.
>
> Thank you,
> Luciano
>
>
> 2013/1/15 Luciano Borges <lucianosantosborges at gmail.com>
>
>>  I have a page where the user enters the starting point and ending point
>> and I show de route in the map.
>>
>> I would like to know how to get this polygon (polyline) and save it in
>> Postgis through the Java / Hibernate.
>>
>> For example, I have this code:
>>
>> var request = {
>>         origin: ptoPartida,
>>         destination: ptoChegada,
>>         //provideRouteAlternatives: true,
>>         travelMode: google.maps.DirectionsTravelMode.DRIVING};
>>
>> directionsService.route(request, function(response, status) {
>>     if (status == google.maps.DirectionsStatus.OK) {
>>         directionsDisplay.setDirections(response);
>>         console.log(response);
>>         var *x* =  google.maps.geometry.encoding.decodePath(response.routes[0].overview_polyline.points);
>>         console.log(x);
>>     }});
>>
>> The variable *X* is an array of point.
>>
>> Now I am looking for send this array to database (postgis).
>>
>> After I wiil try recover this data from database and print it on map.
>>
>> Thanks, Luciano
>>
>>  Someone can help me?
>>
>> Thanks. Luciano
>>
>
>
>
> --
> Luciano Borges
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130116/2cf70316/attachment.html>


More information about the postgis-users mailing list