Hi James,<div><br></div><div>I think you can do this if you decode the polyline into lat/longs using this <a href="https://developers.google.com/maps/documentation/utilities/polylineutility">https://developers.google.com/maps/documentation/utilities/polylineutility</a> and then parse them into lat/long pairs. Then, you can insert geometries into your table using something like this: </div>
<div>ST_GeomFromText('LINESTRING(20 30, 21, 30)')</div><div><br></div><div>As an aside, I would check if this is allowed within the terms of use of Google.</div><div><br></div><div>-David<br><br><div class="gmail_quote">
On Sat, Feb 16, 2013 at 2:16 PM, Richard Greenwood <span dir="ltr"><<a href="mailto:richard.greenwood@gmail.com" target="_blank">richard.greenwood@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="im">On Fri, Feb 15, 2013 at 6:44 AM, James David Smith <span dir="ltr"><<a href="mailto:james.david.smith@gmail.com" target="_blank">james.david.smith@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear all,<br>
<br>
I've had a quick search online and found a few people who have had<br>
similar questions, but no definite answers. My question is whether<br>
there is a simple way to take an encoded Google Polyline and place it<br>
into a Geometry column of type Polyline within PostGIS (that PostGIS<br>
understands and can work with).<br>
<br>
By way of background, I am using the Google Directions API to generate<br>
some routes, and I want to store the results in a PostGIS database.<br></blockquote><div><br></div></div><div>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.<br>
<br></div><div>Rich<span class="HOEnZb"><font color="#888888"><br> </font></span></div></div><span class="HOEnZb"><font color="#888888">-- <br>Richard Greenwood<br><a href="mailto:richard.greenwood@gmail.com" target="_blank">richard.greenwood@gmail.com</a><br>
<a href="http://www.greenwoodmap.com" target="_blank">www.greenwoodmap.com</a>
</font></span></div></div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><br></div>