Extract latitudes and longitudes from shapefiles

Home Forums Advice & Tutorials Software & Services Extract latitudes and longitudes from shapefiles

This topic contains 5 replies, has 4 voices, and was last updated by  nigel 4 years, 7 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3451

    vww82
    Participant

    Hi,

    how can I extract the lat&lon of every point of every shape in your shapefiles?

    Alternatively, could you send me a textfile containing this information for a specific shape-file?

    I browsed the web but it seems impossible to obtain this data from shp-files.

    Thanks a lot in advance

    Ben

    #4198

    pushframework
    Participant

    It is not impossible. I managed to decode all polygons for the purpose of rendering a map.

    Ask me which shape-file and the output format and i’ll send the result to you.

    #4199

    Nathaniel
    Keymaster

    Use a tool like OGR2OGR:

    http://www.gdal.org/ogr2ogr.html

    #4200

    vww82
    Participant

    Thanks for the help, I managed to do it with Java and OpenMap. Quite a pain, though :-)

    #4699

    nigel
    Participant

    Can anyone help me with the format of the blobs in the SQLite data. For example, if I open up the first record in ne_10m_lakes, the second column ‘geometry’ contains 637 bytes, the first 16 of which are:

    01 03 00 00 00 01 00 00 00 27 00 00 00 08 28 27 41

    after which a pattern of 32 bit ints appears to begin.

    According to Wikipedia(http://en.wikipedia.org/wiki/Shapefile), a shapefile begins with ‘File code (always hex value 0x0000270a)’, so I guess the blob data does not start at the beginning of the shape data, but I can’t figure out the exact format.

     

    #4701

    nigel
    Participant

    Getting somewhere. Not sure what the first byte is. Next 4 bytes=shape type (3=polygon)Next 4 bytes = record number (1) next 4 bytes are record length(0x27=39decimal) and the data starts at 08 28 27 41. Slightly different to the shapefile format, but not by much.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.