Charles Seaton wrote: > I would like to use a higher resolution coastline than the high resolution > coastline optionally provided with (specifically, I would like to use the > NOAA/NOS Medium Resolution Coastline). I can see two ways to do this: > > Option 1) Create a coastline file using the in the NOAA/NOS data in the same > format as the data files used by the basemap toolkit. I couldn't find a > description of this format, but it appears that it is partially explained by > the code snippet: > > if line.startswith('P'): > area = float(linesplit[5]) > west,east,south,north = > float(linesplit[6]),float(linesplit[7]),float(linesplit[8]),float(linesplit[9]) > typ = int(linesplit[3]) > > So the first line of the existing high resolution coastline is: > P 0 169598 1 W 79866900.000 -17.53378 190.35911 -34.83044 77.71958 > > Which should be interpreted as > typ = 1 > area = 79866900.000 > west = -17.53378 > east = 190.35911 > south = -34.83044 > north = 77.71958 > > area is used to control whether this segment of coastline is displayed > the directions are the bounding box for the coastline segment > I am not clear on how typ is used (I see it getting manipulated, but I don't > see it ever getting used), or what its acceptable values are. I am also not > clear what the first, second and fourth values of the line are (not counting > the initial 'P'). Any help with this format would be appreciated. > > Option 2) Load a coastline by whatever means I choose as a list of lists of > touples (or some other format?) and then transform those values using the > basemap object. If the coastline were easily expressed as a pair of lists or > arrays lon,lat, then I could simply use > > b=basemap(...) > coastx,coasty = b(lcoastlon,coastlat) > > but the coastline is made up of multiple segments (islands, etc). Is the > best way to transform a collection of segments simply to loop over the > segments? > > coast = [ [(x11,y11),... (x1n,y1n)], [(x21,y21),... (x2n,y2n)],... > [(xn1,yn1),...(xnn,ynn)] ] > newcoast = [] > for c in coast: > ln,lt = map(list,zip(*c)) > x,y = m(ln,lt) > newcoast.append(zip(x,y)) > > Once I have a transformed list of lists of touples, I can replace the > basemap objects coastsegs > b.coastsegs = newcoast > > and then draw the coastline using the built-in > b.drawcoastlines() > > Or is there some method that I am missing? > > > Charles: If you can get the coastlines in a shapefile, that's probably the easiest way to do it. See the fillstates.py example for reading in and plotting shapefiles on maps.
-Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users