Skip to content

Doc: Add vector pipeline example#14087

Open
geographika wants to merge 2 commits intoOSGeo:masterfrom
geographika:pipeline-example
Open

Doc: Add vector pipeline example#14087
geographika wants to merge 2 commits intoOSGeo:masterfrom
geographika:pipeline-example

Conversation

@geographika
Copy link
Collaborator

Add a new vector pipeline example. I have included notes on all the foolish user errors I encountered, in case others do the same.

I added a diagram for the pipeline, which while not complicated, does have clickable links for each of the steps involved which could be useful.

PR also fixes a RST error with existing example title.

@geographika geographika added documentation Issues and contributions to the documentation content funded through GSP Work funded through the GDAL Sponsorship Program labels Mar 7, 2026
@geographika geographika marked this pull request as ready for review March 7, 2026 11:22
field required by the filter is removed by ``select``, it will not be
available and the command will fail with: ``ERROR 1: "worldcity" not recognised as an available field.``

If you want the output to contain spatial data, you must also include the geometry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we implement gdal vector select --fields worldcity --geometry as a frendlier alternative?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't obvious to me that geometry would have to be explicitly added to the list, particularly in a pipeline.

I'd guess excluding geometry would be the rarer use-case? Would it make sense to always include the (first/default) geometry field and have an --exclude-geometry option? Maybe even just rely on the current select --exclude "_ogr_geometry_" approach (and I can add an example to the page).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - see #11839

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd not seen that discussion - so consider me one of the surprised users!

geometry. If no geometry field is included, reprojection will
fail with: ``ERROR 1: reproject: Layer 'ne_110m_populated_places_simple' has no spatial reference system``.

Finally, ensure that there are **no spaces** between the field names in the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rouault do we allow spaces in field names? If not, let's just trim them from the field names.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes spaces are generally valid for field names (unless a driver doesn't allow them)

Copy link
Collaborator Author

@geographika geographika Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From vector select

Field names with spaces, commas or double-quote should be surrounded with a starting and ending double-quote character

Maybe any leading/trailing spaces should be trimmed?
I'm guessing it is more likely a user would try:

select --fields "field1, field2, field3"

Than if they actually have trailing spaces in their field names (e.g. "field2 " and "field3 "). In that case they'd need to use the quoting as suggested:

select --fields "field1, \"field2 \", \" field3 \""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe any leading/trailing spaces should be trimmed?

I'd rather not create special cases and stick to a predicatable, even if slightly annying, syntax


.. only:: html

.. image:: ../../images/programs/gdal_pipeline_vector_example.svg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't rendering correctly for me...

Image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image was too wide. I've switched to using the vertical layout for this example: https://gdal--14087.org.readthedocs.build/en/14087/programs/gdal_vector_pipeline.html#programs/gdal_vector_pipeline-4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Issues and contributions to the documentation content funded through GSP Work funded through the GDAL Sponsorship Program

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants