locked
Export geometry AsGml() for use with MapInfo RRS feed

  • Question

  • I would like to save a SQL2008 geometry to a GML file that can be loaded by MapInfo.  Using the following as an example, MapInfo reports "Unable to process this layer's schema".  Does anyone have an example of what needs to be added to the results from AsGml() to make MapInfo happy?  Would the same stuff be needed for use with Arc or others?

    declare @g geometry = geometry::STGeomFromText('POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))', 4326)
    select @g, @g.AsGml()
    
    <Polygon xmlns="http://www.opengis.net/gml">
    <exterior>
    <LinearRing>
    <posList>0 0 0 1 1 1 1 0 0 0</posList>
    </LinearRing>
    </exterior>
    </Polygon>
    

     

    Friday, January 21, 2011 3:52 PM

All replies

  • Hi wimpy1,

     

    Thanks for your post.

    Since this issue is more related to the file format supported by MapInfo, I would like to recommend that you contact the vendor of that software to get more information.


    Regards,
    Tom Li
    Monday, January 24, 2011 3:25 AM
  • Is GML the only format u can import? can u use Well Known Binary / WKB ?
    -Pure Krome-
    Monday, January 24, 2011 4:32 AM
  • To make a long story short, I was hoping for an easy way to allow customers to  download a "shape" via a web page in a way that met these criteria:

    1. Can be loaded in MapInfo without additional translation

    2. Single file (although if needed I could produce a .zip of multiple)

    3. Somewhat readable to the human eye if looking at it via notepad  (this is a bonus item, not a strict requirement)

     

    I had hoped that GML was pretty much an out-of-the-box standard that did not need vendor specific tweaks, but it appears I may be wrong.    Any suggestions would be appreciated.

    Monday, January 24, 2011 7:06 AM
  • Hi wimpy1,

     

    Since I am not familiar with MapInfo and I don’t know the file format supported by that tool, I would like to recommend that you contact the vendor of that software to get more support.

     

    After get the format supported by MapInfo, we could construct a file in that format.

     

    If anything is unclear, please let me know.


    Regards,
    Tom Li
    Monday, January 24, 2011 7:13 AM
  • GML should meet the criteria you describe, other than the fact that SQL Server only really supports a subset of the GML standard. The Microsoft schema can be seen here: http://schemas.microsoft.com/sqlserver/profiles/gml/ but it's pretty restricted compared to the original GML standard defined by the OGC and, in practice, you need to do quite a few transformations if you get supplied with a file in the "full" GML standard before you can load it into SQL Server.

    The only other common human-readable spatial format is Well-Known Text, as produced by SQL Server's STAsText() method. Can you use that instead?


    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    Monday, January 24, 2011 10:55 AM
    Answerer
  • Thanks Tanoshimi.  The "human readable" part is the least important issue for me at this point, so we can take that requirement away for now - although it would score bonus points if it was included :) 

    I saw one of your posts from 2008 about georss and some tinkering needed.

    http://social.msdn.microsoft.com/Forums/en-US/sqlspatial/thread/0918974c-0b8a-4637-937a-995ef3356ba8

    I was hoping not to be the first down this path (SQL2008->gml->MapInfo) but might be just lucky that way...  Perhaps Tom Li is right and this particular question is for MapInfo, but does this mean it will be a different GML output for any other GIS tool as well?  I really hope not.

    Before spending a ton of time digging in to this, can MS comment if AsGml() will be changing with Denali?

     

    Monday, January 24, 2011 4:47 PM
  • AsGML() will not change in Denali.

    Regarding loading data into MapInfo...  The current version of MapInfo Pro supports SQL Server 2008 spatial databases.  If you have your data already in SQL Server (including Denali) it is very easy to set up an ODBC connection between MapInfo Pro and SQL Server.  From there you can download spatial data directly into MapInfo Pro or use the database as the sole source of the spatial data.

    Additionally, Safe Software's Feature Manipulation Engine (FME) provides full support for loading spatial data of all flavors and varieties into MapInfo Pro.

    Thanks,

    - Ed


    Ed Katibah Spatial Ed Blog
    Monday, January 24, 2011 5:47 PM
  • Ed - Thanks for the clarification on SQL2011.

    The SQL server that is holding the spatial stuff is not directly accessible to the clients which rules out any ODBC, so I was hoping to allow the MapInfo users to download the data over the web as gml.

    I am certain FME can translate the data as needed, although the licensing costs for a web based server deployment might be pretty high.

    It feels like the GML produced by AsGml() should work somehow, even if it needs a bit of translation after SQL spits it out and before giving it to MapInfo.  I don't mind doing that step, just do not know what needs to be done.

    I currently don't have access to any of the ESRI products, has anyone tried SQL GML into one of them?  Same issues?

     

     

    Monday, January 24, 2011 6:26 PM
  • Hello,

    the Open-Source library OGR (especially its command line tool OGR2OGR.EXE, see http://www.gdal.org/ogr/) ist able to convert SQLServerSpatial into MapInfo format.

    Regards,

    Klaus

    Wednesday, January 26, 2011 3:50 PM