locked
Problem with imported data from http://www.diva-gis.org/gdata RRS feed

  • Question

  • Hello,

     

    Ive imported into my sql server database states of poland from: http://www.diva-gis.org/gdata

    Map in spatial results tab looks very nice everything seems to be ok but when I try to get SELength of given state it has for example 0.9. As far as I know data in this format is represented in meters. I used Shape2SQL free tool with SRID set to 4326.

     

    Here is direct link for test data: http://biogeo.ucdavis.edu/data/diva/adm/POL_adm.zip

     

    Function STTouches works well, I only have problems with STDistance (also very small values) and STLength

     

    What am I doing wrong ? Thank You for any tips on that

    Monday, January 16, 2012 12:32 AM

Answers

All replies

  • It seems that you have imported geometries, not geographies

    Try importing again checking "Geographic (Spheric)" option in Shape2SQL, or convert your column

    • Marked as answer by snorlaks Monday, January 16, 2012 8:17 AM
    Monday, January 16, 2012 7:23 AM
  • Thank You,

     

    Now everything works as a charm. For the future how can I know if I should set data to geographic or geometric data type while importing data ?

     

    Thanks again !

    Monday, January 16, 2012 8:32 AM
  • Geography is only for geographic coordinate systems (usually 4xxx SRID). 

    To use geography, check if SRID exists in the table sys.spatial_reference_systems

     

     

    Monday, January 16, 2012 1:54 PM
  • I can use geography, I was asking how can I know while importing data wheter to use geography or geometry ?
    Monday, January 16, 2012 1:55 PM
  • If you use geometry, sql server treats the coordinates with no spatial reference, so methods as surface, distance etc will return "plain" units, not meters.

    So if you can,you should use geography



    • Edited by vIndEx Monday, January 16, 2012 1:59 PM
    Monday, January 16, 2012 1:58 PM
  • I can use geography, I was asking how can I know while importing data wheter to use geography or geometry ?

    If you're importing from a shapefile, it should come with an associated .prj file. This file gives details of the projection in which the coordinates of that shapefile are defined.

    Load the .prj file up in a text editor (Windows notepad will do fine - they're only tiny files).

    • If it begins with the word GEOGCS then you're looking at a geographic coordinate system and you should use the geography datatype.
    • If it begins with the word PROJCS then you're looking at a projected coordinate system and you should use the geometry datatype.

    In either case, you'll also need to make sure you set the correct SRID that corresponds to the system in question, which you can look up at somewhere like www.spatialreference.org


    twitter: @alastaira blog: http://alastaira.wordpress.com/
    Monday, January 16, 2012 4:36 PM
    Answerer