locked
ESRI featureclass to sql spatial geography data type RRS feed

  • Question

  • I have an ESRI SDE PolylineM featureclass which has measure values associated with it.

    I converted it to a sql spatial table of geography type. now when i do Shape.M where shape is the spatial column, it shows null for the measure values? 

    I have addresses which is a sql spatial tabel of  adress points, also geography type. I want to find the measure of the address on the PolylineM sql table. How is it possible to do that?

    Thanks!

    Friday, June 22, 2012 4:33 AM

Answers

  • M measure values are associated with each point in an instance, rather than having a single M value associated with the instance itself. So, if you have a column of LineStrings with M values, this will return NULL:

    SELECT LineStringCol.M;

    Instead, you need to retrieve the M value of whichever point in the LineString you want:

    SELECT LineStringCol.STPointN(1).M;

    If your column contains only Point instances, however, it's fine to call M directly:

    SELECT PointCol.M;
    (Note if you're using SQL Server 2012, you can test whether an instance has M values using HasM() - http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.types.sqlgeography.hasm.aspx)


    twitter: @alastaira blog: http://alastaira.wordpress.com/

    • Proposed as answer by amber zhang Monday, June 25, 2012 4:52 AM
    • Marked as answer by amber zhang Thursday, June 28, 2012 8:16 AM
    Friday, June 22, 2012 6:30 AM
    Answerer