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

Stephen Woodbridge woodbri at swoodbridge.com
Tue Jan 15 08:09:39 PST 2013


You might want to look at GMapToGPX (google it). This is an Javascript 
tool that pulls the google map route and converts it to a GPX file. You 
might be able to modify this code to access the routing info or to send 
the GPX data directly to your server.

I use the tool directly all the time to get the GPX of a route and then 
load it into my GPS as a route. It is great for planning trips.

-Steve

On 1/15/2013 11:03 AM, Luciano Borges wrote:
> 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
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list