3. Retrieving information from GIS data

3.2. Retrieve information from vector data

For retrieving info from vector data we use the gdal vector info command. However, we can also use the same gdal info command.

1. Execute the following command:
gdal info roads.shp <ENTER>
gdal info gem_2011_gn1.shp <ENTER>

2. Answer these questions:

  • What are the projections of these two shapefile?
  • What are the EPSG codes?
As you can see there are several EPSG codes reported. That is because different elements of the projection have their own EPSG code. The rule of thumb is that you can take the last EPSG code. So the projection of roads.shp is EPSG: 4326, which means that it is in Geographic Coordinate System (GCS) with coordinates in Latitude/Longitude.
For gem_2011_gn1.shp the projection is EPSG: 28992, which is the Dutch projection (Amersfoort RD/New).
 
We can also retrieve information about the features in a vector layer.
 
3. Execute the following command:
gdal vector info --features gem_2011_gn1.shp
 
This prints all the features in the file to the screen, which is too much. To just get an overview, it's easier to limit the amount of features displayed.
 
4. Execute the following command:
gdal vector info --features --limit 1 gem_2011_gn1.shp
 

This will show only the first feature, so we have overview of the fields in the attribute table. 

More info about the gdal info  command can be found here.