Repository navigation
Description
Before you start
- I searched the existing issues and the roadmap and did not find a duplicate request.
What problem does this solve?
#2984 made a zip read its workbook members, each one's first sheet, as when the workbook is added by itself. The zip reader passes those members, and its delimited ones, only the crs (read_zip_layers_budget builds CsvOptions { crs, ..Default::default() }). The x, y, wkt and delimiter given to layer.addData or layer.addUrl never reach them. A member whose coordinate columns the name detection doesn't recognise opens as a table with no geometry, and there's no way to say which columns they are.
The case behind this. The Geological Survey of Brazil publishes HYBRAS, the hydrophysical database of Brazilian soils (Ottoni et al., 2018, Vadose Zone Journal; 445 profiles, 1,075 horizons with water retention, van Genuchten parameters and Ksat). It comes only as a zip of four workbooks in its repository: https://rigeo.sgb.gov.br/bitstream/doc/19021/11/hybras_v1_2020.zip (1.65 MB, no login).
- The flat table is
HYBRAS_excel_arquivoShape_modif18_7_2019.xlsx. Its first sheet,ALL, has one row per horizon, with the coordinates inLongitudeORandLatitudeOR(decimal degrees, WGS 84). - The workbook added by itself:
layer.addDatawith"x": "LongitudeOR", "y": "LatitudeOR", "layer": "ALL"gives 1,075 points, in the 0.5.0 and 0.8.0 command line. - The same workbook without
xandy: it opens as a table. The detection doesn't takeLatitudeORfor a latitude, which is fair: theORsuffix isn't a bracketed note. - The zip, by path or by address: 0.8.0 refuses it ("no supported layers or tables in the archive could be read: … (unsupported file type: xlsx)"). On main since fix(data): a zip and pasted text read workbooks, GeoRSS, LandXML and every layer of a KML or GPX file #2984, it reads the members, but as tables only, because the
xandygiven are dropped.
A plugin (BrasilData) wants to add the profiles in the user's area straight from that address, without redistributing a copy of the data. Its licence isn't declared, so copying it isn't an option.
Proposed solution
The zip reader passes the caller's x, y, wkt and delimiter to its delimited and workbook members, as it passes crs today.
- Which members: a member that has the columns named gets them, and its rows become points (or WKT geometry), as when the member is added by itself.
- Which members are left as they are: a member that lacks one of the columns is read as now, with detection, and the notice names it: "HYBRAS_COMPLETE_V1.xlsx: no column LongitudeOR; read as a table". Shapefiles, KML and other members ignore the options, as their own readers do.
- The
delimiterapplies only to delimited members. - Where it reaches:
layer.addData,layer.addUrl,layer.addDownload(the URL's options already travel with the download), the command line, Python and the browser's bytes route. All of them read a zip withread_zip, so the change is in one place.read_zip_in/read_zip_layerstakeCsvOptions(or the columns besidecrs) instead ofcrsalone.
- Never silent: the notice counts the members that took the columns and names those that didn't have them.
layerkeeps its meaning: one layer of the zip, by name ("layer": "HYBRAS_excel_arquivoShape_modif18_7_2019"). With it, only that member becomes a layer.
Choices in this issue:
- Apply the columns to every member that has them, rather than require
layer. A zip of several CSVs with the same columns (a common way to publish data by year or region) then gives every one as points. - Don't widen the name detection to
LatitudeORand the like. Guessing suffixes risks taking a wrong column; explicitxandyare safer and already the documented way. - Leave the sheet choice inside a member for later. It would need
layerto name a member and a sheet together, for example"member.xlsx/Sheet". The first sheet covers this case and keeps fix(data): a zip and pasted text read workbooks, GeoRSS, LandXML and every layer of a KML or GPX file #2984's rule.
Crates: data (read_zip* take the column options and pass them to read_delimited_bytes_budget and sheets::read) and engine (layer.addData, layer.addUrl and layer.addDownload pass them through). No new dependency, command or parameter.
Testing:
- In
data: a zip built in the test with two CSVs and one XLSX, all withlon_x/lat_ycolumns that detection doesn't recognise, plus a CSV that lacks them.- With
xandy, the three members with the columns become points, and the fourth is a table with its notice. - Without them, nothing changes from main.
- With
wkt, a member's WKT column becomes geometry. - With
delimiter, a;member is read right.
- With
- In
engine:layer.addDataof that zip, andlayer.addUrlagainst a local server. - By hand: the HYBRAS zip by its address gives 1,075 points.
Estimated scope
Small: threading options that already exist through one reader.
Alternatives considered
- Run XY Table To Point on the table the zip gives. This works on main for a person, and a plugin could call the tool too. But it takes a second step and a second layer for what
layer.addDataalready does for a file by itself, and the same zip read by path and inside a zip would still differ. - Detect suffixed names (
LatitudeOR,lat_y). See the choices: explicit columns are safer. - The plugin redistributes a CSV. The data's licence isn't declared, so that isn't an option here.
Activity
choupeanut commentedon Nov 27, 2026
I'd like to take this one: I'll route every zip through the zip reader with the
x,y,wktand delimiter options (today they only reach it when acrsis also given, and the member options are built fromcrsalone), and say so for a member that lacks a named column. PR coming shortly.fix(data): a zip's CSV and workbook members take the x, y, WKT and de…
elpidioassinaturas commentedon Nov 28, 2026
Thanks @choupeanut for taking this on and for #3167, and thanks @Mavrick-F for the merge. With the
x,y,wktand delimiter options now reaching a zip's delimited and workbook members, the zipped tables I had in mind load as point and WKT layers directly.