Hi<br><br><div class="gmail_quote">On 2 February 2010 17:11, Antonio Castillo <span dir="ltr"><<a href="mailto:gantonio.castillo@gmail.com">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><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">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>