Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 2891

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

3 votes

how to use GDAL ogr2ogr

path %PATH%;C:\OSGeo4W64\apps\Python37\Scripts set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python37 Cmd.exe When you run this you can now type in ogr2ogr
GeorgeC's user avatar
  • 8,298
0 votes
1 answer
131 views

ogr2ogr Warning 502: Field name 'yyy xx' contains invalid characters. 'yyy_xx' will be used ...

Here's what I use ogr2ogr -skipfailures -f "MapInfo File" -lco overwrite=yes -lco launder=no -lco relaxedFieldNameMatch=yes -lco unsetDefault=yes "D:\QG\vw_CONFIRM_PavementCondition.tab" "MSSQL:Server= …
GeorgeC's user avatar
  • 8,298
1 vote
1 answer
281 views

Converting MSSQL linked MapInfo Tab file to a shapefile using ogr2ogr

ASSET_Bridge_b0c1d436_6728_428f_a1dc_f22c15fe8c38" checked="Qt::Checked" providerKey="ogr" name="ASSET_Bridge"> <customproperties/> </layer-tree-layer> Using the advice in https://alastaira.wordpress.com/ogr2ogr-patterns-for-sql-server … / I see the command should be something like ogr2ogr -f “ESRI Shapefile” “C:\scratch\vw_ASSET_Bridge.shp” “MSSQL:server=xxx_GIS;database=xxx_GIS;trusted_connection=yes;” -sql “SELECT [ID],[GeoType],[ …
GeorgeC's user avatar
  • 8,298
0 votes
Accepted

ogr2ogr Warning 502: Field name 'yyy xx' contains invalid characters. 'yyy_xx' will be used ...

We will however have to change the way that OGR2OGR converts the names as "80L" becomes "_0L" instead of simply adding a underscore at the start to make it "_80L" ATM we have to map the field names to …
GeorgeC's user avatar
  • 8,298
0 votes
Accepted

OGR2OGR -overwrite mssql table is appending instead

So simply deleting/renaming the table before running the OGR2OGR command the first time, ensures that the data is just updated/replaced and not appended in subsequent calls. …
GeorgeC's user avatar
  • 8,298
1 vote
Accepted

Converting MSSQL linked MapInfo Tab file to a shapefile using ogr2ogr

Figured it out...KISS principle as a lot of what Mapinfo/tab format required wasn't necessary in OGR C:\OSGeo4W\bin\ogr2ogr.exe -f "MapInfo File" bridges.tab "MSSQL:Server=xxxxx;Database=_gis;User ID …
GeorgeC's user avatar
  • 8,298
1 vote
Accepted

Uploading TAB data to MSSQL using ogr2ogr

ogr2ogr -overwrite -f "MSSQLSpatial" "MSSQL:Server=zzz;Database=NGSC_GIS_Test;UID=xx;PWD=yyy" bridges.shp -a_srs "EPSG:28354" -nln "MGM_Bridges_test" …
GeorgeC's user avatar
  • 8,298
0 votes
1 answer
1k views

Uploading TAB data to MSSQL using ogr2ogr

ATTEMPTS ogr2ogr -f "MSSQL:Server=xxx;Database=_GIS_Test;UID=yyy;PWD=zzz" -nln “D:\QGIS_Development\mssql\bridges.shp” “MGM_Bridges_test” a_srs EPSG:4326 -t_srs EPSG:28354 -nln “MGM_Bridges_test” CD … to folder and ogr2ogr -overwrite -f “MSSQLSpatial” “MSSQL:Server=z;Database=_GIS_Test;UID=xxx;PWD=yyy" bridges.shp a_srs EPSG:4326 -t_srs EPSG:28354 -nln “MGM_Bridges_test” 3. …
GeorgeC's user avatar
  • 8,298
0 votes
1 answer
867 views

OGR2OGR -overwrite mssql table is appending instead

I am running Command '['C:\\OSGeo4W\\bin\\ogr2ogr.exe', '-progress', '-skipfailures', '-overwrite', '-lco', 'UPLOAD_GEOM_FORMAT=wkt', '-t_srs', 'EPSG:28354', '-f', 'MSSQLSpatial', 'MSSQL:Server=xxx …
GeorgeC's user avatar
  • 8,298
2 votes
1 answer
517 views

ogr2ogr issues in clipping tab to shp where tab has points and lines together

I am running a simple script to clip and convert all tab files in a directory via osgeo shell for %f in (*.TAB) do ogr2ogr "%~dpnf_Clip.shp" -clipsrc "clipped\AOI.TAB" "%f" -f "ESRI Shapefile" It mostly …
GeorgeC's user avatar
  • 8,298
0 votes
Accepted

ogr2ogr conversion failed when converting the varchar value to data type int

Found an answer on dba se - https://dba.stackexchange.com/questions/231726/fix-ogr2ogr-failed-when-converting-the-varchar-value-to-data-type-int-issue-in/231728#231728 We need to go back to the DB. …
GeorgeC's user avatar
  • 8,298
0 votes
1 answer
391 views

ogr2ogr conversion failed when converting the varchar value to data type int

I keep getting this Error 1 when I run the following on some tables ogr2ogr -skipfailures -f "MapInfo File" -lco overwrite=yes -lco launder=no -lco relaxedFieldNameMatch "D:\QG\CREFNO.tab" "MSSQL:Server … I see that in the DB you can add a convert switch but is it possible to do this in OGR2OGR? …
GeorgeC's user avatar
  • 8,298
3 votes
0 answers
300 views

QGIS 3.18 Reprojections result in wrong projection - EPSG 32754 instead of 7854

Culverts Execution completed in 0.20 seconds Results: {'OUTPUT': 'M:/ManGoesMapping/Working/Road_Data/Culverts.tab'} Loading resulting layers Algorithm 'Merge vector layers' finished Results in If I run ogr2ogr … using for %%f in (*.tab) do ogr2ogr -f "MapInfo File" "%%~dpnf_7854.tab" -t_srs EPSG:7854 "%%f" 1>> process.log 2>> error.log The result is correctly projected as in the screen grab from both QGIS and …
GeorgeC's user avatar
  • 8,298
5 votes
1 answer
1k views

Reprojecting all layers in GeoPackage

In QGIS we can package all the layers using the "Package layers" tool but is there a way to also reproject all the component layers within the tool or using ogr2ogr? … Looking for an ogr2ogr or QGIS solution. …
GeorgeC's user avatar
  • 8,298