Hello Jose<br><br>I can create the Shapefile from &quot;ODBC:SQL Server 2008&quot; connection, with the OGR VRT :D<br><br>thank you!!! :P<br><br>the .ovf file<br>----------------------<br>puentes.ovf<br>----------------------<br>
&lt;OGRVRTDataSource&gt;<br>    &lt;OGRVRTLayer name=&quot;Puentes&quot;&gt;<br>        &lt;SrcDataSource&gt;ODBC:INACMASQL&lt;/SrcDataSource&gt; <br>        &lt;SrcSQL&gt;SELECT p.nombre AS nombre,replace(t.latitud,&#39;,&#39;,&#39;.&#39;) AS lat,replace(t.longitud,&#39;,&#39;,&#39;.&#39;) AS long,replace(t.altura,&#39;,&#39;,&#39;.&#39;)  AS altura FROM puente p,trayectoria t WHERE p.id_trajectory = t.id_trayectoria&lt;/SrcSQL&gt;<br>
     &lt;GeometryType&gt;wkbPoint&lt;/GeometryType&gt; <br>        &lt;LayerSRS&gt;WGS84&lt;/LayerSRS&gt;<br>    &lt;GeometryField encoding=&quot;PointFromColumns&quot; x=&quot;long&quot; y=&quot;lat&quot;/&gt; <br>    &lt;/OGRVRTLayer&gt;<br>
&lt;/OGRVRTDataSource&gt;<br><br>-----------------------------<br>and ogr2ogr command<br>-------------------------------<br>ogr2ogr -f &quot;ESRI Shapefile&quot; 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">&lt;<a href="mailto:jgomezdans@gmail.com" target="_blank">jgomezdans@gmail.com</a>&gt;</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">&lt;<a href="mailto:gantonio.castillo@gmail.com" target="_blank">gantonio.castillo@gmail.com</a>&gt;</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 &quot;ESRI Shapefile&quot; -a_srs &quot;EPSG:4326&quot; &quot;puentes.shp&quot; &quot;ODBC:INACMASQL&quot;  -nlt POINT -sql &quot;SELECT p.nombre,t.latitud,t.longitud,t.altura FROM puente p,trayectoria t WHERE p.id_trajectory = t.id_trayectoria&quot;</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&#39;s an example in how to translate this query into a virtual dataset, which can then be translated into a shapefile easily in &lt;<a href="http://www.gdal.org/ogr/drv_vrt.html" target="_blank">http://www.gdal.org/ogr/drv_vrt.html</a>&gt;. Not tested, but basically create a file called the following file:<br>


<pre>&lt;OGRVRTDataSource&gt;<br>    &lt;OGRVRTLayer name=&quot;MyQuery&quot;&gt;<br>        &lt;SrcDataSource&gt;ODBC:INACMASQL&lt;/SrcDataSource&gt; <br><b>        &lt;SrcSQL</b>&gt;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&lt;/SrcSQL&gt;<br>


        &lt;GeometryType&gt;wkbPoint&lt;/GeometryType&gt; <br>        &lt;LayerSRS&gt;WGS84&lt;/LayerSRS&gt;<br>        &lt;GeometryField encoding=&quot;PointFromColumns&quot; x=&quot;long&quot; y=&quot;lat&quot;/&gt; <br>    &lt;/OGRVRTLayer&gt;<br>


&lt;/OGRVRTDataSource&gt;<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>