Hi Mo,

mohwawang wrote:
Vincent,

I tried gdalwarp as:
gdalwarp in.tif out.tif
ERROR 1: Unable to compute a transformation between pixel/line and 
georeferenced coordinate for in.tif.
There is no affine transformation and no GCPs.

I guess gdalwarp needs GCPs in in.tif that does not have GCPs in it.
Ah, sorry about that. I assumed your in.tif had gcp's.
I also tried gdal_translate again and this time I used -a_ullr as:
gdal_translate -of GTiff in.tif out.gtf -a_srs EPSG:4326 -a_ullr 
-70.887525562763 42.8093748999134 -70.8894939447889 42.8082925732318

Then gdalinfo showed correct corner coordinates. But GE still could not import 
the out.gtf.
Well, at least you now have a proper north-up geotiff file with embedded projection and corner coordinates. I'd say any app that says it supports geotiffs should be able to read this file correctly. I am sorry, but I have no idea why GE does not import this file correctly. I have no GE pro license, and no experience with viewing geotiff files in GE. You might wish to ask on a GE list/forum...

Regards,
Vincent.
Mo

gdalinfo out.gtf
Driver: GTiff/GeoTIFF
Files: out.gtf
Size is 561, 420
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.2572235630016,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-70.887525562763003,42.809374899913401)
Pixel Size = (-0.000003508702363,-0.000002576968290)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_XRESOLUTION=300
  TIFFTAG_YRESOLUTION=300
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( -70.8875256, 42.8093749) Lower Left ( -70.8875256, 42.8082926) Upper Right ( -70.8894939, 42.8093749) Lower Right ( -70.8894939, 42.8082926) Center ( -70.8885098, 42.8088337) Band 1 Block=561x4 Type=Byte, ColorInterp=Red
Band 2 Block=561x4 Type=Byte, ColorInterp=Green
Band 3 Block=561x4 Type=Byte, ColorInterp=Blue

--- On Fri, 4/10/09, Vincent Schut <sc...@sarvision.nl> wrote:

From: Vincent Schut <sc...@sarvision.nl>
Subject: Re: [gdal-dev] Problem in importing to Google Earth a nitf image 
converted from a tif image by gdal_translate
To: Cc: "gdal-dev@lists.osgeo.org" <gdal-dev@lists.osgeo.org>
Date: Friday, April 10, 2009, 3:15 AM
mohwawang wrote:
Hi Roger,

gdalinfo gave me only info about coordinates of GCPs
but I doubt that are much useful to GE. Any other way (other
than using GCP in gdal_translate) to embed the coordinates
info to the GeoTIFF file?
Mo,

I doubt GE will read and use your gcp's. And as there is
not georeferencing (as: standard geotiff georeferencing) in
your tiff, GE will fail to place your image.
I'd try to run your tiff through gdalwarp instead of
gdal_translate. Good chance that gdalwarp will convert your
unprojected image with gcp's into a real projected geotiff.
Just try: 'gdalwarp <inimage.tif>
<outimage.tif>' and then check your outimage with
gdal_info. It should now give you proper lat/lon values for
the corner coordinates, instead of pixel indices.

Vincent.
Thanks.

Mo

Driver: GTiff/GeoTIFF
Files: gdal_translate_tif_to_gtiff.gtf
Size is 561, 420
Coordinate System is `'
GCP Projection = GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.2572235630016,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]]
GCP[  0]: Id=1, Info=
           (0,0)
-> (-70.887525562763,42.8093748999134,0)
GCP[  1]: Id=2, Info=
           (560,0)
-> (-70.887525562763,42.8082925732318,0)
GCP[  2]: Id=3, Info=
           (560,419)
-> (-70.8894939447889,42.8082925732318,0)
GCP[  3]: Id=4, Info=
           (0,419)
-> (-70.8894939447889,42.8093748999134,0)
Metadata:
   AREA_OR_POINT=Area
   TIFFTAG_XRESOLUTION=300
   TIFFTAG_YRESOLUTION=300
   TIFFTAG_RESOLUTIONUNIT=2
(pixels/inch)
Image Structure Metadata:
   INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.0,
0.0)
Lower Left  (    0.0,  420.0)
Upper Right (  561.0,    0.0)
Lower Right (  561.0,  420.0)
Center ( 280.5,
210.0)
Band 1 Block=561x4 Type=Byte, ColorInterp=Red
Band 2 Block=561x4 Type=Byte, ColorInterp=Green
Band 3 Block=561x4 Type=Byte, ColorInterp=Blue

------


--- On Thu, 4/9/09, Roger André <ran...@gmail.com>
wrote:
From: Roger André <ran...@gmail.com>
Subject: Re: [gdal-dev] Problem in importing to
Google Earth a nitf image  converted from a tif image
by gdal_translate
To: "mohwawang" <mohwaw...@yahoo.com>
Cc: "gdal-dev@lists.osgeo.org"
<gdal-dev@lists.osgeo.org>
Date: Thursday, April 9, 2009, 4:30 PM
Hi Mo,

What is the gdalinfo output for the GeoTIFF that
you
created?  If you didn't get an error when you
tried to
load it in GE, perhaps the georeferencing in the
image
doesn't quite match what you specified in your
KML.
Roger
--

On Thu, Apr 9, 2009 at 1:21 PM,
mohwawang <mohwaw...@yahoo.com>
wrote:



Hi Roger,



My goal is to be able to directly import NITF
image to GE
without using KML. You can see the advantage of
this
application - if it works. I'm glad that you have
viewed
in GE georeferenced imagery created or altered by
gdal.
Maybe you can point out what I did wrong.




It is good that you asked about GeoTIFF. So I
used
gdal_translate to convert the tif image to a
GeoTIFF image.
I tried to drag and drop the GeoTIFF image to GE
but nothing
happened. I did not see the GeoTIFF image in GE
and I did
not get any error message either.




I can open the GeoTIFF image with OpenEV and I can
read the
lan/lon coordinates and they are correct. One
thing is that
it seems that OpenEV does not set North to Up.
Its
orientation aligns with the file coordinates -
(0,0) is at
the upper left corner. I then opened tif file in
the same
OpenEV and they match to each other.




Again, I can import the tif image with its kml to
GE but I
can not import the GeoTIFF to GE (without using
kml), it
seems that nothing happened. I can import the
GeoTIFF to GE
with kml - though that is not what I want. But the
GeoTIFF
is better than the NITF that could not be imported
to GE
even with the same kml.




What's wrong with GeoTIFF? I mean why I could not
import it to GE? I listed the gdal_translate
command line
here:



gdal_translate -of GTiff tiff.tif gtiff.gtf
-a_srs
EPSG:4326 -gcp 0 0 -70.887525562763
42.8093748999134 -gcp
560 0 -70.887525562763 42.8082925732318 -gcp 560
419
-70.8894939447889 42.8082925732318 -gcp 0 419
-70.8894939447889 42.8093748999134




I don't have a .ntif file that was not created by
gdal
to test GE via the "Import Image Tool".



Thanks.



Mo





--- On Thu, 4/9/09, Roger André <ran...@gmail.com>
wrote:



From: Roger André <ran...@gmail.com>
       Subject: Re:
[gdal-dev] Problem in importing to Google
Earth a nitf image  converted from a tif
image by
gdal_translate

To: "mohwawang" <mohwaw...@yahoo.com>
       Cc: "gdal-dev@lists.osgeo.org"
<gdal-dev@lists.osgeo.org>

Date: Thursday, April 9, 2009, 12:47 PM
       Hi Mo,
       Thanks for that
pointer on the differences between GE
       Layers and
Places.  I'll be sure to take a close
look

at those links.  I've had occasion in the
past to
view

georeferenced imagery in Google Earth, much of
it
created or

altered by gdal in some way, so this topic
interests
me.

I'm curious, is your goal to view the NITF
format
       specifically
and to have GE read the internal
georeferencing

info, or is it just to view the image in
GE?  It
sounds

like you have already accomplished the latter
using a
KML

Ground Overlay and a tif, a method which has
also
worked

reliably for me in the past as well. I've
also
had

success with PNG and JPEG format files.
     Since in your .nitf test the
georeferencing was
supplied by

the KML file, the red "X" you are getting
implies

to me that the image format isn't being
correctly
       interpreted by
GE for some reason.  The fact that
Envi

chokes on it as well does seem to point to
gdal as a
       possible
culprit, although the NITF format is not one
that I

have seen very much.  Have you tried
importing the
GeoTIFF

version of your file directly into GE Pro as
well?
Also,

do you have a .nitf file that was not created
by gdal,
and

which you could use to test GE via the "Add
Image

Overlay" tool?
       Roger
       --
       On Thu, Apr 9,
2009 at 8:37 AM,
       mohwawang
<mohwaw...@yahoo.com>
       wrote:
       Roger,
       I'm using
Google Earth Pro 5.0. Thank you for the
       suggestions.
       Google Earth
Pro 4.0 also supports importing NITF:
       http://earth.google.com/userguide/v4/ug_importdata.html
       that is for
importing your data (including vector data
and

imagery data) to the Places of Google Earth
while http://earth.google.com/userguide/v4/ug_imageoverlays.html
       is for "Using
Image Overlays and 3D
Models".

See http://earth.google.com/userguide/v4/ug_layers.html#layers_vs_places
       for the
difference between Layers and Places in GE.
       This is the
first time I'm importing
geo-referenced

images to Google Earth Pro and so far I don't
have
much

luck. As I said that I could not use GE to
import the
NITF

images converted from gdal_translate (with
EPSG:4326
that is

the same projection, Simple Cylindrical
projection, or
known

as Lat/Lon WGS84 that GE uses). So I tried to
narrow
down

the problem. This time I imported to GE an
native
Erdas

IMAGINE image (.img) (with UTM projection that
GE
supports

too) but still failed. The later test case has
nothing
to do

with gdal and is purely a question for GE.
That .img
image

can be opened by both IMAGINE and OpenEV.
       The NITF image
(converted by gdal_translate) not just
could

not be opened by GE it could not be opened by
ENVI
4.1

either. It can be opened by OpenEV (tightly
related to
gdal)

though. So it could be a problem in either
gdal_translate or

ENVI (I doubt though) or both.
       Thanks.
       Mo
       --- On Thu,
4/9/09, Roger André <ran...@gmail.com>
       wrote:
From: Roger André <ran...@gmail.com>
   Subject: Re: [gdal-dev] Problem in
importing to
Google

Earth a nitf image  converted from a tif
image by
       gdal_translate
To: "mohwawang" <mohwaw...@yahoo.com>
         Cc:
"gdal-dev@lists.osgeo.org"
<gdal-dev@lists.osgeo.org>
Date: Thursday, April 9, 2009, 12:44 AM
   Granted, I haven't
tried V 5 yet,
but your quote also states, "Google Earth
Pro or

EC".  Are you using one of those
versions
of

the
client?  In any case, if the file
opens in
OpenEV,

chances
are good that the .ntf generated by gdal
is ok,
and

that
there is some sort of problem with how
Google
Earth

is
reading it.  Have you tried emailing
the KML
support

list
as well?
         --
         On
Wed, Apr 8, 2009 at 8:51 PM,
   mohwawang <mohwaw...@yahoo.com>
   wrote:
   Google Earth 5.0 supports NITF see
         http://earth.google.com/intl/en/userguide/v5/ug_importdata.html
   [Importing Imagery
         You
can open GIS imagery files in Google Earth
Pro or

EC
and have the files correctly projected
over the
proper

map
coordinates in the 3D viewer. Google Earth
Pro
and EC

support the following types of GIS
imagery:
   * TIFF (.tif), including GeoTiff and
compressed

TIFF
files
   * National Imagery Transmission Format
(.ntf)

     * Erdas Imagine
Images (.img)
         In
addition, you can also import the following
images.
Because they do not contain projection
information,

you must
manually edit their coordinates for
correct
positioning:
     * Atlantis MFF
Raster (.hdr)
   * PCIDSK Database File (.pix)
   * Portable Pixmap Format (.pnm)
   * Device Independent Bitmap (.bmp)
         Note
- All imagery files must contain the
correct

projection information in order to be
accurately
   re-projected by the Google Earth
software.]
         Mo
         ---
On Wed, 4/8/09, Roger André <ran...@gmail.com>
   wrote:
From: Roger André <ran...@gmail.com>
   Subject: Re: [gdal-dev] Problem in
importing
to

Google
Earth a nitf image  converted from a
tif image
by

gdal_translate
To: "mohwawang" <mohwaw...@yahoo.com>
   Cc: "gdal-dev@lists.osgeo.org"
<gdal-dev@lists.osgeo.org>
Date: Wednesday, April 8, 2009, 10:45
PM
   See http://earth.google.com/userguide/v4/ug_imageoverlays.html#requirements,
   I don't believe the "NITF (rw+):
National
Imagery
Transmission Format" is supported by
Google

Earth.
Roger
   --
   On Wed, Apr 8, 2009 at 3:27 PM,
   mohwawang <mohwaw...@yahoo.com>
   wrote:
   Hi all,
   I'm sorry that this is the third time I
tried

to
send
this message out because I myself
didn't
get

the
first
two through gdal-dev@lists.osgeo.org
   so I thought others might not get it
either.

I used gdal_translate to convert a tif
image
to

a
nitf
image as:
gdal_translate -of nitf in.tif
out.ntf
-co

ICORDS=G
Input file size is 561, 420
0...10...20...30...40...50...60...70...80...90...100
-
done.
I can display both in.tif and out.ntf
with
OpenEV. So
both
in.tif and out.ntf were ok to OpenEV.
   With a simple Google Earth kml
file(specifying

the
LanLonBox)(printed below) I could
import
the

in.tif
to
Google Earth viewer to the right
geo-location.

So
in.tif was
ok to GE.
   However, after replacing the image file
name

from
in.tif to
out.ntf in the same kml file (printed
below)
I

could
not
import the out.ntf to Google Earth
viewer
(shown

as a
big
red cross in a big red rectangle at
the
geo-location
in the
GE viewer). So out.ntf was not ok to
GE.
Any

ideal
about
what might cause the problem? Was the
use
of

gdal_translate
wrong or missing some options? I tried
not
to use

-co
ICRODS=G but I got the same problem.
Thank
you.

printed kml for in.tif:
   <?xml version="1.0"
   encoding="UTF-8"?>
   <kml xmlns="http://www.opengis.net/kml/2.2";
   xmlns:gx="http://www.google.com/kml/ext/2.2";
   xmlns:kml="http://www.opengis.net/kml/2.2";
   xmlns:atom="http://www.w3.org/2005/Atom";>
   <GroundOverlay>
   <description>
   *** Meta-Data ***
     Lat = 42.808863
   </description>
     <name>in.tif</name>
     <Icon>
        <href>in.tif</href>
<viewBoundScale>0.75</viewBoundScale>
     </Icon>
       <LatLonBox>
<north>42.8093748999134</north>
<south>42.8082925732318</south>
<east>-70.887525562763</east>
<west>-70.8894939447889</west>
<rotation>-95.909027</rotation>
   </LatLonBox>
   </GroundOverlay>
   </kml>
   printed kml for out.ntf: same as in.tif
   except:
     <name>out.ntf</name>
     <Icon>
<href>out.ntf</href>
<viewBoundScale>0.75</viewBoundScale>
     </Icon>
   Best Regards,
   Mo Wang
_______________________________________________

gdal-dev mailing list
   gdal-dev@lists.osgeo.org
   http://lists.osgeo.org/mailman/listinfo/gdal-dev






   _______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev




_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to