comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » google earth projections
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
google earth projections [message #63180] Sat, 01 November 2008 13:20 Go to next message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
Does anyone know the IDL map projection to use to make a
ground overlay in a kml file (to be viewed by a geobrowser such
as google earth?)

I've googled and have seen many different things stated,
so I am not sure if my use of cylindrical projection is right.

My figures are off, in that my continents do not match earth's continents
I am initiallty making a full globe image (-90 to 90 lat , -180 to 180 lon)
similar to the big blue marble example.

http://www.gearthblog.com/blog/archives/2006/11/blue_marble_ time_ani.html

but my image of the global map, does not reproduce the continents like
in those images.
http://mw1.google.com/mw-earth-vectordb/kml-samples/bmng12/f iles/BMNG-Jan.jpg



cheers,
bob
Re: google earth projections [message #63293 is a reply to message #63180] Tue, 04 November 2008 07:42 Go to previous messageGo to next message
liamgumley is currently offline  liamgumley
Messages: 74
Registered: June 2005
Member
On Nov 3, 6:42 pm, "R.G. Stockwell" <notha...@noemail.com> wrote:
> <liamgum...@gmail.com> wrote in message
>
> news:2f8cf74c-b86f-4ece-bb13-694bf3badde3@n1g2000prb.googleg roups.com...
> On Nov 1, 2:20 pm, "R.G. Stockwell" <notha...@noemail.com> wrote:
>
>
>
>> Does anyone know the IDL map projection to use to make a
>> ground overlay in a kml file (to be viewed by a geobrowser such
>> as google earth?)
>
>> I've googled and have seen many different things stated,
>> so I am not sure if my use of cylindrical projection is right.
>
>> My figures are off, in that my continents do not match earth's continents
>> I am initiallty making a full globe image (-90 to 90 lat , -180 to 180
>> lon)
>> similar to the big blue marble example.
>
>> http://www.gearthblog.com/blog/archives/2006/11/blue_marble_ time_ani....
>
>> but my image of the global map, does not reproduce the continents like
>> in those
>> images.http://mw1.google.com/mw-earth-vectordb/kml-samples/b mng12/files/BMNG...
>
>> cheers,
>> bob
>> This is the projection used by Google Earth overlays:
>> http://en.wikipedia.org/wiki/Plate_carre_projection
>
> Thanks Liam,
> one problem is in converting from the uv coords in the plot window,
> (which range from -2*10^7 to 2*10^7, and -1*10^7 to 1*10^7).
> to my data coordinates that my data is in (drawing polygons in lat and lon).
> Where do i get the info for that coordinate transformation?
>
> I can overlay the continents nicely, and grid and label it, perhaps I just
> have to dig into those routines to see how they do it.
>
> Cheers,
> bob

Bob,

MAP_PROJ_FORWARD converts from lon,lat to x,y
MAP_PROJ_INVERSE converst from x,y to lon,lat

Both of these routines require a map structure variable from
MAP_PROJ_INIT.

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
Re: google earth projections [message #63299 is a reply to message #63180] Mon, 03 November 2008 16:42 Go to previous messageGo to next message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
<liamgumley@gmail.com> wrote in message
news:2f8cf74c-b86f-4ece-bb13-694bf3badde3@n1g2000prb.googleg roups.com...
On Nov 1, 2:20 pm, "R.G. Stockwell" <notha...@noemail.com> wrote:
> Does anyone know the IDL map projection to use to make a
> ground overlay in a kml file (to be viewed by a geobrowser such
> as google earth?)
>
> I've googled and have seen many different things stated,
> so I am not sure if my use of cylindrical projection is right.
>
> My figures are off, in that my continents do not match earth's continents
> I am initiallty making a full globe image (-90 to 90 lat , -180 to 180
> lon)
> similar to the big blue marble example.
>
> http://www.gearthblog.com/blog/archives/2006/11/blue_marble_ time_ani....
>
> but my image of the global map, does not reproduce the continents like
> in those
> images.http://mw1.google.com/mw-earth-vectordb/kml-samples/b mng12/files/BMNG...
>
> cheers,
> bob

> This is the projection used by Google Earth overlays:

> http://en.wikipedia.org/wiki/Plate_carre_projection


Thanks Liam,
one problem is in converting from the uv coords in the plot window,
(which range from -2*10^7 to 2*10^7, and -1*10^7 to 1*10^7).
to my data coordinates that my data is in (drawing polygons in lat and lon).
Where do i get the info for that coordinate transformation?


I can overlay the continents nicely, and grid and label it, perhaps I just
have to dig into those routines to see how they do it.

Cheers,
bob
Re: google earth projections [message #63316 is a reply to message #63180] Mon, 03 November 2008 08:56 Go to previous messageGo to next message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
<liamgumley@gmail.com> wrote in message
news:2f8cf74c-b86f-4ece-bb13-694bf3badde3@n1g2000prb.googleg roups.com...
On Nov 1, 2:20 pm, "R.G. Stockwell" <notha...@noemail.com> wrote:
..

This is the projection used by Google Earth overlays:

http://en.wikipedia.org/wiki/Plate_carre_projection

Looks like the GCTP Equirectangular projection (#117) supported by
MAP_PROJ_INIT is the one you need.


Thanks, Liam.
Re: google earth projections [message #63319 is a reply to message #63180] Mon, 03 November 2008 08:34 Go to previous messageGo to next message
liamgumley is currently offline  liamgumley
Messages: 74
Registered: June 2005
Member
On Nov 1, 2:20 pm, "R.G. Stockwell" <notha...@noemail.com> wrote:
> Does anyone know the IDL map projection to use to make a
> ground overlay in a kml file (to be viewed by a geobrowser such
> as google earth?)
>
> I've googled and have seen many different things stated,
> so I am not  sure if my use of  cylindrical  projection is right.
>
> My figures are off, in that my continents do not match earth's continents
> I am initiallty making a full globe image (-90 to 90 lat , -180 to 180 lon)
> similar to the big blue marble example.
>
> http://www.gearthblog.com/blog/archives/2006/11/blue_marble_ time_ani....
>
> but my image of the global map, does not reproduce the continents like
> in those images.http://mw1.google.com/mw-earth-vectordb/kml-samples/b mng12/files/BMNG...
>
> cheers,
> bob

This is the projection used by Google Earth overlays:

http://en.wikipedia.org/wiki/Plate_carre_projection

Looks like the GCTP Equirectangular projection (#117) supported by
MAP_PROJ_INIT is the one you need.

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
Re: google earth projections [message #63355 is a reply to message #63180] Tue, 04 November 2008 14:24 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
R.G. Stockwell writes:

> link?
>
> I likely will need very accurrate maps to incorporate data into
> a geobrowser.

Around here, this is considered state-of-the-art:

http://trac.osgeo.org/proj/

Cheers,

David

--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: google earth projections [message #63356 is a reply to message #63180] Tue, 04 November 2008 14:10 Go to previous messageGo to next message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
"David Fanning" <news@dfanning.com> wrote in message
news:MPG.237a66fedbf0eff1989753@news.giganews.com...
> R.G. Stockwell writes:
>
>> I've been doing map projections and overlaying data for years,
>> but have never had to venture out of the use of map_set, til now.
>
> I hate to tell you this, but... Oh, never mind. Nobody
> reads the papers we write anyway. :-)

link?

I likely will need very accurrate maps to incorporate data into
a geobrowser.

Cheers,
bob
Re: google earth projections [message #63367 is a reply to message #63180] Tue, 04 November 2008 13:05 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
R.G. Stockwell writes:

> I've been doing map projections and overlaying data for years,
> but have never had to venture out of the use of map_set, til now.

I hate to tell you this, but... Oh, never mind. Nobody
reads the papers we write anyway. :-)

Cheers,

David

P.S. Let's just say, I've been spending a lot of time
with proj4 lately. If ITTVIS was sitting around thinking
about what they could do that would be useful to customers,
I would recommend incorporating this software into IDL.
Then we could be pretty sure that IDL maps were at least
as good as ENVI's, if not better. ;-)

--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: google earth projections [message #63368 is a reply to message #63293] Tue, 04 November 2008 08:09 Go to previous messageGo to next message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
<liamgumley@gmail.com> wrote in message
news:289e776d-2109-496e-a3b2-541e0d71a1c0@v39g2000pro.google groups.com...
On Nov 3, 6:42 pm, "R.G. Stockwell" <notha...@noemail.com> wrote:
> <liamgum...@gmail.com> wrote in message
>
> news:2f8cf74c-b86f-4ece-bb13-694bf3badde3@n1g2000prb.googleg roups.com...
> On Nov 1, 2:20 pm, "R.G. Stockwell" <notha...@noemail.com> wrote:

> Bob,

> MAP_PROJ_FORWARD converts from lon,lat to x,y
> MAP_PROJ_INVERSE converst from x,y to lon,lat

> Both of these routines require a map structure variable from
> MAP_PROJ_INIT.

> Cheers,
> Liam.
> Practical IDL Programming
> http://www.gumley.com/

Excellent,
thank you Liam, you have
saved me a good deal of time reading through
the documentation (I read through the map projection
chapter in the user guide, and really got nothing out of it.)

I've been doing map projections and overlaying data for years,
but have never had to venture out of the use of map_set, til now.


Cheers,
bob
Re: google earth projections [message #63976 is a reply to message #63180] Wed, 26 November 2008 06:01 Go to previous message
voorlandt is currently offline  voorlandt
Messages: 3
Registered: November 2008
Junior Member
> Does your /cylindrical map projection actually work?
> For my images (global), it did not.  Perhaps you are not plotting
> near the poles.

Yes the cylindrical map projection works really well. I have my
(global) data on a fixed lat/lon grid, and when I plot the country
boundaries, they almost perfectly match with google's boundaries in
overlay. The transparent function given above does not work for me
(the saved file is completely transparent), so I use GIMP to make the
background transparent.

Here is my complete code (it uses the Coyote and Catalyst Program
Libraries)

!P.POSITION = [0, 0, 1, 1] & !P.REGION = [0, 0, 1, 1] & !X.MARGIN =
[0, 0] & !Y.MARGIN = [0, 0]
DEVICE, DECOMPOSED=0 & window,1,xsize=5000,ysize=2500 & LoadCT, 22, /
Silent, NColors=255
MAP_SET, /Cylindrical, /NOBORDER, LIMIT = [-90, -180, 90, 180],
Position=[0, 0, 1, 1]
contour, zzzz, lond,latd, MIN_VALUE=0, MAX_VALUE=1,/FILL,
NLEVELS=255, /OVERPLOT, C_Colors=indgen(255), Position=[0, 0, 1, 1]
MAP_CONTINENTS, Color=FSC_Color('black',255) & Map_Grid,
Color=FSC_Color('black',255)
image = tvrd(true=1) & write_png, 'file.png', image & wdelete,1
Re: google earth projections [message #63988 is a reply to message #63180] Tue, 25 November 2008 14:21 Go to previous message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
<voorlandt@gmail.com> wrote in message
news:bec6a55a-8ecd-4101-bf97-2a140924ceff@u14g2000yqg.google groups.com...
> Thanks a lot for all the comments. They were really helpful. It is
> nice to see such an active and friendly group. The NOBORDER trick
> worked and saves me a lot of time. I can't believe I missed it in the
> documentation (yes I did look through it :)).
>
> Thanks again and best regards,
>
> Voorlandt


Does your /cylindrical map projection actually work?
For my images (global), it did not. Perhaps you are not plotting
near the poles.

Cheers,
bob
Re: google earth projections [message #63990 is a reply to message #63180] Tue, 25 November 2008 14:05 Go to previous message
voorlandt is currently offline  voorlandt
Messages: 3
Registered: November 2008
Junior Member
Thanks a lot for all the comments. They were really helpful. It is
nice to see such an active and friendly group. The NOBORDER trick
worked and saves me a lot of time. I can't believe I missed it in the
documentation (yes I did look through it :)).

Thanks again and best regards,

Voorlandt
Re: google earth projections [message #63992 is a reply to message #63180] Tue, 25 November 2008 09:15 Go to previous message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
<voorlandt@gmail.com> wrote in message
news:42eaa481-0a65-42e3-a5fd-4aeedb42aeaf@r40g2000yqj.google groups.com...
> Hi,
>
> I have been trying to overlay an IDL image on google earth, and it
> worked pretty well. One thing that would be really useful is to have
> IDL do a contour plot without introducing an extra border to the image
> (so I can directly import it in google earth). I have tried setting
> the position and region variable to [0,0,1,1], but to no avail. The
> extra border I am talking about can be seen here:
>
> http://www.dfanning.com/color_tips/contour_fill_2.jpg
>
> I am referring to the very thin black border between the image and the
> thin white boarder (not the thick black border).
>
> Here is a minimal example
> DEVICE, DECOMPOSED=0 & window,1,xsize=5000,ysize=2500
> MAP_SET, /Cylindrical , LIMIT = [-90, -180, 90, 180], Position=[0, 0,
> 1, 1]
> contour, zzzz, lond,latd ,/OVERPLOT,Position=[0, 0, 1, 1]
> MAP_CONTINENTS, Position=[0, 0, 1, 1] & Map_Grid, Position=[0, 0, 1,
> 1]
>
>
> Any help much appreciated!
>
> Voorlandt


I haven't done that explicitly, but here a blurb of code i used to make
google earth plots (with transparency).

set_plot,'z',/copy
device,set_resolution =[ 2000,1000]
; plot data right to the edges, for import to goog earth
saveregion = !P.region
!P.region = [0,0,1,1]
saveposition = !P.position
!P.position = [0,0,1,1]
savexmargin = !x.margin
!x.margin = [0,0]



mapStruct = MAP_PROJ_INIT(117, LIMIT=limit, $
CENTER_LONGITUDE=180)

PLOT, mapStruct.uv_box[[0,2]],mapStruct.uv_box[[1,3]] , $
/NODATA, ISOTROPIC=0, XSTYLE=5, YSTYLE=5,$
xtickname = blank_string(10),ytickname=blank_string(10),$
position = [0,0,1,1]

; NOTE: d = the data structure
result = MAP_PROJ_FORWARD(d.lon(wg(i)),d.lat(wg(i)),map_structure =
mapstruct)
x = result[0,*]
y = result[1,*]
plots,x,y,psym=3,/data,color = 100


create_png_transparent, outfilename
print,'creating ',outfilename
!P.region=saveregion ; restore previous region
!P.position = saveposition
!x.margin = savexmargin




where the png routine is just:

pro create_png_transparent,filename


if n_params() eq 0 then filename = 'idl_dump.png'
; capture the screen image
screendump = tvrd()
t = BytArr(256) + 255B
t[255] = 0
t[0] = 0 ; temp version here, for the swaths.
TVLCT, R, G, B, /GET
; write the screendump to a gif file
write_png,filename,screendump,r,g,b,transparent=t


end
Re: google earth projections [message #63996 is a reply to message #63180] Tue, 25 November 2008 07:18 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
savoie@nsidc.org writes:

> What about the NOBORDER keyword to map_set ?

There you go! I kept thinking the keyword was NOMARGIN,
and that didn't work. It didn't occur to me to look
at the documentation. ;-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: google earth projections [message #63997 is a reply to message #63180] Tue, 25 November 2008 07:07 Go to previous message
Matt[2] is currently offline  Matt[2]
Messages: 69
Registered: March 2007
Member
voorlandt@gmail.com writes:

> Hi,
>
> I have been trying to overlay an IDL image on google earth, and it
> worked pretty well. One thing that would be really useful is to have
> IDL do a contour plot without introducing an extra border to the image
> (so I can directly import it in google earth). <snip>
>
> http://www.dfanning.com/color_tips/contour_fill_2.jpg

What about the NOBORDER keyword to map_set ?

NOBORDER
Set this keyword to not draw a border around the map. The map will fill the
extent of the plotting region. If NOBORDER is not specified, a margin
equalling 1% of the plotting region will be placed between the map and the
border.

HTH,

Matt


--
Matthew Savoie - Scientific Programmer
National Snow and Ice Data Center
(303) 735-0785 http://nsidc.org
Re: google earth projections [message #64007 is a reply to message #63180] Mon, 24 November 2008 18:54 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Yes, I don't know what that is all about. The size of the
> border appears to be proportional to the window size,
> and not to the size of the data being displayed. I think
> you will have to ask ITTVIS about it. :-)

Of course, you could use TVIMAGE instead of CONTOUR. This
wouldn't *fix* the problem with MAP_SET, but it would
extend the colors to the edge and maybe make it easier
to finesse the rest of it:

data = dist(181, 91)
x = scale_vector(findgen(181), -180, 180)
y = scale_vector(findgen(91), -90, 90)
ctload, 4, /brewer, NCOLORS=20
device, decomposed=0
map_set, /Cylindrical, Position=[0,0,1,1]
;contour, /overplot, data, x, y, Cell_Fill=1, nlevels=20
TVIMAGE, BytScl(data, TOP=19), Position=[0,0,1,1]
MAP_GRID
MAP_CONTINENTS
END

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: google earth projections [message #64008 is a reply to message #63180] Mon, 24 November 2008 18:48 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
voorlandt@gmail.com writes:

> I have been trying to overlay an IDL image on google earth, and it
> worked pretty well. One thing that would be really useful is to have
> IDL do a contour plot without introducing an extra border to the image
> (so I can directly import it in google earth). I have tried setting
> the position and region variable to [0,0,1,1], but to no avail.

Yes, I don't know what that is all about. The size of the
border appears to be proportional to the window size,
and not to the size of the data being displayed. I think
you will have to ask ITTVIS about it. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: google earth projections [message #64009 is a reply to message #63355] Mon, 24 November 2008 15:21 Go to previous message
voorlandt is currently offline  voorlandt
Messages: 3
Registered: November 2008
Junior Member
Hi,

I have been trying to overlay an IDL image on google earth, and it
worked pretty well. One thing that would be really useful is to have
IDL do a contour plot without introducing an extra border to the image
(so I can directly import it in google earth). I have tried setting
the position and region variable to [0,0,1,1], but to no avail. The
extra border I am talking about can be seen here:

http://www.dfanning.com/color_tips/contour_fill_2.jpg

I am referring to the very thin black border between the image and the
thin white boarder (not the thick black border).

Here is a minimal example
DEVICE, DECOMPOSED=0 & window,1,xsize=5000,ysize=2500
MAP_SET, /Cylindrical , LIMIT = [-90, -180, 90, 180], Position=[0, 0,
1, 1]
contour, zzzz, lond,latd ,/OVERPLOT,Position=[0, 0, 1, 1]
MAP_CONTINENTS, Position=[0, 0, 1, 1] & Map_Grid, Position=[0, 0, 1,
1]


Any help much appreciated!

Voorlandt
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: widget_tab: prevent switching?
Next Topic: Re: Filled contours + labels of different color

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:13:53 PDT 2025

Total time taken to generate the page: 0.00511 seconds