File: FAQ

package info (click to toggle)
basemap 1.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 212,272 kB
  • sloc: python: 9,541; ansic: 266; makefile: 39; sh: 23
file content (33 lines) | stat: -rw-r--r-- 1,891 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Q: It takes a long time to make a plot with the 'intermediate' or 'high' 
resolution coastlines, how can I speed it up?

A: There is a overhead in processing boundary datasets when a Basemap 
class in created, and this overhead can be significant for the higher 
resolution boundaries.  If you are makeing many maps for the same region, 
you only need to create you Basemap class instance once, then re-use it 
for each plot.  If the plots are being created by different scripts, you 
can save the Basemap class instance to a Pickle on disk, then read it in 
whatever script needs it (it's much faster to read a pickle from disk than 
it is to create the Basemap instance originally). The ireland.py example 
illustrates how to do this.

Q: I have my own boundary dataset that I would like to use, how do I use 
it in place of (or in addition to) the built-in basemap boundary datasets?

A: If your dataset is in ESRI shapefile format, this is relatively easy. 
Just create your Basemap class instance, then call the 'readshapefile' 
method on that instance to import your data.  Setting 'drawbounds=True' 
will draw the boundaries in the shapefile.  The fillstates.py example 
shows how to do this.

Q: How do I specify the map projection region if I don't know what the 
latitude and longitudes of the corners are?

A: As an alternative to specifying the lat/lon values for the upper-right 
and lower-left corners of the projection domain (using the llcrnrlat, 
llcrnrlon, urcrnrlat and urcrnrlon keywords) you can specify the center of 
the map projection domain (using the lat_0 and lon_0 keywords) and the 
width and height of the domain in map projection coordinates (meters) 
using the width and height keywords.  Basemap will then calculate the 
corresponging values of llcrnrlat, llcrnrlon, urcrnrlat and urcrnrlon. 
Examples of this are given in the garp.py and setwh.py examples.