XLX/XLSX: point geometry from fields
Feature description
While CSV driver supports creating point geometry from fields (https://gdal.org/en/stable/drivers/vector/csv.html#building-point-geometries), the XLX/XLSX doesn't seem to support this feature (https://gdal.org/en/stable/drivers/vector/xlsx.html). Is there any particular reason why it's not supported by XLS/XLSX driver?
Additional context
No response
Is there any particular reason why it's not supported by XLS/XLSX driver?
Such built-in logic needs to be implemented in each driver and thus has a initial and long term cost. Luckily there's a generic solution using a OGR VRT file like in https://gdal.org/en/stable/drivers/vector/vrt.html#example-odbc-point-layer
Thanks for quick answer! It would be valuable to mention OGR VRT solution in XLX/XSLX documentation (add a new example)?
Note: OGR VRT seems to be still limited when you what to create geography in PostGIS instead of geometry. While CSV supports geography type.
While CSV supports geography type.
what makes you think so ? OGR itself (the abstraction) doesn't kow about PostGIS geography vs geometry, only the PostGIS driver does. The CSV driver itself is certainly not aware of that.
<OGRVRTDataSource>
<OGRVRTLayer name="lucas_grid">
<SrcDataSource>LUCAS-Master-Grid.xlsx</SrcDataSource>
<SrcLayer>Master_web</SrcLayer>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="X_WGS84" y="Y_WGS84"/>
</OGRVRTLayer>
ogrinfo lucas_grid.vrt -so -al
works as expected:
INFO: Open of `lucas_grid.vrt'
using driver `OGR_VRT' successful.
Layer name: lucas_grid
Geometry: Point
@rouault Thanks for support!
If you know what to search, it is already documented in https://gdal.org/en/stable/drivers/vector/xlsx.html
Each sheet is presented as a OGR layer. No geometry support is available directly (but you may use the OGR VRT capabilities for that).