Forrest logo
back to the ogr2ogr tool

ogr2ogr:tldr:90ae5

ogr2ogr: Reduce a GeoJSON to features matching a condition.
$ ogr2ogr -where '${myProperty > 42}' -f ${GeoJSON} ${path-to-output-geojson} ${path-to-input-geojson}
try on your machine

This command is using the command-line tool ogr2ogr to convert an input GeoJSON file into a new output GeoJSON file based on a specified condition. Here's a breakdown of the command:

  • ogr2ogr: It's the name of the command-line tool used for performing operations on geospatial data.
  • -where '${myProperty > 42}': It is an option used to filter the features from the input GeoJSON file based on a condition. In this case, the condition is that the value of the attribute or property named "myProperty" must be greater than 42.
  • -f ${GeoJSON}: Specifies the output format for the converted file. In this case, it's GeoJSON.
  • ${path-to-output-geojson}: It is the path or location where the resulting output GeoJSON file will be created or saved.
  • ${path-to-input-geojson}: It is the path or location of the input GeoJSON file that needs to be converted.

In summary, this command would take an input GeoJSON file, apply a filter condition to select only the features where the "myProperty" attribute is greater than 42, and store the resulting features in a new output GeoJSON file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ogr2ogr tool