Forrest logo
back to the ogrinfo tool

ogrinfo:tldr:5e185

ogrinfo: Update a layer in the data source with SQL.
$ ogrinfo ${path-to-input-geojson} -dialect SQLite -sql "${UPDATE input SET attribute_name = 'foo'}"
try on your machine

The given command is using the ogrinfo utility, which is a part of the GDAL library, to interact with a GeoJSON file. Here's a breakdown of the command:

ogrinfo: The command-line utility for querying and analyzing geospatial data.

${path-to-input-geojson}: It is a placeholder for the path to the input GeoJSON file. You would need to replace it with the actual file path you want to operate on.

-dialect SQLite: Specifies that the SQL dialect used for the command is SQLite. SQLite is a lightweight database engine used within GDAL for various operations.

-sql "${UPDATE input SET attribute_name = 'foo'}": This is the SQL query being executed. It uses the SQL UPDATE statement to modify the data in the input GeoJSON file. The query is updating the attribute_name field in the input layer (assuming the existence of a layer with that name in the GeoJSON file) and setting its value to 'foo'.

To summarize, the command is updating the attribute_name field in a GeoJSON file using an SQL query through the ogrinfo utility.

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 ogrinfo tool