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

Home » Public Forums » archive » Re: how to composite a mapcoord object using geographic coordinate(no projection)
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
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #84596] Sat, 22 February 2014 09:14 Go to next message
Jie Zhou is currently offline  Jie Zhou
Messages: 27
Registered: February 2014
Junior Member
On Saturday, February 22, 2014 2:24:48 PM UTC+1, David Fanning wrote:
> Jie Zhou writes:
>
>
>
>> I want to display a image using selectabledrawwidget. The image hold geographic coordinate (GTCP code 100). When I try to add map grid or outline on the display, I should set a mapcoord for the display. But as I know, the mapcoord definition does not support geographic projection. So anyone know how to process it? or is there any other object can finish the work?
>
>
>
> I added the Geographic "projection" to the MapCoord object for you this
>
> morning. You can find it here:
>
>
>
>
>
> http://www.idlcoyote.com/programs/catalyst/source/coordinate s/mapcoord__
>
> define.pro
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Hi,David,
Thanks for your help. But I think the GEOCOORD object should be change, too
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87689 is a reply to message #84596] Sun, 23 February 2014 05:02 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jie Zhou writes:

> Thanks for your help. But I think the GEOCOORD object should be change, too.

Well, the GeoCoord object is a little different. It relies on map
projection data being in a GeoTiff file. But, a geographic coordinate
system doesn't have a map projection associated with it. (Which is why
this wasn't initially included in either object.)

I've never seen a TIFF file with a geographic coordinate system, but I
imagine one exists. If you have one and can send it to me, I can take a
look at seeing if I can incorporate this into GeoCoord. It will be a day
or two before I can get to this.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87690 is a reply to message #87689] Sun, 23 February 2014 08:12 Go to previous messageGo to next message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
The digital elevation model SRTM is distributed as 5x5 degrees tiles as GeoTIFFs in lat/Lon.

http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-dat abase-v4-1

This is obviously a rather important dataset for the geosciences.

--
Yngvar
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87699 is a reply to message #87690] Sun, 23 February 2014 16:22 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Yngvar Larsen writes:

> The digital elevation model SRTM is distributed as 5x5 degrees tiles as GeoTIFFs in lat/Lon.
>
> http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-dat abase-v4-1
>
> This is obviously a rather important dataset for the geosciences.

Great. Thanks!

Do you have one of these you can e-mail to me? The server appears to be
down.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87702 is a reply to message #87699] Mon, 24 February 2014 00:19 Go to previous messageGo to next message
Jie Zhou is currently offline  Jie Zhou
Messages: 27
Registered: February 2014
Junior Member
On Monday, February 24, 2014 1:22:03 AM UTC+1, David Fanning wrote:
> Yngvar Larsen writes:
>
>
>
>> The digital elevation model SRTM is distributed as 5x5 degrees tiles as GeoTIFFs in lat/Lon.
>
>>
>
>> http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-dat abase-v4-1
>
>>
>
>> This is obviously a rather important dataset for the geosciences.
>
>
>
> Great. Thanks!
>
>
>
> Do you have one of these you can e-mail to me? The server appears to be
>
> down.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

I have send you a geotiff file with geographic coordinate by email yesterday. Did you get it?
Jie
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87703 is a reply to message #87699] Mon, 24 February 2014 00:47 Go to previous messageGo to next message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Monday, 24 February 2014 01:22:03 UTC+1, David Fanning wrote:
> Yngvar Larsen writes:
>
>> The digital elevation model SRTM is distributed as 5x5 degrees tiles as GeoTIFFs in lat/Lon.
>
>> http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-dat abase-v4-1
>>
>> This is obviously a rather important dataset for the geosciences.
>
> Great. Thanks!
>
> Do you have one of these you can e-mail to me? The server appears to be down.

I just sent you an email with a download link for one of the SRTM tiles.

--
Yngvar
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87704 is a reply to message #87702] Mon, 24 February 2014 05:37 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jie Zhou writes:

> I have send you a geotiff file with geographic coordinate by email yesterday. Did you get it?

I did get this file. Here is what the GeoTiff structure in the file
looks like:

IDL> help, geotiff
** Structure <6bcac450>, 7 tags, length=104, data length=96, refs=1:
MODELPIXELSCALETAG
DOUBLE Array[3]
MODELTIEPOINTTAG
DOUBLE Array[6, 1]
GTMODELTYPEGEOKEY
INT 2
GTRASTERTYPEGEOKEY
INT 1
GTCITATIONGEOKEY
STRING 'IMAGINE GeoTIFF Support
ERDAS Desktop 2010 10.1.0.604
Projection Name = Geographic (Lat/Lon)
Units = degrees
GeoTIFF Units = dd'
GEOGRAPHICTYPEGEOKEY
INT 4326
GEOGANGULARUNITSGEOKEY
INT 9102

You can see that the map projection "information" is embedded into the
file in a non-standard way as a CGCITATIONGEOKEY string that has to be
parsed to pull out the information needed to read the data. In other
words, this file has to be handled in a completely different way from
"standard" GeoTiff files, which use GeoKeys to obtain information.

I think it would be easier to write a routine that reads these specific
files than it would be to make old code behave in an unnatural way.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87705 is a reply to message #87703] Mon, 24 February 2014 05:38 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Yngvar Larsen writes:

> I just sent you an email with a download link for one of the SRTM tiles.

I just got this. I'll have a look. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87706 is a reply to message #87703] Mon, 24 February 2014 05:58 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Yngvar Larsen writes:

> I just sent you an email with a download link for one of the SRTM tiles.

Yes, so this file doesn't pretend to have map projection information in
it. Here is the GeoTiff structure from the file:

IDL> help, geo
** Structure <7b9e5160>, 2 tags, length=72, data length=72, refs=1:
MODELPIXELSCALETAG
DOUBLE Array[3]
MODELTIEPOINTTAG
DOUBLE Array[6, 1]

I just think it is unreasonable to expect general purpose GeoTiff
readers to handle files like this. Obviously, you can fill your reader
code with multiple exceptions, etc. But, when you get a file like this,
the file itself doesn't tell you want you need to know to work with the
data properly.

I'm not saying it is *hard* to use these files. It is easy enough. I'm
just saying, you need information from outside the file, or in Jie
Zhou's case, you need to parse internal information in a non-standard
way, in order to make sense of the data. If I worked with these files
for a living, I'd take 15 minutes and write myself a reader.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87709 is a reply to message #87706] Mon, 24 February 2014 15:20 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
On 24.02.2014 14:58, David Fanning wrote:
> I just think it is unreasonable to expect general purpose GeoTiff
> readers to handle files like this. Obviously, you can fill your reader
> code with multiple exceptions, etc.

I believe that these are also "standard" formats but less transparent.
My own GeoTiff reader is filled with exceptions and ugly code, written
while reverse engineering this cryptic metadata. I agree with David that
it is not possible to write code to parse all kinds of geotiff files,
but it must be possible somehow since ENVI or ArcGIS handle almost all
geotiffs you could find. IDL could probably inherit code from ENVI, but
this is another topic ;)

Cheers

Fabien
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87710 is a reply to message #87709] Mon, 24 February 2014 15:48 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Fabien writes:

> I believe that these are also "standard" formats but less transparent.

I don't know. I've seen three files in the past three days that purport
to be "GeoTiff" files, and not a one of them appears to have been
written by someone who read the TIFF definitions and standards document.
Can you just make it up and call it a GeoTiff?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87712 is a reply to message #87710] Tue, 25 February 2014 01:25 Go to previous messageGo to next message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Tuesday, 25 February 2014 00:48:48 UTC+1, David Fanning wrote:
> Fabien writes:
>
>
>
>> I believe that these are also "standard" formats but less transparent.

These files are indeed TIFF 6.0 conformant, but the information in them do not contain enough GeoTIFF tags to have a uniquely defined grid without external information. Thus, you need ugly special cases in your GeoTIFF reader to handle this. Or a specific reader for each. I did the latter for SRTM tiles, which only contain "ModelPixelScaleTag" and "ModelTiepointTag", but no info on the coordinate system.

> I don't know. I've seen three files in the past three days that purport
> to be "GeoTiff" files, and not a one of them appears to have been
> written by someone who read the TIFF definitions and standards document.

You should not confuse GeoTIFF with TIFF. A conformant TIFF file can contain almost any imaginable tags/metadata (or not...). However, such extra information can be ignored a conformant TIFF _reader_. GeoTIFF is such extra information.

GCS_WGS_84 = 4326

> Can you just make it up and call it a GeoTiff?

I guess you can use at least one of the defined GeoTIFF tags, and call it a GeoTIFF file. But if you would like your file to be self contained, I would say you should at least follow the cookbooks in the spec:

http://www.remotesensing.org/geotiff/spec/geotiff2.6.html#2. 6.3
http://www.remotesensing.org/geotiff/spec/geotiff2.7.html#2. 7.3

Specifically, for the geographic coordinate systems discussed in this thread, you should do the following

"
case GEOGRAPHIC: Check the list of standard GCS's and use the
corresponding code. To use a code both the Datum, Prime
Meridian, and angular units must match those of the code.

Store in: GeographicTypeGeoKey and skip to Step 4.
If none of the coded GCS's match exactly, then this is a
user-defined GCS. Check the list of standard datums,
Prime Meridians, and angular units to define your system.
Store in: GeogGeodeticDatumGeoKey, GeogAngularUnitsGeoKey,
GeogPrimeMeridianGeoKey and skip to Step 4.

If none of the datums match your system, you have a
user-defined datum, which is an odd system, indeed. Use
the GeogEllipsoidGeoKey to select the appropriate ellipsoid
or use the GeogSemiMajorAxisGeoKey, GeogInvFlatteningGeoKey to
define, and give a reference using the GeogCitationGeoKey.
Store in: GeogEllipsoidGeoKey, etc. and go to Step 4.
"

The file that J. Zhou sent you contain the following information on the coordinate system:

GEOGRAPHICTYPEGEOKEY
INT 4326
GEOGANGULARUNITSGEOKEY
INT 9102
which means a standard GCS (WGS-84) and angular units (degrees) plus
GTMODELTYPEGEOKEY
INT 2
GTRASTERTYPEGEOKEY
INT 1
which means Geographical coordinate system with "PixelIsArea". Thus, this is a well defined self contained GeoTIFF file as far as I understand. On the other hand, the SRTM tile I sent you did not contain any of this, and needs special treatment with external information.

--
Yngvar
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87713 is a reply to message #87712] Tue, 25 February 2014 05:26 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Yngvar Larsen writes:

> These files are indeed TIFF 6.0 conformant, but the information in them do not contain enough GeoTIFF tags to have a uniquely defined grid without external information. Thus, you need ugly special cases in your GeoTIFF reader to handle this. Or a specific reader for each. I did the latter for SRTM tiles, which only contain "ModelPixelScaleTag" and "ModelTiepointTag", but no info on the coordinate system.

Thanks for such a detailed explanation. Very helpful.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87751 is a reply to message #87713] Wed, 26 February 2014 00:39 Go to previous messageGo to next message
Jie Zhou is currently offline  Jie Zhou
Messages: 27
Registered: February 2014
Junior Member
On Tuesday, February 25, 2014 2:26:21 PM UTC+1, David Fanning wrote:
> Yngvar Larsen writes:
>
>
>
>> These files are indeed TIFF 6.0 conformant, but the information in them do not contain enough GeoTIFF tags to have a uniquely defined grid without external information. Thus, you need ugly special cases in your GeoTIFF reader to handle this. Or a specific reader for each. I did the latter for SRTM tiles, which only contain "ModelPixelScaleTag" and "ModelTiepointTag", but no info on the coordinate system.
>
>
>
> Thanks for such a detailed explanation. Very helpful.
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Dear David,
Will you rewrite the code for GEOCOORD to support the Geographic projection?
Jie
Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #87756 is a reply to message #87751] Wed, 26 February 2014 05:21 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jie Zhou writes:

> Will you rewrite the code for GEOCOORD to support the Geographic projection?

Well, maybe, but not anytime soon. I'm really busy right now and paying
customers are in line.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ps_start output
Next Topic: how to composite a mapcoord object using geographic coordinate(no projection)

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

Current Time: Wed Oct 08 13:37:20 PDT 2025

Total time taken to generate the page: 0.00507 seconds