Why is ogr2ogr not opening my shapefile?
First, ogr2ogr couldn’t open your shapefile, and you realized permissions issues were in fact affecting the OS user accessing your shapefile. But there is an important lesson here for others, specifically, ogr2ogr’s error message on this point was misleading!
How to convert shapefile to MIF in GDAL?
According to the MapInfo TAB and MIF/MID driver documentation, you may also need to specify also the dataset creation option -dsco FORMAT=MIF in order to create MIF/MID instead of TAB files ( TAB is the default): You can also add the -overwrite option if the MIF file already exists. Hope this helps.
How to run ogr2ogr command as Sudo?
At first, consider executing your ogr2ogr command as sudo to rule-out permissions issues until after you know for certain your script is working as intended. Also as @user1919 realized, make sure your SQL user has sufficient privileges on both the database targeted by your script, as well as the spatial_ref_sys table.
How to convert a shapefile to a PostGIS?
Can be useful when converting shapefiles to PostGIS and other target drivers that implement strict checks for geometry types. In other words, if you use the PROMOTE_TO_MULTI flag, then ALL of your features will be converted to multipart features, even when they consist of a single part.
What kind of geospatial data can ogr2ogr support?
ogr2ogr is supporting 5 types of geospatial data : “ESRI Shapefile”, “TIGER”, “MapInfo File”, “GML”, “PostgreSQL” ( Even if not mentionned in GDAL documentation, GeoJSON is actually supported ). ogr2ogr is an effective tool to use when you need to upload large shapefiles into a PostgreSQL/PostGIS database (compare to QGIS DB Manager).
How to use ogr2ogr as a command line tool?
This guide is intented to GIS analyst using QGIS who need to use ogr2ogr command line easily on a Windows environment. What is ogr2ogr ? ogr2ogr is a Command Line tool provides by GDAL, a Geospatial Data Abstraction Library. Traditionally GDAL used to design the raster part of the library, and OGR the vector part for Simple Features.
Why is ogr2ogr unable to open DataSource?
When I run ogr2ogr on my set up I get error: Unable to open datasource ‘host=pg.rambck.local dbname=projects…….’ OpenFileGDB is listed in the list of drivers.
How to import ISO2 features in ogr2ogr?
Using some of the options from ogr2ogr, you will import only the features from SUBREGION=2 (Africa), and the ISO2 and NAME attributes, and rename the feature class to africa_countries:
What are the parameters of the ogr2ogr command?
The ogr2ogr command has many options and parameters; in this recipe, you have seen some of the most notable ones such as -f to define the output format, -t_srs to reproject/transform the dataset, and -sql to define an (eventually spatial) query in the input OGR dataset.