Database Reference
In-Depth Information
How it works...
GDALisanopensourcelibrarythatcomestogetherwithseveralcommand-lineutil-
ities, which let the user translate and process raster and vector geo datasets in a
plethora of formats. In the case of vector datasets, there is a GDAL sublibrary for
managing vector datasets named OGR (therefore, when talking about vector data-
sets in the context of GDAL, we can also use the expression OGR dataset ).
When you are working with an OGR dataset, two of the most popular OGR com-
mands are ogrinfo , which lists many kinds of information from an OGR dataset,
and ogr2ogr , which converts the OGR dataset from one format to the other.
It is possible to retrieve a list of the supported OGR vector formats using the
-formats option on any OGR commands, for example, with ogr2ogr :
$ ogr2ogr --formats
The output of the preceding command is as follows:
Supported Formats:
-> "ESRI Shapefile" (read/write)
-> "MapInfo File" (read/write)
-> "UK .NTF" (readonly)
-> "SDTS" (readonly)
-> "TIGER" (read/write)
...
Note that some formats are read-only,while the others are read/write.
PostGISisoneofthesupportedread/writeOGRformats,soitispossibletousethe
OGRAPIoranyOGRcommands(suchas ogrinfo and ogr2ogr )tomanipulate
its datasets.
The ogr2ogr commandhasmanyoptionsandparameters;inthisrecipe,youhave
seen some of the most notable ones such as -f —to define the output format, -
t_srs —toreproject/transformthedataset,and -sql —todefinean(eventuallyspa-
tial) query in the input OGR dataset.
Search WWH ::




Custom Search