Spatial Data Types

  • Jan Van der Eecken

    SSCrazy Eights

    Points: 8890

    tilew-948340 (10/26/2011)


    Jan Van der Eecken (10/26/2011)


    Unhm, what am I missing here? According to MSDN, "A LineString is a one-dimensional object representing a sequence of points and the line segments connecting them.", so it is actually an instance of the geometry data type, and not the geography type as answer 4 suggests?

    Because there were only one wrong, I stopped reading at the "geometry" column, but I agree with you that I would "logically" would say that a line is geometry, not geographic...but, you can fly a line between two city, so I may have, maybe, not sure... but now I am certainly wondering, so I checked this and found that link to http://technet.microsoft.com/en-us/library/bb964711.aspx

    It says "As the figure indicates, the seven instantiable types of the geometry and geography data types are Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, and GeometryCollectio"...

    Well, I read the first two and knew those were correct, then saw the third one and wasn't 100 percent sure, so skipped to number 4 and saw after a very cursory look on MSDN that it was wrong (llok at the code samples I supplied the link for where they instantiate those two types, they clearly refer to the geometry type, not the geography one), so I had my three wrong answers. So I was very surprised to be told I was wrong.

    --------------------------------------------------------------------------
    A little knowledge is a dangerous thing (Alexander Pope)
    In order for us to help you as efficiently as possible, please read this before posting (courtesy of Jeff Moden)[/url]

  • Jan Van der Eecken

    SSCrazy Eights

    Points: 8890

    WILLIAM MITCHELL (10/26/2011)


    #1 says "UDT" but the reference says "implemented as a .NET common language runtime (CLR) data type in SQL Server." what am I missing?

    UDT stands for User Defined Type, so they are implemented as .NET CLR types, unless you also count those UDTs that weren't really UDTs in earlier versions of SQL. Those were really just synonyms for existing SQL data types.

    --------------------------------------------------------------------------
    A little knowledge is a dangerous thing (Alexander Pope)
    In order for us to help you as efficiently as possible, please read this before posting (courtesy of Jeff Moden)[/url]

  • Mike Is Here

    Hall of Fame

    Points: 3348

    I wasn't sure about 3, but I chose it because #4 is wrong

    from MSN

    LineString can only be

    "Accepted LineString instances can be input into a geometry variable"

    http://msdn.microsoft.com/en-us/library/bb895372.aspx

    While Polygon

    "Accepted Polygon instances are instances that can be stored in a geometry or geography variable without throwing an exception."

    http://msdn.microsoft.com/en-us/library/bb895267.aspx

    Making option 4 invalid and if the question had 3 right answers then by elimination 1,2,3 but as someone mention if 3 is true then 1 AND 2 can not, so the command to pick three option is what is incorrect.

  • Revenant

    SSC-Forever

    Points: 42467

    I like questions that force me to "take a road less traveled." -- thanks!

  • SQLRNNR

    SSC Guru

    Points: 281210

    Thanks for the question.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Ken Wymore

    SSCoach

    Points: 16385

    Thanks for the question. I would like to see more questions related to these data types.

    I think I would have given 5 answer choices with only 3 correct though just to make it a little more challenging. Process of elimination allowed me to work from the top down and not even really pay attention to choice 4. I knew 3 was wrong so I didn't really have to think about it.

  • WILLIAM MITCHELL

    SSChampion

    Points: 13651

    Jan Van der Eecken (10/26/2011)


    WILLIAM MITCHELL (10/26/2011)


    #1 says "UDT" but the reference says "implemented as a .NET common language runtime (CLR) data type in SQL Server." what am I missing?

    UDT stands for User Defined Type, so they are implemented as .NET CLR types, unless you also count those UDTs that weren't really UDTs in earlier versions of SQL. Those were really just synonyms for existing SQL data types.

    Yes, UDT means user defined. But the two types are not user defined, so #1 is wrong, isn't it??

  • Jan Van der Eecken

    SSCrazy Eights

    Points: 8890

    WILLIAM MITCHELL (10/26/2011)


    Jan Van der Eecken (10/26/2011)


    WILLIAM MITCHELL (10/26/2011)


    #1 says "UDT" but the reference says "implemented as a .NET common language runtime (CLR) data type in SQL Server." what am I missing?

    UDT stands for User Defined Type, so they are implemented as .NET CLR types, unless you also count those UDTs that weren't really UDTs in earlier versions of SQL. Those were really just synonyms for existing SQL data types.

    Yes, UDT means user defined. But the two types are not user defined, so #1 is wrong, isn't it??

    OK, I see where you got confused. Or was that me? Apologies.

    --------------------------------------------------------------------------
    A little knowledge is a dangerous thing (Alexander Pope)
    In order for us to help you as efficiently as possible, please read this before posting (courtesy of Jeff Moden)[/url]

  • Britt Cluff

    SSCertifiable

    Points: 5083

    Nice question on some new data types, thanks.

    http://brittcluff.blogspot.com/

  • Koen Verbeeck

    SSC Guru

    Points: 258938

    Nice question, but answer number 4 was also incorrect, as both are of the geometry datatype.

    A polygon can also be a geography datatype, but according to MSDN, Linestring is geometry.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • michael.kaufmann

    SSCrazy

    Points: 2816

    Koen Verbeeck (10/27/2011)


    Nice question, but answer number 4 was also incorrect, as both are of the geometry datatype.

    A polygon can also be a geography datatype, but according to MSDN, Linestring is geometry.

    Then MSDN is again inconsistent in itself, based on the article on Getting Started with the geography Data Type, where it states:

    [...]Two rows are then inserted: one row contains a LineString instance of geography, and one row contains a Polygon instance.

    Thanks for an interesting question.

    Regards,

    Michael

  • TomThomson

    SSC Guru

    Points: 104772

    Koen Verbeeck (10/27/2011)


    Nice question, but answer number 4 was also incorrect, as both are of the geometry datatype.

    A polygon can also be a geography datatype, but according to MSDN, Linestring is geometry.

    If something in MSDN says a geometry value can't be a LineString the (a) MSDN is self contradictory and (b) the bit that says that is just plain wrong. I haven't been able to find such a bit, maybe you are misreading something? The BoL page Types of Spatial Data is pretty clear that a LineString can be a geometry, since it points out the distinction between the two types in how the connecting edges of a LineString are defined.

    Try the following code (it works; it wouldn't if geography didn't include linestrings):-

    DECLARE @g geography;

    SET @g = geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326);

    SELECT @g, @g.STAsText();

    Also see Constructing Geography Instances.

    Tom

  • Hardik Turakhia

    SSC Eights!

    Points: 898

    CoolCodeShare (10/25/2011)


    Comments posted to this topic are about the item <A HREF="/questions/Spatial+Data/76091/">Spatial Data Types</A>

    http://msdn.microsoft.com/en-us/library/bb964711%28v=SQL.100%29.aspx

    This link states that LineString and Polygon are geometry data types.

    Then in answer it stated as geography data type.

    please clear this

  • michael.kaufmann

    SSCrazy

    Points: 2816

    Hardik Turakhia (10/28/2011)


    CoolCodeShare (10/25/2011)


    Comments posted to this topic are about the item <A HREF="/questions/Spatial+Data/76091/">Spatial Data Types</A>

    http://msdn.microsoft.com/en-us/library/bb964711%28v=SQL.100%29.aspx

    This link states that LineString and Polygon are geometry data types.

    Then in answer it stated as geography data type.

    please clear this

    It appears that while the general description in MSDN on Spatial Data Types mentions geometry and geography data types side by side, any links for the individual instances lead to examples for geometry data only.

    If you check out the pages for e.g. STAsText of the OGC Methods on Geography Instances, the listed examples have the same instances (e.g. LineString) as geography data types.

  • CoolCodeShare

    SSCrazy

    Points: 2584

    michael.kaufmann (10/28/2011)


    Hardik Turakhia (10/28/2011)


    CoolCodeShare (10/25/2011)


    Comments posted to this topic are about the item <A HREF="/questions/Spatial+Data/76091/">Spatial Data Types</A>

    http://msdn.microsoft.com/en-us/library/bb964711%28v=SQL.100%29.aspx

    This link states that LineString and Polygon are geometry data types.

    Then in answer it stated as geography data type.

    please clear this

    It appears that while the general description in MSDN on Spatial Data Types mentions geometry and geography data types side by side, any links for the individual instances lead to examples for geometry data only.

    If you check out the pages for e.g. STAsText of the OGC Methods on Geography Instances, the listed examples have the same instances (e.g. LineString) as geography data types.

    I am sorry I was on Deewali vacation, much awaited 1 to visit my native place.

    Yes, I can understand the confusion at #4. But the statement is not wrong.

    LineString and Polygon can be both Geometry and Geography type. Try this for example:

    DECLARE @g1 geography = 'LINESTRING(1 1,2 3,4 8, -6 3)';

    .

    Also read from here: http://msdn.microsoft.com/en-us/library/bb895266.aspx

    Hope this helps,

    Sudhir

Viewing 15 posts - 16 through 30 (of 31 total)

You must be logged in to reply to this topic. Login to reply