raster in basemap

Hi all,
I'm sure it's a trivial question, but can't find any valid answer in the
basemap examples directory or with google : I have a georeferenced TIFF file
in 'lcc' projection, representing a little portion of France, and I need to
put it on a map, resets map limits to a closed portion of the map, and put
contours on it. I see how to initialise Basemap with the limits of the
raster, but not how to "make a zoom" in the map by specifing coordinates.
Thanks for your help

···

--
Lionel Roubeyrie - lroubeyrie@...1068...
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr

Lionel Roubeyrie wrote:

Hi all,
I'm sure it's a trivial question, but can't find any valid answer in the basemap examples directory or with google : I have a georeferenced TIFF file in 'lcc' projection, representing a little portion of France, and I need to put it on a map, resets map limits to a closed portion of the map, and put contours on it. I see how to initialise Basemap with the limits of the raster, but not how to "make a zoom" in the map by specifing coordinates.
Thanks for your help
  

Lionel: You can use the set_xlim and set_ylim axes methods to manually 'zoom' the plot. It has to be done after all the other plotting though, since all the Basemap methods (contour, imshow etc) will reset the axes limits to show the entire map region.

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

Hi Jeff,
yes I see this method, but set_xlim and set_ylim use axes coordinates, and I
would like to use geographic coordinates.
It would be great if we could put an image in a map directly by specifying its
geographic coordinates

···

Le mardi 26 février 2008, Jeff Whitaker a écrit :

Lionel Roubeyrie wrote:
> Hi all,
> I'm sure it's a trivial question, but can't find any valid answer in the
> basemap examples directory or with google : I have a georeferenced TIFF
> file in 'lcc' projection, representing a little portion of France, and I
> need to put it on a map, resets map limits to a closed portion of the
> map, and put contours on it. I see how to initialise Basemap with the
> limits of the raster, but not how to "make a zoom" in the map by
> specifing coordinates. Thanks for your help

Lionel: You can use the set_xlim and set_ylim axes methods to manually
'zoom' the plot. It has to be done after all the other plotting though,
since all the Basemap methods (contour, imshow etc) will reset the axes
limits to show the entire map region.

-Jeff

--
Lionel Roubeyrie - lroubeyrie@...1068...
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr

Lionel Roubeyrie wrote:

Hi Jeff,
yes I see this method, but set_xlim and set_ylim use axes coordinates, and I would like to use geographic coordinates.
It would be great if we could put an image in a map directly by specifying its geographic coordinates
  
Lionel: There's no way to do that - but it's pretty easy to convert to geographic to map (axes) coordinates using the Basemap instance __call__ method. So, if m is the Basemap instance, you can do something like

x1,y1 = m(lon1,lon1)
x2,y2 = m(lon2,lat2)
ax.set_ylim(y1,y2)
ax.set_xlim(x1,x2)

-Jeff

···

Le mardi 26 f�vrier 2008, Jeff Whitaker a �crit :
  

Lionel Roubeyrie wrote:
    

Hi all,
I'm sure it's a trivial question, but can't find any valid answer in the
basemap examples directory or with google : I have a georeferenced TIFF
file in 'lcc' projection, representing a little portion of France, and I
need to put it on a map, resets map limits to a closed portion of the
map, and put contours on it. I see how to initialise Basemap with the
limits of the raster, but not how to "make a zoom" in the map by
specifing coordinates. Thanks for your help
      

Lionel: You can use the set_xlim and set_ylim axes methods to manually
'zoom' the plot. It has to be done after all the other plotting though,
since all the Basemap methods (contour, imshow etc) will reset the axes
limits to show the entire map region.

-Jeff
    
--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328

Jeff,
yes it works, the unique constraint is to put the image when we create the
basemap instance.

···

Le jeudi 28 février 2008, Jeff Whitaker a écrit :

Lionel Roubeyrie wrote:
> Hi Jeff,
> yes I see this method, but set_xlim and set_ylim use axes coordinates,
> and I would like to use geographic coordinates.
> It would be great if we could put an image in a map directly by
> specifying its geographic coordinates

Lionel: There's no way to do that - but it's pretty easy to convert to
geographic to map (axes) coordinates using the Basemap instance __call__
method. So, if m is the Basemap instance, you can do something like

x1,y1 = m(lon1,lon1)
x2,y2 = m(lon2,lat2)
ax.set_ylim(y1,y2)
ax.set_xlim(x1,x2)

-Jeff

> Le mardi 26 février 2008, Jeff Whitaker a écrit :
>> Lionel Roubeyrie wrote:
>>> Hi all,
>>> I'm sure it's a trivial question, but can't find any valid answer in
>>> the basemap examples directory or with google : I have a georeferenced
>>> TIFF file in 'lcc' projection, representing a little portion of France,
>>> and I need to put it on a map, resets map limits to a closed portion of
>>> the map, and put contours on it. I see how to initialise Basemap with
>>> the limits of the raster, but not how to "make a zoom" in the map by
>>> specifing coordinates. Thanks for your help
>>
>> Lionel: You can use the set_xlim and set_ylim axes methods to manually
>> 'zoom' the plot. It has to be done after all the other plotting though,
>> since all the Basemap methods (contour, imshow etc) will reset the axes
>> limits to show the entire map region.
>>
>> -Jeff

--
Lionel Roubeyrie - lroubeyrie@...1068...
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr