Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ogrinfo]

ogrinfo is a program in the suite of GDAL tools. ogrinfo provides information about an OGR supported data format (traditionally vector format types).

11
votes
3answers
3k views

Calculate total area of polygons in shapefile using GDAL?

I have a shapefile in British National Grid projection: Geometry: 3D Polygon Feature Count: 5378 Extent: (9247.520209, 14785.170099) - (638149.173223, 1217788.569952) Layer SRS WKT: PROJCS["...
7
votes
1answer
896 views

Using ogrinfo how to extract number of columns and attribute population?

Currently i'm using this DO ogrinfo -al -so to extract Projection, Feature count, Field_names for a bunch of files in batch mode. Is it possible to extract number of fields & how many fields are ...
4
votes
2answers
158 views

Reading various (non-.shp) vector types using ogrinfo

I am using the OSGeo4W shell to call ogrinfo on a directory (geodata) to see what vector files it includes: As you see, it lists two shapefiles and it tells me that it is using the shapefile driver; ...
4
votes
1answer
78 views

Why won't ogrinfo write to new column using informaiton from previous columns?

I'm having problems classifying an area of mixed forest using ogrinfo. I have an .sqlite file which contains the three columns; proportionclass1. proportionclass2, proportionclass3. I'm trying to ...
3
votes
2answers
337 views

ogr2ogr sql: what is the name of the geometry field?

I have the following ogrinfo -so output about a shapefile: Layer name: PREDEFINED Geometry: Polygon Feature Count: 58075 Extent: (425995.430000, 336399.500000) - (447356.663000, 359782.760000) Layer ...
2
votes
1answer
256 views

ogrinfo: Get a sample row from a GeoJSON file?

I know how to examine the properties of a GeoJSON file: ogrinfo my.geojson OGRGeoJSON -so But is there a way that I can retrieve a single feature's actual properties, to see what they look like? I ...
2
votes
0answers
170 views

ogrinfo: Unable to use sqlite dialect with -oo GEOM_POSSIBLE_NAMES open option

I am having problems using the SQLite SQL dialect to read a CSV file using ogrinfo, but only if I also specify a geometry column using the -oo GEOM_POSSIBLE_NAMES open option. Suppose file test.csv ...
2
votes
0answers
56 views

How to run ogrinfo for files listed in a CSV? [closed]

I am using this code to extract info's of all the tab files in a folder. We have a csv list which has, say 100 file names out of 500 files in that folder. How to modify the code only to do ogrinfo's ...
2
votes
0answers
25 views

Attribute table empty with custom driver in newer versions

I've written a custom ogr driver for one of our own formats. When loading the data I get to see vector data nicely displayed in Brighton/Essen/Pisa. However, when opening the 'Attribute Table' only ...
1
vote
1answer
587 views

ogrinfo says “Unable to open datasource” with KML?

I have a KMl file that will open fine in QGIS, but when I try to use ogrinfo I get: $ ogrinfo -so "myfile.kml" FAILURE: Unable to open datasource `myfile.kml' with the following drivers. -> ...
1
vote
1answer
207 views

How to List Fields of a Featureclass in a FileGDB using ogrinfo

I have an ArcGIS File Geodatabase, and I know that there is a featureclass within it. If I type: ogrinfo myfilegdb.gdb it lists the featureclasses within it. I now want to just find out what are the ...
1
vote
1answer
25 views

Add FID to attribute table using ogrinfo

I want to add the fid to the attribute table using ogrinfo in OSGeo4W Shell. Here is my code: ogrinfo layer.shp -sql "ALTER TABLE layer ADD COLUMN ID integer" ogrinfo layer.shp -dialect SQLite -...
1
vote
1answer
48 views

ST_Area(geometry) with ogrinfo estimates a stable area per grid cell

I use ST_area(geometry) in order to calculate the area of each grid cell of a vector grid with LCC projection and 6x6km2 resolution. The CRS of the vector is: +proj=lcc +lat_1=45 +lat_2=22 +lat_0=38.7 ...
1
vote
0answers
178 views

Trying to get GDAL 2.x to work, but ogrinfo reports ERROR 3: and ERROR 4: and “Failed to open table res_t48.PAT”

We have been using GDAL 1.9 for years on a Ubuntu 12.04 machine, but are trying to upgrade to Ubuntu 16.04 with the latest PostGIS and GDAL. When I install gdal-bin I end up with version 2.1.3. But ...
0
votes
2answers
46 views

How to efficiently extract specific metadata for many shapefiles?

I have a directory with 50 subdirectories containing a total of 300 shapefiles which I would like to query for their feature count and output to a text file. Thus far I am able to get the feature ...
0
votes
1answer
25 views

How to convert an ASCII file (with lat,lon coordinates) to a shapefile using OGR?

I have an ASCII file with the following columns : ID, longitude, latitude, value Is it possible to use OGR (ogr2ogr or ogrinfo) in command line in order to open the ASCII file and convert it to a ...
0
votes
1answer
2k views

How to install older GDAL v1.11 on Ubuntu 16.04 instead of v2.1.3

I have another question going on this forum regarding GDAL 2.1 ogrinfo not working at Trying to get GDAL 2.x to work, but ogrinfo reports ERROR 3: and ERROR 4: and "Failed to open table res_t48....
0
votes
2answers
247 views

Remove Duplicate Records IDENT field -Shapefile using GDAL OGRINFO or OGR2OGR

I have two shapefiles that I am merging/combining. However, this produces more than 4,000 duplicate records. I need to have only unique records. Is this possible with OGRINFO or OGR2OGR? I've ...
0
votes
0answers
51 views

Alter and update a shapefile with a field from an ASCII file using ogr

I have a vector file "map.shp" with a field ID. I have an attribute table (data.txt) with the following fields: ID, value1, value2. The field ID is the same in both files. I want to update map.shp by ...
0
votes
0answers
19 views

Using ST_Area(geography) with ogrinfo in command line?

I want to to calculate the ellipsoidal/spheroidal area of each grid cell of a vector grid using ogrinfo. When using ST_Area(geometry) I get the 2D planimetric area (which seems to be constant for a ...
0
votes
1answer
40 views

How to restrict the output parameters in ogrinfo?

Just want to know, is it possible to restrict the output parameters while using ogrinfo? For example, I need only the Projection details for a bunch of tab files, that too in a single continuous line ...