5

I'm trying to make a GeoTIFF using geotifcp, which I'll then upload to GeoServer.

I've got an image overlay (part of a .kml) in Google Earth, so I tried to use its bounding box to create a world file, which I could then feed to geotifcp.

In GeoServer, I've set the declared coordinate reference system to EPGS:4326, which I understand to match Google Earth. To upload the GeoTIFF to GeoServer, though, I need to also specify the native coordinate reference system of the GeoTIFF, which I should be able to do with geotifcp using a proj4 string.

From here, I got the proj4 string that should match Google Earth:

+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs  

But when I use that with geotifcp,

geotifcp -e image.tfw -4 "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs" image.tif geotiff_image.tif

it returns this error:

mode=w
Failure in GTIFSetFromProj4

What am I doing wrong?

  • 1
    what are you using geotifcp to achieve? and why are you adding a mercator projection string? GeoServer will read a tiff+world file or you could use gdaltransform to make a geotiff – Ian Turton Jul 16 at 8:10
  • @IanTurton All I need in the end is a geotiff. I have an image overlay in Google Earth with the right alignment. I guess if geotifcp isn't the right tool, I don't quite know how to do that. – Numeri Jul 16 at 19:12
  • I was trying to add a projection string because GeoServer said it was reading the tiff in as a "wildcard 2-dimensional coordinate reference system" (I believe), and as I understand, GeoServer would have to know what projection the coordinates in the geotiff (or world file) are in. – Numeri Jul 16 at 19:14
2
+50

There are a number of ways you can add your raster to GeoServer, all of these require you to know what the projection of your data is (probably EPSG:4326 or WGS84 lat/lon).

  1. Possibly the simplest, just tell GeoServer what the projection is after adding the data to the store. When you publish the layer simply fill in the declared SRS as EPSG:4326 and select force declared underneath. GeoServer will ignore it's "native" SRS guess and use your information.

  2. You can convert your tiff + world file into a GeoTiff using GDAL's gdal_translate again you need to tell GDAL what projection you are using.

    gdal_translate -a_srs original.tif newgeotif.tif 
    
  3. You can provide a .prj file which contains the WKT representation of the projection you need - you can download these from http://epgs.io so yours would this. Like the .wld file this side car file can be read by other programs to tell them what the projection is.

1

This is the projection you are looking for

https://spatialreference.org/ref/epsg/4326/

which has the following proj4 string

+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs

1

use proj4 string of EPSG:4326 in geotifcp

+proj=longlat +datum=WGS84 +no_defs


Also I suggest to use GDAL_TRANSLATE to create GeoTIFF which can be used directly in Geoserver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.