Hi,
The original image is georeferenced with ground control points and direct conversion into GeoTIFF does not change the situation. Use gdalwarp instead. It might be good to use some extra options like –srcnodata, -dstnodata or -dstalpha for handling nodata but this command should be good enough for testing:
gdalwarp -of GTiff -s_srs epsg:4326 –t_srs epsg_4326 -co TILED=YES myFile.ntf myFileConvertedToGeotif.tif
-Jukka Rahkonen-
···
Smart, Gary wrote:
Thanks for your response
gdalinfo from my original NITF file…
Driver: NITF/National Imagery Transmission Format
Files: myOriginalFile.ntf
Size is 5120, 10464
Coordinate System is `’
GCP Projection =
GEOGCS[“WGS 84”,
DATUM[“WGS_1984”,
SPHEROID[“WGS 84”,6378137,298.257223563,
AUTHORITY[“EPSG”,“7030”]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY[“EPSG”,“6326”]],
PRIMEM[“Greenwich”,0,
AUTHORITY[“EPSG”,“8901”]],
UNIT[“degree”,0.0174532925199433,
AUTHORITY[“EPSG”,“9108”]],
AUTHORITY[“EPSG”,“4326”]]
GCP[ 0]: Id=UpperLeft, Info=
(0.5,0.5) → (1.282,52.662,0)
GCP[ 1]: Id=UpperRight, Info=
(5119.5,0.5) → (1.306,52.662,0)
GCP[ 2]: Id=LowerRight, Info=
(5119.5,10463.5) → (1.3,52.633,0)
GCP[ 3]: Id=LowerLeft, Info=
(0.5,10463.5) → (1.281,52.633,0)
Metadata:
NITF_ABPP=10
NITF_CCS_COLUMN=0
NITF_CCS_ROW=0
NITF_CLEVEL=06
NITF_ENCRYP=0
NITF_FBKGC= 48, 48, 48
NITF_FDT=20150922084919
NITF_FHDR=NITF02.10
NITF_FSCATP=O
NITF_FSCAUT=xxxxxxx
NITF_FSCLAS=x
NITF_FSCLSY=xx
NITF_FSCLTX=
NITF_FSCODE=
NITF_FSCOP=00000
NITF_FSCPYS=00000
NITF_FSCRSN=
NITF_FSCTLH=
NITF_FSCTLN=
NITF_FSDCDT=
NITF_FSDCTP=O
NITF_FSDCXM=
NITF_FSDG=
NITF_FSDGDT=
NITF_FSREL=xxxxx
NITF_FSSRDT=
NITF_FTITLE=For map demo
NITF_IALVL=0
NITF_IC=NC
NITF_ICAT=EO
NITF_ICORDS=D
NITF_IDATIM=20020718092742
NITF_IDLVL=1
NITF_IGEOLO=+52.662+001.282+52.662+001.306+52.633+001.300+52.633+001.281
NITF_IID1=B014.F0002
NITF_IID2=18JUL029Z0000012ZX0E0002ZZ000A385601160F/xxxx/xxxxxxxxx/xxxxxxxxxxxx/myOriginalFile.ntf
NITF_ILOC_COLUMN=0
NITF_ILOC_ROW=0
NITF_IMAG=1.0
NITF_IMODE=B
NITF_IREP=MONO
NITF_ISCATP=O
NITF_ISCAUT=xxxxxx
NITF_ISCLAS=S
NITF_ISCLSY=xx
NITF_ISCLTX=
NITF_ISCODE=
NITF_ISCRSN=
NITF_ISCTLH=
NITF_ISCTLN=
NITF_ISDCDT=
NITF_ISDCTP=O
NITF_ISDCXM=
NITF_ISDG=
NITF_ISDGDT=
NITF_ISORCE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NITF_ISREL=xxxxx
NITF_ISSRDT=
NITF_ONAME=
NITF_OPHONE=
NITF_OSTAID=xxxxxxxxxx
NITF_PJUST=R
NITF_PVTYPE=INT
NITF_STYPE=BF01
NITF_TGTID=
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0,10464.0)
Upper Right ( 5120.0, 0.0)
Lower Right ( 5120.0,10464.0)
Center ( 2560.0, 5232.0)
Band 1 Block=512x512 Type=UInt16, ColorInterp=Gray
Convert it to a geotif directly…
gdal_translate -of GTiff myFile.ntf myFileConvertedToGeotif.tif
Input file size is 5120, 10464
0…10…20…30…40…50…60…70…80…90…100 - done.
Driver: GTiff/GeoTIFF
Files: myFileConvertedToGeotif.tif
Size is 5120, 10464
Coordinate System is `’
GCP Projection =
GEOGCS[“WGS 84”,
DATUM[“WGS_1984”,
SPHEROID[“WGS 84”,6378137,298.257223563,
AUTHORITY[“EPSG”,“7030”]],
AUTHORITY[“EPSG”,“6326”]],
PRIMEM[“Greenwich”,0],
UNIT[“degree”,0.0174532925199433],
AUTHORITY[“EPSG”,“4326”]]
GCP[ 0]: Id=1, Info=
(0.5,0.5) → (1.282,52.662,0)
GCP[ 1]: Id=2, Info=
(5119.5,0.5) → (1.306,52.662,0)
GCP[ 2]: Id=3, Info=
(5119.5,10463.5) → (1.3,52.633,0)
GCP[ 3]: Id=4, Info=
(0.5,10463.5) → (1.281,52.633,0)
Metadata:
AREA_OR_POINT=Area
NITF_ABPP=10
NITF_CCS_COLUMN=0
NITF_CCS_ROW=0
NITF_CLEVEL=06
NITF_ENCRYP=0
NITF_FBKGC=48, 48, 48
NITF_FDT=20150922084919
NITF_FHDR=NITF02.10
NITF_FSCATP=O
NITF_FSCAUT=xxxxxxx
NITF_FSCLAS=x
NITF_FSCLSY=xx
NITF_FSCOP=00000
NITF_FSCPYS=00000
NITF_FSDCTP=O
NITF_FSREL=xxxxx
NITF_FTITLE=For map demo
NITF_IALVL=0
NITF_IC=NC
NITF_ICAT=EO
NITF_ICORDS=D
NITF_IDATIM=20020718092742
NITF_IDLVL=1
NITF_IGEOLO=+52.662+001.282+52.662+001.306+52.633+001.300+52.633+001.281
NITF_IID1=B014.F0002
NITF_IID2=18JUL029Z0000012ZX0E0002ZZ000A385601160F/xxxx/xxxxxxxxx/xxxxxxxxxxxx/myOriginalFile.ntf
NITF_ILOC_COLUMN=0
NITF_ILOC_ROW=0
NITF_IMAG=1.0
NITF_IMODE=B
NITF_IREP=MONO
NITF_ISCATP=O
NITF_ISCAUT=xxxxxxx
NITF_ISCLAS=x
NITF_ISCLSY=xx
NITF_ISDCTP=O
NITF_ISORCE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
NITF_ISREL=xxxxx
NITF_OSTAID=xxxxxxxxxx
NITF_PJUST=R
NITF_PVTYPE=INT
NITF_STYPE=BF01
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0,10464.0)
Upper Right ( 5120.0, 0.0)
Lower Right ( 5120.0,10464.0)
Center ( 2560.0, 5232.0)
Band 1 Block=5120x1 Type=UInt16, ColorInterp=Gray
Notice above, the Corner Coordinates have not been populated. Why is this?
Now convert to Geotif via geoPDF…
gdal_translate -of PDF myOriginalFile.ntf myFile.pdf
Input file size is 5120, 10464
0Warning 6: PDF driver doesn’t support data type UInt16. Only eight bit byte bands supported.
…10…20…30…40…50…60…70…80…90…100 - done.
gdal_translate -of GTiff myFile.pdf myFileFromPDF.tif
Input file size is 5120, 10464
0…10…20…30…40…50…60…70…80…90…100 - done.
Driver: GTiff/GeoTIFF
Files: myFileFromPDF.tif
Size is 5120, 10464
Coordinate System is:
GEOGCS[“WGS 84”,
DATUM[“WGS_1984”,
SPHEROID[“WGS 84”,6378137,298.257223563,
AUTHORITY[“EPSG”,“7030”]],
AUTHORITY[“EPSG”,“6326”]],
PRIMEM[“Greenwich”,0],
UNIT[“degree”,0.0174532925199433],
AUTHORITY[“EPSG”,“4326”]]
GeoTransform =
1.283248067236511, 4.200039070130861e-06, -3.345120902227791e-07
52.66200138583578, -2.723374211124391e-18, -2.771671604700608e-06
Metadata:
AREA_OR_POINT=Area
DPI=72
NEATLINE=POLYGON ((1.282 52.662,1.281 52.633,1.3 52.633,1.306 52.662,1.282 52.662))
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 1.2832481, 52.6620014) ( 1d16’59.69"E, 52d39’43.20"N)
Lower Left ( 1.2797477, 52.6329986) ( 1d16’47.09"E, 52d37’58.80"N)
Upper Right ( 1.3047523, 52.6620014) ( 1d18’17.11"E, 52d39’43.20"N)
Lower Right ( 1.3012519, 52.6329986) ( 1d18’ 4.51"E, 52d37’58.80"N)
Center ( 1.2922500, 52.6475000) ( 1d17’32.10"E, 52d38’51.00"N)
Band 1 Block=5120x1 Type=Byte, ColorInterp=Red
Band 2 Block=5120x1 Type=Byte, ColorInterp=Green
Band 3 Block=5120x1 Type=Byte, ColorInterp=Blue
Notice that the corner coordinates have now been populated (albeit possible with errors introduced) - this file can be used by geoserver.
From: dany.geotools@…84… [mailto:dany.geotools@…84…] On Behalf Of Daniele Romagnoli
Sent: 21 October 2015 08:57
To: Smart, Gary Export License Required - US UTAS
Cc: Andrea Aime; geoserver-users@lists.sourceforge.net
Subject: [External] Re: [Geoserver-users] NITF files incorrectly georeferenced
Hi Gary,
please read below.
On Tue, Oct 20, 2015 at 1:02 PM, Smart, Gary Export License Required - US UTAS <Gary.Smart@…7257…> wrote:
OK – well if the geoserver mosaic function is not supposed to deal with random NITF files and re-warping images – how come if I convert them first to geotif (without warping the imagery) the mosaicing tool accepts them and produces a (approximate) rectified mosaic?
Again, as I said in the other thread, could you please provide us the gdalinfo output of this geotiff?
I think that gdal is doing some processing operation on the input NITF.
I’m sure this thing is designed to do what I want, but it just does not accept NITF files.
I notice that gdalinfo does not populate the geo-corners with the information from the IGEOLO but instead simply loads the image extent in pixel space, despite correctly populating the GCPs with lat/longs. gdalinfo is clearly showing the projection to be WGS84 EPSG:4326,
Could you please provide the gdalinfo output for both the original NITF and the produced GeoTIFF?
it knows where the corners are in lat long space, so why is this information not used by GDAL to populate the image corners used by geoserver?
(incidentally, “gdal_translate –of GTiff my.ntf aNew.tif” does not produce a valid georeferenced geotif.
What do you mean?
I had to go first convert to geo-pdf and then to geotif for some reason)
Not sure about this. Maybe the Geo-PDF driver does some hack.
Please, let us know.
Regards,
Daniele
From: andrea.aime@…84… [mailto:andrea.aime@…84…] On Behalf Of Andrea Aime
Sent: 22 September 2015 18:32
To: Smart, Gary Export License Required - US UTAS
Cc: Daniele Romagnoli; geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] [External] Re: NITF files incorrectly georeferencedOn Tue, Sep 22, 2015 at 7:16 PM, Smart, Gary Export License Required - US UTAS <Gary.Smart@…7257…> wrote:
I don’t think I have ever seen a NITF output from GDAL which reports anything on the line ‘Coordinate System is:’ – I was under the impression that the wealth of information below described the Coordinate System.
I was also under the impression that geoserver could import random NITF images (these are large NADIR views) and serve them through the WMS (i.e. presumably using GDAL to orthorectify the imagery en-route). To do this, I thought it used the four corner georeferencing clearly contained in this NITF file and all the others I have.
Is this not the case? I can see the images using the ‘layer preview’ tool, so I presume it can serve them somehow – and they look warped as required. But they just seem to be in the wrong place on the Earth!
Ha ha, you certainly made a large number of assumptions there :-p
No, GeoServer does does not do any ortorectification on the fly, gdal or not.
As Daniele suggested, you should fix those files using gdalwarp, so that they are truly rectified.
Or, if you really want GeoServer to follow the path you imagined, you can either add features to it yourself, the code is there for everybody, or check commercial support (http://geoserver.org/support/) to have someone do it for you
Cheers
Andrea
–
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://twitter.com/geosolutions_it
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
–
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
Ing. Daniele Romagnoli
Senior Software Engineer
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.