Hello Jose I can create the Shapefile from "ODBC:SQL Server 2008" connection, with the OGR VRT :D
thank you!!! :P the .ovf file ---------------------- puentes.ovf ---------------------- <OGRVRTDataSource> <OGRVRTLayer name="Puentes"> <SrcDataSource>ODBC:INACMASQL</SrcDataSource> <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> <GeometryType>wkbPoint</GeometryType> <LayerSRS>WGS84</LayerSRS> <GeometryField encoding="PointFromColumns" x="long" y="lat"/> </OGRVRTLayer> </OGRVRTDataSource> ----------------------------- and ogr2ogr command ------------------------------- ogr2ogr -f "ESRI Shapefile" puentes.shp puentes.ovf On Tue, Feb 2, 2010 at 12:33 PM, Jose Gomez-Dans <jgomezd...@gmail.com>wrote: > Hi > > On 2 February 2010 17:11, Antonio Castillo <gantonio.casti...@gmail.com>wrote: > >> 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" > > > 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 < > http://www.gdal.org/ogr/drv_vrt.html>. Not tested, but basically create a > file called the following file: > > <OGRVRTDataSource> > <OGRVRTLayer name="MyQuery"> > <SrcDataSource>ODBC:INACMASQL</SrcDataSource> > * <SrcSQL*>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> > > > <GeometryType>wkbPoint</GeometryType> > <LayerSRS>WGS84</LayerSRS> > <GeometryField encoding="PointFromColumns" x="long" y="lat"/> > </OGRVRTLayer> > > > </OGRVRTDataSource> > > > and then convert it into a Shapefile using ogr2ogr. > > Hope that helps! > Jose > -- Ing Germán Antonio Castillo P. --------------------------------------- www.AcaroLabs.org
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev