Re: create an UTM grid [message #78414 is a reply to message #78413] |
Mon, 28 November 2011 10:12   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
nata writes:
> I am trying to create an UTM grid. I never did something similar and I
> got the idea from the last IDL webinar...
> What I want is a grid centered in a center point and I would like to
> have the lat/lon values associated to every pixel. Lets say that I
> want a grid of 500x500 km centered on -74lon 45lat, is there a way to
> create that grid ?
>
> What I tried until now is something like :
>
> map_utm = MAP_PROJ_INIT('UTM', CENTER_LONGITUDE=-74
> CENTER_LATITUDE=45, ELLIPSOID=24)
> llrange = MAP_PROJ_INVERSE([-500000.,500000], [-500000.,500000.],
> MAP_STRUCTURE=map_utm)
>
> Maybe it's not that simple so that's why I call your wisdom to help me
> with this. Thank you in advance,
This is almost right. When you set up a UTM projection,
the CENTER_LONGITUDE and CENTER_LATITUDE keywords are
actually used to choose the correct UTM zone, not really
to center the map projection in that zone. To center the
grid, you will have to project your center latitude and
longitude into XY coordinates, then create your grid:
mapStruct = Map_Proj_Init('UTM', /GCTP, $
Center_Lon=-74, Center_Lat=45, Ellipsoid=24)
xycenter = Map_Proj_Forward(-74, 45, Map_Structure=mapStruct)
xrange = [xycenter[0]-250000, xycenter[0]+250000]
yrange = [xycenter[1]-250000, xycenter[1]+250000]
ll = Map_Proj_Inverse(xrange, yrange, Map_Structure=mapStruct)
Print, 'Longitude Range: ', ll[0,0], ll[0,1]
Print, 'Latitude Range: ', ll[1,0], ll[1,1]
The actual grid will be determined by how many "cells"
you want to have in your data range. In other words,
how big do you want each cell of your grid to be? Or,
what is the resolution of your grid? If you
want each cell to be, say 5000 meters on a side, then
your grid would be a 100x100 array.
IDL> Print, (xrange[1] - xrange[0]) / 100
5000.000
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|