[gdal-dev] ingesting .gpx files from FFI

Joaquim Manuel Freire Luís jluis at ualg.pt
Fri Oct 29 10:05:13 PDT 2021


Ah, Ghrrr. Not in this simple code sample but I (thought) I did in the real implementation

https://github.com/GenericMappingTools/GMT.jl/blob/master/src/gdal_utils.jl#L197

but it only looked at the first layer

making it scan all layers produces the correct plot.

Cheers

Joaquim


From: Even Rouault <even.rouault at spatialys.com>
Sent: Friday, October 29, 2021 5:50 PM
To: Joaquim Manuel Freire Luís <jluis at ualg.pt>; gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] ingesting .gpx files from FFI


You didn't explore completely the dataset. The waypoints layer has 0 feature, but the tracks one has 1 and the track_points one 2469
Le 29/10/2021 à 18:32, Joaquim Manuel Freire Luís a écrit :
Hi,

Trying to read .gpx files from Julia (and I would bet, from python too but can’t test it) is showing puzzling results.
For example, with the attached gpx file I get this

julia> ds = gdalread("25708.gpx", gdataset=true);

julia> layer = getlayer(ds, 0)
Layer: waypoints (1)
  Geometry 0 (�∟*��): [1]
     Field 0 (ele): [Real]
     Field 1 (time): [9999]
     Field 2 (magvar): [Real]
     Field 3 (geoidheigh): [Real]
     Field 4 (name): [String]
...
Number of Fields: 23

But there are no Features in the layers, so I can’t get the data from the geometries

julia> GMT.Gdal.nfeature(layer)
0

HOWEVER, both the GDAL `ogr2ogr` command line or it’s Julia wrapper works in converting, e.g., to geopackage

julia> ogr2ogr("25708.gpx", dest="25708.gpkg")

and I can now plot "25708.gpkg" (not shown here but the plot can be seen in https://discourse.julialang.org/t/what-is-your-favorite-mapping-package/70509/22?u=joa-quim)

How is ogr2ogr able to read this file data?

Thanks

Joaquim





_______________________________________________

gdal-dev mailing list

gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>

https://lists.osgeo.org/mailman/listinfo/gdal-dev

--

http://www.spatialys.com

My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211029/e9c07c9b/attachment-0001.html>


More information about the gdal-dev mailing list