As an example, say I have a proj4 string defining a spatial reference system:
p4 = '+lon_0=0.0 +lat_ts=60.0 +R=6370997.0 +proj=stere +x_0=-0.0 +units=m 
+y_0=4327039.11059 +lat_0=90.0'

Then one can construct a Basemap from this as:
map = Basemap(projection='stere', lon_0=0., lat_0=90, lat_ts=60,  
        llcrnrlat=50, urcrnrlat=70, llcrnrlon=0, urcrnrlon=20)


I could make a function to construct Basemap arguments from any user specified 
proj4 string (which is out of control of my application). But that function 
would probably be long and contain a lot of projection-specific 
if-then-switches. Copying proj4 arguments directly does not work, e.g. if 
passing "x_0=0" Basemap complains that x_0 is an unexpected argument.
The problem of making a long parser is not that this is tedious, but that it is 
error prone and unstable e.g. with respect to future upgrades of Basemap or 
proj4 libraries.

So as Basemap obviously does have an algorithm to create a proj4 string from 
its input arguments, I was hoping the reverse algorithm would also be available 
somehow. E.g. it would be very useful to be able to initialise a Basemap with:

map = Basemap(proj4=p4, llcrnrlat=50, urcrnrlat=70, llcrnrlon=0, urcrnrlon=20)

Knut-Frode


Date: Wed, 5 Nov 2014 09:32:16 -0800

I think some examples would help. Which proj4 string are you looking to use? 
How are you currently constructing the map?-p
On Wed, Nov 5, 2014 at 7:53 AM, knutfrode <knutfrodesop...@hotmail.com> wrote:
Does anyone know if this is possible?











--

View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Basemap-from-proj4-string-tp43428p44290.html

Sent from the matplotlib - users mailing list archive at Nabble.com.



------------------------------------------------------------------------------

_______________________________________________

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users



                                          
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to