locked
How to Convert Between Projections Using Geography/Geometry Objects RRS feed

  • Question

  • I store WGS84 long/lat, but occasionally need to convert these into OSGB36
    easting/northing. I was hoping that I could save the former in a spatial
    column, and use the new methods to do the conversion, but I have searched
    high and low without finding out how to do it.

    Can anyone suggest how it is done? I am assuming SQL Server can do these
    conversions now. Please tell me it can.

    TIA

    Charles
    Saturday, June 11, 2011 12:15 AM

Answers

  • Sorry, but WGS84 (EPSG:4326) and OSGB36( EPSG:27700) are based on different datums, so you can't do a simple projection operation between them - you need a datum transformation as well. SQL Server does not, and is unlikely to ever, provide this functionality (it's a database, not a GIS, after all).

    However, all is not lost - there are plenty of tools that do provide this functionality. If you're willing to pay for a commercial product, Safe FME is excellent and does conversion/projection between many different spatial formats (as well as a bunch of other stuff). If you want free alternatives, try looking for OGR2OGR (part of the GDAL library), or search through some of the projects on codeplex.


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    • Marked as answer by ckl42 Saturday, June 11, 2011 12:54 PM
    Saturday, June 11, 2011 9:11 AM
    Answerer

All replies

  • Sorry, but WGS84 (EPSG:4326) and OSGB36( EPSG:27700) are based on different datums, so you can't do a simple projection operation between them - you need a datum transformation as well. SQL Server does not, and is unlikely to ever, provide this functionality (it's a database, not a GIS, after all).

    However, all is not lost - there are plenty of tools that do provide this functionality. If you're willing to pay for a commercial product, Safe FME is excellent and does conversion/projection between many different spatial formats (as well as a bunch of other stuff). If you want free alternatives, try looking for OGR2OGR (part of the GDAL library), or search through some of the projects on codeplex.


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    • Marked as answer by ckl42 Saturday, June 11, 2011 12:54 PM
    Saturday, June 11, 2011 9:11 AM
    Answerer
  • Thanks for the reply. I'm currently using a combination of SharpMap and GeoCoordConversion, but the former is unfathomable, and the latter is buggy. If there were half-decent documentation with examples for SharpMap then I would use that exclusively, but it seems to assume that everyone is expert and don't need documentation and tutorials.

    I understand what you say about SQL Server being a database and not a GIS, but it does seem to me that they have only gone part of the way with spatial types, and that a very natural extension is to be able to convert between them. After all, what is the SRID for, if not to distinguish one datum from another?

    I will continue with the way I was doing it, but I would very much like to just use one, reliable library, that could be readily loaded as a CLR assembly.

    Thanks

    Charles

    Saturday, June 11, 2011 12:53 PM