Re: how to composite a mapcoord object using geographic coordinate(no projection) [message #84596] |
Sat, 22 February 2014 09:14  |
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 #87704 is a reply to message #87702] |
Mon, 24 February 2014 05:37   |
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 #87706 is a reply to message #87703] |
Mon, 24 February 2014 05:58   |
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 #87712 is a reply to message #87710] |
Tue, 25 February 2014 01:25   |
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 #87751 is a reply to message #87713] |
Wed, 26 February 2014 00:39   |
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
|
|
|
|