[gdal-dev] ogr2ogr and GPX files
Dylan Beaudette
dylan.beaudette at gmail.com
Tue Mar 4 17:40:44 EST 2008
On Tuesday 04 March 2008, Tamas Szekeres wrote:
> Dylan,
>
> Would you attach this ogr2ogr commandline string and the corresponding
> test data to
> http://trac.osgeo.org/gdal/ticket/2171
> I'll look into the problem than.
>
> ( That's why I still haven't closed this ticket ;-)
>
>
> Best regards,
>
> Tamas
Thanks Tamas:
http://trac.osgeo.org/gdal/ticket/2171#comment:5
Cheers,
Dylan
>
> 2008/3/4, Dylan Beaudette <dylan.beaudette at gmail.com>:
> > On Tuesday 04 March 2008, Tamas Szekeres wrote:
> > > Hi,
> > >
> > > Yes, you should try with the recent SVN version. The changes related
> > > to this issue are pretty new.
> > >
> > > Best regards,
> > >
> > > Tamas
> >
> > Hi Tamas,
> >
> > Thanks for the tip. Unfortunately, even with today's SVN, I still get
> > the same error:
> >
> >
> > ERROR 1: SQL: Missing comma after column cat in SELECT statement.
> >
> >
> > Cheers,
> >
> >
> > Dylan
> >
> > > 2008/3/4, Dylan Beaudette <dylan.beaudette at gmail.com>:
> > > > On Monday 03 March 2008, Even Rouault wrote:
> > > > > In fact, using the same principle, you can use just one command
> > > > > line and no intermediary file :
> > > > >
> > > > > ogr2ogr -f GPX destination.gpx source.shp -sql "SELECT
> > > > > src_field_1 AS name, src_field_2 AS desc FROM
> > > > > your_source_layer_name"
> > > > >
> > > > > Thanks to FrankW for the tip ;-)
> > > >
> > > > Thanks Even / Frank.
> > > >
> > > > One small problem:
> > > >
> > > >
> > > >
> > > > ogr2ogr -t_srs '+proj=latlong +datum=WGS84' \
> > > > -f GPX -dsco GPX_USE_EXTENSIONS=YES \
> > > >
> > > > veg_points.gpx veg_points.shp \
> > > > -sql "SELECT cat AS foo FROM veg_points"
> > > >
> > > > ERROR 1: SQL: Missing comma after column cat in SELECT statement.
> > > >
> > > > Could this be a bug or my version of GDAL too old ? This is with
> > > > GDAL SVN, checked out a couple of weeks ago.
> > > >
> > > > I get a valid GPX file if I do not use the "AS foo" operator.
> > > >
> > > > Ideas?
> > > >
> > > >
> > > > Dylan
> > > >
> > > > > Le Monday 03 March 2008 19:43:12 Even Rouault, vous avez écrit :
> > > > > > Hi,
> > > > > >
> > > > > > I see your point...
> > > > > >
> > > > > > The solution is the powerful OGR Virtual Dataset format !
> > > > > > See http://www.gdal.org/ogr/drv_vrt.html
> > > > > >
> > > > > > In fact, the documentation should probably be extended to
> > > > > > demonstrate the power of the OGR SQL for that particular case
> > > > > >
> > > > > > Try to paste the following lines in a file (remapped_layer.vrt
> > > > > > would be fine)
> > > > > >
> > > > > > <OGRVRTDataSource>
> > > > > > <OGRVRTLayer name="remapped_layer">
> > > > > > <SrcDataSource>your_source.shp</SrcDataSource>
> > > > > > <SrcSQL>SELECT src_field_1 AS name, src_field_2 AS desc
> > > > > > FROM your_source_layer_name</SrcSQL>
> > > > > > </OGRVRTLayer>
> > > > > > </OGRVRTDataSource>
> > > > > >
> > > > > > Replace your_source.shp, src_field_1, src_field_2 and
> > > > > > your_source_layer_name by the appropriate values from your
> > > > > > source dataset and 'ogrinfo -ro -al remapped_layer.vrt' should
> > > > > > show a structure compatible of a GPX file.
> > > > > >
> > > > > > Best regards,
> > > > > > Even
> > > > > >
> > > > > > Le Monday 03 March 2008 07:04:41 Dylan Beaudette, vous avez
écrit :
> > > > > > > Hi,
> > > > > > >
> > > > > > > is there a simple approach (via ogr2ogr) to create GPS files
> > > > > > > which have standard waypoint tags such as <name>, <elev>,
> > > > > > > <cmt>, etc. by re-mapping columns in the attribute table of
> > > > > > > the source vector?
> > > > > > >
> > > > > > > for example:
> > > > > > >
> > > > > > > # export points vector from GRASS
> > > > > > > v.out.ogr in=wp type=point dsn=wp.shp
> > > > > > >
> > > > > > > # convert tp GPX:
> > > > > > > ogr2ogr -t_srs '+proj=latlong +datum=WGS84' \
> > > > > > > -f GPX -dsco GPX_USE_EXTENSIONS=YES \
> > > > > > > wp_gps.gpx wp.shp
> > > > > > >
> > > > > > > This results in a working GPX waypoints file, that when
> > > > > > > uploaded to a GPS is functional, but the waypoints are all
> > > > > > > re-named sequentially. Note that I am uploading the GPX file
> > > > > > > the GPS via gpsbabel.
> > > > > > >
> > > > > > > Does anyone know of the appropriate incantation that one
> > > > > > > could use to translate the column structure of the input
> > > > > > > wp.shp (i.e. the stuff in its .dbf) into standard waypoint
> > > > > > > tags?
> > > > > > >
> > > > > > > thanks in advance!
> > > > > > >
> > > > > > > PS: trying to write a simple tutorial for some colleagues [1]
> > > > > > >
> > > > > > > 1. http://casoilresource.lawr.ucdavis.edu/drupal/node/553
> > > > > >
> > > > > > _______________________________________________
> > > > > > gdal-dev mailing list
> > > > > > gdal-dev at lists.osgeo.org
> > > > > > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> > > >
> > > > --
> > > > Dylan Beaudette
> > > > Soil Resource Laboratory
> > > >
> > > > http://casoilresource.lawr.ucdavis.edu/
> > > >
> > > > University of California at Davis
> > > > 530.754.7341
> > > > _______________________________________________
> > > >
> > > > gdal-dev mailing list
> > > > gdal-dev at lists.osgeo.org
> > > > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >
> > --
> >
> > Dylan Beaudette
> > Soil Resource Laboratory
> > http://casoilresource.lawr.ucdavis.edu/
> > University of California at Davis
> > 530.754.7341
--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341
More information about the gdal-dev
mailing list