Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've got some GEOGRAPHY data in my Sql Server 2008. I wish to export it as a shapefile (so I can import it into QGIS) and when I do, it's rotated 90 degrees to the left.

Command line

C:\>ogr2ogr -f "ESRI Shapefile" "C:\temp\test.shp" "MSSQL:server=MyDatabaseServer; database=xwing;uid=xwing;pwd=ooOOooSecretPassword" -sql "SELECT OriginalBoundary FROM Geography Boundaries where LocationId = 18561" -overwrite -lco "SHPT=POLYGON"

Boundary is Sql Server 2008

enter image description here

Boundary loaded into QGIS after using Ogr2Ogr

enter image description here

/me sad panda.

share|improve this question
1  
Hint: the polygon has not been rotated, it has been reflected by interchanging the coordinates. – whuber Mar 6 '12 at 0:02
@whuber Cheers. Er.. that makes no sense to me because I have no background in GIS and similar tech. I've tried googling for 'what is a reflected polygon' and similar keywords, but I'm coming up blank. Can you provide some more information/links about this concept, please? – Pure.Krome Mar 6 '12 at 0:04
2  
MS SQL Server Spatial used to reverse their geography coordinates as (Y X), then they revised this to (X Y). I wonder if this is a relic of those beta days? What do you get from ogr2ogr --version? – Mike Toews Mar 6 '12 at 0:06
2  
Pure: GIS software (and all software dealing with spherical coordinates) is schizophrenic, because nobody can agree on whether (x,y) is (latitude, longitude) or (longitude, latitude). Mixing up perfectly good coordinates in this way has the effect of reflecting the image. You can confirm this by drawing the coordinate graticule on your second image: I bet it looks like it goes from 41.35 to 41.39 east longitude and 73.56 to 73.59 degrees south latitude. When you see this phenomenon, you know you will have to persuade either the producer or consumer of your data to switch coordinates! – whuber Mar 6 '12 at 0:14
@MikeToews : GDAL 1.8.1, released 2011/07/09 – Pure.Krome Mar 6 '12 at 1:53
show 2 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.