Hello Jose<br><br>I can create the Shapefile from "ODBC:SQL Server 2008" connection, with the OGR VRT :D<br><br>thank you!!! :P<br><br>the .ovf file<br>----------------------<br>puentes.ovf<br>----------------------<br>
<OGRVRTDataSource><br> <OGRVRTLayer name="Puentes"><br> <SrcDataSource>ODBC:INACMASQL</SrcDataSource> <br> <SrcSQL>SELECT p.nombre AS nombre,replace(t.latitud,',','.') AS lat,replace(t.longitud,',','.') AS long,replace(t.altura,',','.') AS altura FROM puente p,trayectoria t WHERE p.id_trajectory = t.id_trayectoria</SrcSQL><br>
<GeometryType>wkbPoint</GeometryType> <br> <LayerSRS>WGS84</LayerSRS><br> <GeometryField encoding="PointFromColumns" x="long" y="lat"/> <br> </OGRVRTLayer><br>
</OGRVRTDataSource><br><br>-----------------------------<br>and ogr2ogr command<br>-------------------------------<br>ogr2ogr -f "ESRI Shapefile" puentes.shp puentes.ovf<br><br><br>
<div class="gmail_quote">On Tue, Feb 2, 2010 at 12:33 PM, Jose Gomez-Dans <span dir="ltr"><<a href="mailto:jgomezdans@gmail.com" target="_blank">jgomezdans@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br><br><div class="gmail_quote"><div>On 2 February 2010 17:11, Antonio Castillo <span dir="ltr"><<a href="mailto:gantonio.castillo@gmail.com" target="_blank">gantonio.castillo@gmail.com</a>></span> wrote: <br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
ogr2ogr -f "ESRI Shapefile" -a_srs "EPSG:4326" "puentes.shp" "ODBC:INACMASQL" -nlt POINT -sql "SELECT p.nombre,t.latitud,t.longitud,t.altura FROM puente p,trayectoria t WHERE p.id_trajectory = t.id_trayectoria"</blockquote>
</div><div><br>I think your problem stems from the fact that the DBF created in the previous command has two fields that need to be related to a point geometry. There's an example in how to translate this query into a virtual dataset, which can then be translated into a shapefile easily in <<a href="http://www.gdal.org/ogr/drv_vrt.html" target="_blank">http://www.gdal.org/ogr/drv_vrt.html</a>>. Not tested, but basically create a file called the following file:<br>
<pre><OGRVRTDataSource><br> <OGRVRTLayer name="MyQuery"><br> <SrcDataSource>ODBC:INACMASQL</SrcDataSource> <br><b> <SrcSQL</b>>SELECT p.nombre AS nombre,t.latitud AS lat,t.longitud AS long,t.altura AS altura FROM puente p,trayectoria t WHERE p.id_trajectory = t.id_trayectoria</SrcSQL><br>
        <GeometryType>wkbPoint</GeometryType> <br> <LayerSRS>WGS84</LayerSRS><br>        <GeometryField encoding="PointFromColumns" x="long" y="lat"/> <br> </OGRVRTLayer><br>
</OGRVRTDataSource><br></pre><br>and then convert it into a Shapefile using ogr2ogr.<br><br>Hope that helps!<br>Jose<br></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Ing Germán Antonio Castillo P.<br><br><br>---------------------------------------<br><a href="http://www.AcaroLabs.org" target="_blank">www.AcaroLabs.org</a><br><br>