[postgis-users] Google Polyline into PostGIS

David Quinn daithiquinn at gmail.com
Sat Feb 16 09:43:38 PST 2013


Hi James,

I think you can do this if you decode the polyline into lat/longs using
this
https://developers.google.com/maps/documentation/utilities/polylineutilityand
then parse them into lat/long pairs. Then, you can insert geometries
into your table using something like this:
ST_GeomFromText('LINESTRING(20 30, 21, 30)')

As an aside, I would check if this is allowed within the terms of use of
Google.

-David

On Sat, Feb 16, 2013 at 2:16 PM, Richard Greenwood <
richard.greenwood at gmail.com> wrote:

>
>
> On Fri, Feb 15, 2013 at 6:44 AM, James David Smith <
> james.david.smith at gmail.com> wrote:
>
>> Dear all,
>>
>> I've had a quick search online and found a few people who have had
>> similar questions, but no definite answers. My question is whether
>> there is a simple way to take an encoded Google Polyline and place it
>> into a Geometry column of type Polyline within PostGIS (that PostGIS
>> understands and can work with).
>>
>> By way of background, I am using the Google Directions API to generate
>> some routes, and I want to store the results in a PostGIS database.
>>
>
> I do not know what a "encoded Google Polyline" is but I believe Google can
> output KML. ogr2ogr can read KML and write to postgis, so that's where I
> would start.
>
> Rich
>
> --
> Richard Greenwood
> richard.greenwood at gmail.com
> www.greenwoodmap.com
>
> _______________________________________________
> 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/20130216/bc670b81/attachment.html>


More information about the postgis-users mailing list