<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:#008040;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
pre
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink="#008040">

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>&gt; Is there a way to access the Latitude and Longitude
data with gdal or do I have to drop down to using the HDF4 library directly?<br>
<font color=navy><span style='color:navy'>There is several ways to query and hide
information inside a HDF4 file and unfortunately the data providers know that
;-). So if you are going to write your own code, check out the return of SWinqgeofields,
if returns something other then zero it means that you will not find a &#8220;Latitude&#8221;
and &#8220;Longitude&#8221; subdataset to read the geolocation from. Not with
that name &#8220;Latitude&#8221; and &#8220;Longitude&#8221; but with the names
that SWinqgeofields &nbsp;&#8216;returns&#8217; in the second parameter. Good
luck<o:p></o:p></span></font></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
gdal-dev-bounces@lists.maptools.org
[mailto:gdal-dev-bounces@lists.maptools.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Huw Lynch<br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, December 19, 2006
7:24 PM<br>
<b><span style='font-weight:bold'>To:</span></b> gdal-dev@lists.maptools.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [Gdal-dev] accessing
MODIS L1B geolocation data with gdal</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><br>
Sorry if this question has been asked before; I've searched but can't find a
full explaination.<br>
<br>
I am trying to access geolocation information in MODIS L1B data files. I was
hoping that the Latitude and Longitude data sets would be visible via gdalinfo
however when I run this those 2 datasets appear to be skipped over.<br>
<br>
Here's a gdalinfo output from an example modis data file;<br>
<br>
$ gdalinfo MOD03.Terra20061216T021152Z20061216T021611Z.hdf <br>
Driver: HDF4/Hierarchical Data Format Release 4<br>
Size is 512, 512<br>
Coordinate System is `'<br>
Metadata:<br>
--cut--<br>
&nbsp; ASSOCIATEDSENSORSHORTNAME=MODIS<br>
&nbsp; ASSOCIATEDPLATFORMSHORTNAME=Terra<br>
&nbsp; ASSOCIATEDINSTRUMENTSHORTNAME=MODIS<br>
--cut--<br>
&nbsp; PROCESSVERSION=5.0.2<br>
--cut--<br>
Subdatasets:<br>
&nbsp;
SUBDATASET_1_NAME=HDF4_EOS:EOS_SWATH:&quot;MOD03.Terra20061216T021152Z20061216T021611Z.hdf&quot;:MODIS_Swath_Type_GEO:Height<br>
&nbsp; SUBDATASET_1_DESC=[1620x1354] Height (16-bit integer)<br>
&nbsp; SUBDATASET_2_NAME=HDF4_EOS:EOS_SWATH:&quot;MOD03.Terra20061216T021152Z20061216T021611Z.hdf&quot;:MODIS_Swath_Type_GEO:SensorZenith<br>
&nbsp; SUBDATASET_2_DESC=[1620x1354] SensorZenith (16-bit integer)<br>
&nbsp;
SUBDATASET_3_NAME=HDF4_EOS:EOS_SWATH:&quot;MOD03.Terra20061216T021152Z20061216T021611Z.hdf&quot;:MODIS_Swath_Type_GEO:SensorAzimuth<br>
&nbsp; SUBDATASET_3_DESC=[1620x1354] SensorAzimuth (16-bit integer)<br>
&nbsp;
SUBDATASET_4_NAME=HDF4_EOS:EOS_SWATH:&quot;MOD03.Terra20061216T021152Z20061216T021611Z.hdf&quot;:MODIS_Swath_Type_GEO:Range<br>
&nbsp; SUBDATASET_4_DESC=[1620x1354] Range (16-bit unsigned integer)<br>
&nbsp;
SUBDATASET_5_NAME=HDF4_EOS:EOS_SWATH:&quot;MOD03.Terra20061216T021152Z20061216T021611Z.hdf&quot;:MODIS_Swath_Type_GEO:SolarZenith<br>
&nbsp; SUBDATASET_5_DESC=[1620x1354] SolarZenith (16-bit integer)<br>
&nbsp; SUBDATASET_6_NAME=HDF4_EOS:EOS_SWATH:&quot;MOD03.Terra20061216T021152Z20061216T021611Z.hdf&quot;:MODIS_Swath_Type_GEO:SolarAzimuth<br>
&nbsp; SUBDATASET_6_DESC=[1620x1354] SolarAzimuth (16-bit integer)<br>
&nbsp;
SUBDATASET_7_NAME=HDF4_EOS:EOS_SWATH:&quot;MOD03.Terra20061216T021152Z20061216T021611Z.hdf&quot;:MODIS_Swath_Type_GEO:Land/SeaMask<br>
&nbsp; SUBDATASET_7_DESC=[1620x1354] Land/SeaMask (8-bit unsigned integer)<br>
&nbsp;
SUBDATASET_8_NAME=HDF4_EOS:EOS_SWATH:&quot;MOD03.Terra20061216T021152Z20061216T021611Z.hdf&quot;:MODIS_Swath_Type_GEO:gflags<br>
&nbsp; SUBDATASET_8_DESC=[1620x1354] gflags (8-bit unsigned integer)<br>
<br>
I'm certain that the Latitude and Longitude data is there, because I can see it
with hdp;<br>
<br>
$ hdp dumpsds -h MOD03.Terra20061216T021152Z20061216T021611Z.hdf<br>
--cut--<br>
Variable Name = Latitude<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Index = 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type= 32-bit floating point<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ref. = 20<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rank = 2<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Number of attributes = 3<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim0:
Name=nscans*10:MODIS_Swath_Type_GEO<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Size = 1620<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Scale Type = number-type not set<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Number of attributes = 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim1:
Name=mframes:MODIS_Swath_Type_GEO<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Size = 1354<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Scale Type = number-type not set<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Number of attributes = 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Attr0: Name = units<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Type = 8-bit signed char <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Count= 7<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Value = degrees<br>
<br>
Is there a way to access the Latitude and Longitude data with gdal or do I have
to drop down to using the HDF4 library directly?<br>
<br>
The frmt_hdf4.html file shipped with gdal includes an example as such;<o:p></o:p></span></font></p>

<pre><font size=2 face="Courier New"><span style='font-size:10.0pt'>$ gdalinfo GSUB1.A2001124.0855.003.200219309451.hdf<br>
Driver:<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'> HDF4/Hierarchical Data Format Release 4<br>
Size is 512, 512<br>
Coordinate System is `'<br>
Metadata:<br>
&nbsp; HDFEOSVersion=HDFEOS_V2.7<br>
&nbsp; Number of Scans=204<br>
&nbsp; Number of Day mode scans=204<br>
&nbsp; Number of Night mode scans=0<br>
&nbsp; Incomplete Scans=0<o:p></o:p></span></font></pre>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>...a lot of metadata output skipped...<o:p></o:p></span></font></p>

<pre><font size=2 face="Courier New"><span style='font-size:10.0pt'>Subdatasets:<br>
&nbsp; SUBDATASET_1_NAME=HDF4_SDS:MODIS_L1B:GSUB1.A2001124.0855.003.200219309451.hdf:0<br>
&nbsp; SUBDATASET_1_DESC=[408x271] Latitude (32-bit floating-point)<br>
&nbsp; SUBDATASET_2_NAME=HDF4_SDS:MODIS_L1B:GSUB1.A2001124.0855.003.200219309451.hdf:1<br>
&nbsp; SUBDATASET_2_DESC=[408x271] Longitude (32-bit floating-point)<br>
&nbsp; SUBDATASET_3_NAME=HDF4_SDS:MODIS_L1B:GSUB1.A2001124.0855.003.200219309451.hdf:2<br>
&nbsp; SUBDATASET_3_DESC=[12x2040x1354] EV_1KM_RefSB (16-bit unsigned integer)<o:p></o:p></span></font></pre>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'><br>
Even if it's not possible to get at the lat/lon data with gdal, I'm interested
in understanding why it doesn't work.<br>
<br>
Cheers &amp; thanks<br>
<br>
Huw Lynch<o:p></o:p></span></font></p>

</div>

</div>

</div>

</body>

</html>