ogr2ogr is an open source command line utility popular for converting to and from various vector spatial data formats.

learn more… | top users | synonyms

3
votes
2answers
24 views

Ogr2ogr is rounding numeric field from PostgreSQL to 6 decimals

I am using ogr2ogr to convert the data from PostgreSQL to GeoJSON. PostgreSQL contains field named shape.area, type numeric, which stores values up to 17 decimal places, like 0.15627328781960101. The ...
2
votes
2answers
54 views

Converting shapefile to postgis without giving bounding box

ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL PG:"<myconnection>" -lco DIM=2 /path/to/myshapefilename.shp myshapefilename -overwrite -lco GEOMETRY_NAME=geom -lco FID=id -spat ...
1
vote
0answers
40 views

Is spat the correct flag to use in my ogr2ogr command?

I have an ogr2ogr command that I'm using to convert part of a Postgres database to a Geojson. I ingested all of Canada in my database and to start, I want to grab all of the buildings in the Toronto ...
4
votes
1answer
22 views

How to resolve error when launching OSeo4W Shell: Windows cannot find .bat file?

I downloaded and installed OSGeo4W to use ogr2ogr, but the the program OSGeo4W will not run. On launching the shell, I receive an error stating the .bat file cannot be found in specified directory ...
-1
votes
0answers
26 views

Why do I get a 503 error when pushing data to the CartoDB SQL API

I'm using ogr2ogr to push a large (200,000 feature) dataset to the CartoDB API. I'm using where_clauses to upload 500 features at a time, and sleeping every 20,000 features for a minute to give the ...
1
vote
0answers
20 views

ogr2ogr append 1 row to a File GDB feature class's data table

I export a polygon layer from Oracle to a FileGDB using ogr2ogr. I need to append one row to the data table, with '0' for numeric fields and 'No Elements' for the one string field. In ArcGIS, I run a ...
2
votes
1answer
26 views

Export to DXF from PostgreSQL using ogr2ogr

I have a large dataset in a PostGIS database (OS MasterMap). My aim is to export specific areas of this dataset to DXF, while retaining the attributes of the data as layers in the DXF. My current ...
1
vote
1answer
17 views

Convert KML polygons to lines

I've been given a KML file which should consist of linear features (train lines), but for some reason they're all represented as <Polygon> types. Each appears to have the right data, from end of ...
1
vote
0answers
31 views

ogr2ogr - Shapefile database SQL query; missing .cpg and .xml

I am using gdal and ogr2ogr to perform a SQL query on a database of shapefiles with the code below. The geoprocessing works and the appropriate shapefile is extracted from the query, but when I print ...
1
vote
1answer
25 views

Export Line Feature using ogr2ogr.

I am trying to export a line feature class from an oracle spatial database to a file geodatabase. I can export polygons with no problem, but cannot find the appropriate command '-nlt' for Line ...
3
votes
1answer
42 views

ogr2ogr: encoding issues when importing from Oracle Spatial to PostGIS

I'm trying to import some spatial tables from Oracle Spatial to PostGIS using ogr2ogr, but I can't figure out why the special characters on the attribute tables get messed up while I'm doing it. My ...
2
votes
0answers
39 views

Using ogr2ogr for clipping vector files

I am looking for alternative (more efficient) methods for clipping large feature class datasets. When using the 'Clip' tool in ArcGIS, often times the tool will crash after many hours of processing. ...
3
votes
2answers
34 views

Conversion of .shp to EPSG:4326 has slight offset

I just started this project where I need to project the Dutch municipalities on a map. Luckily this seems very easy with the help of GeoJSON. However, I'm having a slight issue where my conversion to ...
0
votes
1answer
48 views

ogr2ogr - Clipping postgis and creating geojson

I'm trying to create a geojson file data based on data from my local postgis database using ogr2ogr. I'm trying to clip to a specific area and when I start to run the command, everything starts fine, ...
0
votes
1answer
18 views

Use ogr2ogr to delete content of table and load new data from shapefile

Is it possible to load a shape file to a postGIS database by replacing the content of the table with the new content of the shape file WITHOUT DROPING the table? I want to do this using ogr2ogr. In ...
0
votes
0answers
20 views

Installation and execution of GDAL

I am trying to install GDAL on the remote server. I do: pip install GDAL==1.9.1 It gets installed and then I try to do: gdalinfo --version But I get 'command not found'. I understand that I ...
0
votes
1answer
37 views

Converting shapes using OGR2GUI

I am trying to convert a MapInfo .TAB file to a Shape file while setting the projection of the target to NAD83 UTM Zone 19. The latest version of OGR seems to not have this projection available in the ...
1
vote
1answer
49 views

ogr2ogr Set Feature to Column Name?

I'm converting PostGIS data to PDF via GDAL 2.0.2 with below. ogr2ogr -f "PDF" mypdf.pdf PG:"host=domain.com user=me password=mypassword dbname=mydb" -sql "SELECT geom, state_name, sub_region, ...
1
vote
0answers
13 views

ogr2ogr FAILURE: Couldn't fetch requested layer 'ùnlt'!

I am getting the following error message with ogr2ogr while try to convert into MySQL. I have tried PGeo,Shapefile and FileGDB. FAILURE: Couldn't fetch requested layer 'ùnlt'! My environment is ...
0
votes
1answer
28 views

How to extract a shapefile with a SQL expression from a database of shapefiles using PyQGIS or OGR [duplicate]

I have a shapefile Water_Districts.shp that consists of several water district polygons. I am trying to use the script below to 'extract' a specific polygon with the name Cache La Poudre River listed ...
3
votes
2answers
45 views

ogr2ogr sql query from text file

In ogr2ogr or ogrinfo, I can successfully query an Oracle database using this command as a test: ogrinfo -al -so "OCI:USER/PASSWORD@SERVER/DATABASE" -sql "SELECT * FROM SCHEMA.TABLE" However, ...
0
votes
1answer
53 views

Combining GeoJSON Features

I haven't been able to find a solution with the source so am trying to work on the output file. I have also asked this question on SO I have a large (200MB) geoJSON file that has a lot of complex ...
1
vote
0answers
49 views

ogr2ogr - mapinfo to geojson. Merging shapes with certain values

I'm just starting out with this so apologies if I explain things poorly. I have some mapinfo files (TAB, IND, MAP etc) and I am trying to convert to Geojson. I can do this using ogr2ogr ogr2ogr ...
6
votes
1answer
103 views

Why isn't QGIS detecting CRS from .prj file?

I have a number of 1 km hexagonal grids that cover various counties in the United States in a postgreSQL/postGIS database. Each grid has the CRS EPSG:3857, and the counties layer has EPSG:3857. When ...
1
vote
1answer
30 views

Truncate a Shapefile field with SQL and ogr2ogr

I want to create a new attribute which is the first 8 characters of another, using ogr2ogr. To my surprise, this didn't work: ogr2ogr -f "ESRI Shapefile" a.shp b.shp -sql "select FID,left(FLOORKEY,8) ...
0
votes
1answer
33 views

Converting Shapefiles to KML and extruding on height

I am working on a free/open source workflow to ingest OSM data and convert it to a KML so I can view it in 3D with Google Earth. I used ogr2ogr to convert to a shapefile and have extracted the height ...
0
votes
1answer
38 views

JSONs made from shapefiles are not plotting (using folium or Leaflet alone)

My goal is to plot two shapefiles as layers on an interactive map. The files I'm using live at https://github.com/AnnaMag/maps. I transformed shapefiles to .geojson using ogr2ogr -f ... e.g. ...
0
votes
0answers
21 views

intersect geotiff with bbox

In a project using gdal I need to crop a geotiff file with bbox in pixel or coordinates epsg:4326. This step is ok. The next step is to manage cases where the image size is "lower" than the bbox size ...
2
votes
1answer
32 views

Transformation from EPSG 2178 to EPSG 4326 gml.file?

How can I transform .gml file from EPSG 2178 to EPSG 4326? I used the following without success: gdaltransform -s_srs EPSG:2178 -t_srs EPSG:4326 "file1.gml"
1
vote
0answers
30 views

Ogr2ogr: Shape to MySQL. Delete (or ignore) “geometry_columns” and “spatial_ref_sys”

Im exporting a shapefile to my MySQL database. But as standard it also add the additional metadata tables: "geometry_columns" and "spatial_ref_sys" Is there a way to either delete these tables or ...
0
votes
1answer
59 views

How to convert data from GML to GeoJSON using ogr2ogr?

How should I convert GML to geojson data using ogr2ogr. I used : ogr2ogr -f "GeoJSON" bd.geojson bd.gml But in this case I have only part of my data , not all. I tried add -append , but it didn't ...
2
votes
1answer
53 views

ogr2ogr batch load shapefiles into geodatabase

I'm trying to load a directory of shapefiles into a geodatabase with ogr2ogr. It works fine if I specify a single shapefile, but can't open the datasources if I specify a wildcard. Is there a wildcard ...
2
votes
0answers
35 views

ogr2ogr imports GML data (not from OSM) to Postgis but without the other_tags “hstore”-column

The problem I'm encountering some issue trying to use ogr2ogr to import some GML input data (not OSM) into Postgres. I'm trying to use COLUMN_TYPES=other_tags=hstore to store all the fields not ...
2
votes
1answer
51 views

Populate lat/long using ogr2ogr

I have a shapefile with coordinates listed in Easting and Northing in the attribute table. Is it possible to create two new fields called lat and long and populate them with values corresponding to ...
2
votes
1answer
34 views

org2ogr PostgreSQL to GPX

I already have found how to import GPX files into PostgreSQL using gdal/org2org. Now I am wondering of dumping into GPX files the results of my modification on dataset stored into PostgreSQL. But I ...
2
votes
0answers
38 views

How to remove projection in terminal from .shp file with valid .prj available

I have .prj, .shp, .sbn, .sbx, .shx, .dbf files where the content of the .prj file is the following: ...
0
votes
0answers
29 views

osx terminal ogr2ogr batch covert .json to .kml

using osx El Capitan terminal This works fine one file at a time to convert .json to .kml ogr2ogr -f "KML" xxx.kml xxx.json I would like to do all files at once I have tried for %f in (*.json) do ...
1
vote
1answer
106 views

ogr2ogr Shapefiles to Postgres SRS problem

I am trying to import to my Postgresql (9.1+129ubuntu1) + PostGIS (1.5.3-2) database a Shapefile with polygons with the ogr2ogr tool from Gdal-Bin package (1.7.3-6ubuntu3). I know the origin SRS of ...
0
votes
0answers
31 views

Copy specfic layer to new datasource using OGR Swig Java bindings

Is it possible to efficiently copy a specific layer from one datasource to a different datasource using GDAL/OGR Java bindings? I know it is possible to create a new layer in the target data source ...
3
votes
1answer
120 views

Convert KML to GeoJSON with ogr2ogr and remove KML special attributes

I'm trying to convert KML to GeoJSON (or some other formats) using ogr2ogr (look at this question). It's all working fine, except of one problem: I'm always receiving these metadata attributes with ...
1
vote
0answers
79 views

How to convert csv file into geo database file?

I have a csv file that i want to export to a file geodatabase (*.gdb) in C#. I am currently looking into GDAL ogr2ogr commands. They have a way to convert gdb file into csv file but not the ...
2
votes
1answer
49 views

Convert *.asc OSGB36 files to WGS84 GeoTIFF using gdal/ogr2ogr

I am trying to obtain elevation readings using gdallocationinfo (as per other datasets I have) from a set of .asc files containing elevation data (plus an associated .prj file), using WGS84, but I ...
4
votes
2answers
99 views

ogr2ogr of NTF_Lambert_II_etendu is off by about 30 meters

I am converting RPG files in NTF_Lambert_II_etendu to wgs_84 using: ogr2ogr -t_srs EPSG:4326 ilot_2008_027_wgs84_2.shp ilot_2008_027.shp but the result is off by about 30 meters. Surprisingly, the ...
2
votes
1answer
89 views

Split SHP file using ogr2ogr

I am trying to split a SHP file using all the attributes in the column header SUBURB. Below is an example of the attribute table sitting behind the SHP file: Name Suburb ABC BAY ...
0
votes
1answer
19 views

Attempting to convert from GML to GeoJSON produces garbage

The file seems to convert without error, however when I attempt to display it on anything or any map, the coordinates are always rendered as a straight line across the top of the projection. I am not ...
0
votes
1answer
38 views

Determining of vector dataset single files to specify its size on a disk

I wonder how to get size of disk space that a specific vector dataset occupies on a disk. I didn't find any ogr2ogr util or OGR Python method that can return a list of files that belongs to given ...
1
vote
1answer
77 views

Gdal ogrinfo CSV unable to open datasource

When I try to import a csv file into a PostgreSQL table with the Gdal ogr2ogr tool I get the "Unable to open datasource" Failure. So I tried to open it with the tool ogrinfo and I get the same ...
0
votes
0answers
19 views

SQL Server aggregate function in ogr2ogr command

I would like to define create a GeoJSON bounding box using SQL Server's EnvelopeAggregate function, embedded in an ogr2ogr command. I have the following command: ogr2ogr -f GeoJSON envelope.json ...
1
vote
0answers
50 views

converting shp to fileGDB with ogr2ogr changes geometry type?

I'm converting a shapefile to file geodatabase with GDAL 1.11.3 and the ESRI FileGDB driver. ogrinfo on the .shp gives: $ ogrinfo NED1_Index.shp INFO: Open of `NED1_Index.shp' using driver `ESRI ...
0
votes
0answers
19 views

Use ogr2ogr to get KML out of PostGIS

I am trying to export a Postgis database table into KML using ogr2ogr. When I execute this command in terminal (Ubuntu 12) I just get the "documentation" back but no result or error: ogr2ogr -f "KML" ...