I have a table in SQL Server with an STSrid
of 0
. I would like to convert this table to GeoJSON using ogr2ogr
. The problem is, despite converting to EPSG:4326
, the resulting coordinates are not valid (verified using GeoJSONLint). The GeoJSON file's crs
key lists the coordinate reference system as the desired CRS84
, but the feature coordinates are far too large.
A sample feature appears as such:
{ "type": "Feature", "properties": { "TR": "00028" }, "geometry": { "type": "Point", "coordinates": [ 447366.18450000137, -920054.45910000056 ] } }
The output coordinates as seen above are identical to the input:
select TR, Shape.STX, Shape.STY from [table] where TR = '00028'
results in:
00028 447366.184500001 -920054.459100001
I'm entering the following ogr2ogr
command:
ogr2ogr -f "GeoJSON" "sqlexport.json" "MSSQL:server=[server];database=[db];trusted_connection=yes;" -sql "select TR, Shape from [table]" -a_srs "EPSG:4326"
Edit:
Despite SQL Server listing the STSrid
as 0
, ArcGIS reads it as GCS_North_American_1983
:
Custom
Projection: Two_Point_Equidistant
False_Easting: 0.0
False_Northing: 0.0
Latitude_Of_1st_Point: 49.0
Latitude_Of_2nd_Point: 49.0
Longitude_Of_1st_Point: -110.0
Longitude_Of_2nd_Point: -77.0
Linear Unit: Meter (1.0)
Geographic Coordinate System: GCS_North_American_1983
Angular Unit: Degree (0.0174532925199433)
Prime Meridian: Greenwich (0.0)
Datum: D_North_American_1983
Spheroid: GRS_1980
Semimajor Axis: 6378137.0
Semiminor Axis: 6356752.314140356
Inverse Flattening: 298.257222101
Despite this, if I change the ogr2ogr
command to the following:
ogr2ogr -f "GeoJSON" "sqlexport.json" "MSSQL:server=[server];database=[db];trusted_connection=yes;" -sql "select TR, Shape from [table]" -s_srs "EPSG:4140" -t_srs "EPSG:4326"
The coordinates still remain unchanged.