1

I'm generating my own images in Python and Blender. What I need is data that I can read directly from a table/file to draw coastlines with 1 to 10 kilometer resolution. I'm not familiar with high level Geographic or Cartographic software, I just need dots to connect (lat/lon or xyz) or something similar.

While the package Basemap exists for python, I'd like to avoid installing it in each of my python versions. I just need the points.

4

Here is one idea:

  1. Download coastline GIS data from Natural Earth site or some other website
  2. Install QGIS
  3. Load in the downloaded GIS layer into QGIS, and use the Vector>Geometry Tools>Extract Nodes tool to create a point layer from polygon vertices
  4. Open up point table, start an edit session, create an x and y decimal columns, field calculate $x (for x column) and $y (for y column) to generate vertices coordinates, and save edits
  5. Finally, save the layer as a new table (DBF or some other format)

This should give you a table of point coordinates.

  • Thank you, but it looks like this (QGIS + GDAL) is also a substantial installation scenario as would be Basemap. I'm looking for something "non-installational". The data at the Natural Earth site look like just what I need though. Maybe I can find a simple python script to convert the shape data once. – uhoh Oct 1 '15 at 12:03
  • The desktop software is just one option to generate the coordinates. You may also be able to just pull the coordinates from the shp as you mentioned using python module like shapely. Check out this Q/A gis.stackexchange.com/questions/23575/… – artwork21 Oct 1 '15 at 12:14
  • Aha! I found pyshp which points to shapefile.py and wow the Physical data at the Natural Earth site you recommended is immediately making coastlines! Super thank you @artwork21 – uhoh Oct 1 '15 at 12:34
0

The answer by @artwork21 is the accepted answer. I am just adding some supplementary information that others may find useful.

I downloaded some coastline data from the link provided in the answer. In this example, I used physical vector data from here. Then reading about pyshp I just copy/pasted the script shapefile.py and then did the following:

coast = Reader("ne_50m_coastline")     # defined in shapefile.py

plt.figure()

for shape in coast.shapes()[:20]:   # first 20 shapes out of 1428 total

    x, y = zip(*shape.points)

    plt.plot(x, y)

plt.xlim(110, 180)
plt.ylim(-40, 20)

plt.savefig("Australia Australia Australia Australia we love ya' Amen") 
# https://www.youtube.com/watch?v=_f_p0CgPeyA&feature=youtu.be&t=121

plt.show()

Australia!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.