In general we read spatial reference details out of the GeoTiff header
(that is what makes it a GeoTIFF...). There must be a gap between what we
implement and the tags in the header you are using. The log cuts off before
I can see some kind of "caused by" detail in the stack trace ...

More detail/information would be required to determine if this is a bug in
GeoServer or the provided file.
--
Jody Garnett


On Thu, 15 Aug 2019 at 16:03, Marks, Constant <[email protected]>
wrote:

> I found that adding the prj file fixed this problem thanks to this python
> script written by Mersey Viking found below.
>
>
>
> My question then is why does geoserver need this file for some tifs and
> not for others?  Is there something about the header that is preventing
> geoserver from parsing the projection data?  If so why not add these osgeo
> methods to the geoserver package?
>
>
>
> # Written by MerseyViking (mersey dot viking at gmail dot com),
> 2011.
>
> # Released into the public domain - May 8, 2011
>
>
> # I accept no responsibility for any errors or loss of data, revenue, or
> life this script may cause. Use at your own risk.
>
>
>
>
> import osgeo.gdal as
> gdal
>
>
> import osgeo.osr as osr
>
>
> import
> os
>
>
> import glob
>
>
> import
> sys
>
>
>
>
>
> def generate_tfw(path,
> gen_prj):
>
>
>     for infile in glob.glob(os.path.join(path, '*.tif')):
>
>
>         src =
> gdal.Open(infile)
>
>
>         xform = src.GetGeoTransform()
>
>
>
>
>
>         if gen_prj == 'prj':
>
>
>             src_srs =
> osr.SpatialReference()
>
>
>             src_srs.ImportFromWkt(src.GetProjection())
>
>
>             src_srs.MorphToESRI()
>
>
>             src_wkt = src_srs.ExportToWkt()
>
>
>
>
>
>             prj = open(os.path.splitext(infile)[0] + '.prj', 'wt')
>
>
>             prj.write(src_wkt)
>
>
>             prj.close()
>
>             src = None
>
>            edit1=xform[0]+xform[1]/2
>
>            edit2=xform[3]+xform[5]/2
>
>
>
>            tfw = open(os.path.splitext(infile)[0] + '.tfw', 'wt')
>
>            tfw.write("%0.8f\n" % xform[1])
>
>            tfw.write("%0.8f\n" % xform[2])
>
>            tfw.write("%0.8f\n" % xform[4])
>
>            tfw.write("%0.8f\n" % xform[5])
>
>            tfw.write("%0.8f\n" % edit1)
>
>            tfw.write("%0.8f\n" % edit2)
>
>            tfw.close()
>
>
>
> if __name__ == '__main__':
>
>     generate_tfw(sys.argv[1], sys.argv[2])
>
>
>
>
>
> *From:* Marks, Constant
> *Sent:* Thursday, August 15, 2019 2:03 PM
> *To:* [email protected]
> *Subject:* Re: [Geoserver-users] Failed to Add Raster Data Source
>
>
>
> Hello all.   This may have come up before but I did not see a solution.
> Thank in advance for your help!
>
>
>
> I am struggling to add a GeoTiff raster file to Geoserver. After some
> transformations and adding color to the original GeoTiff (which would also
> not load) here are the details:
>
>
>
> *PERMISSIONS:*
>
> $ ls outputv2.tif -la
>
> -rw-rw-rw- 1 nvidia nvidia 207210997 Aug 15 13:46 outputv2.tif
>
>
>
> *GDALINFO:*
>
> $ gdalinfo outputv2.tif
>
> Driver: GTiff/GeoTIFF
>
> Files: outputv2.tif
>
> Size is 32410, 21019
>
> Coordinate System is:
>
> PROJCRS["WGS 84 / Pseudo-Mercator",
>
>     BASEGEOGCRS["WGS 84",
>
>         DATUM["World Geodetic System 1984",
>
>             ELLIPSOID["WGS 84",6378137,298.257223563,
>
>                 LENGTHUNIT["metre",1]]],
>
>         PRIMEM["Greenwich",0,
>
>             ANGLEUNIT["degree",0.0174532925199433]],
>
>         ID["EPSG",4326]],
>
>     CONVERSION["Popular Visualisation Pseudo-Mercator",
>
>         METHOD["Popular Visualisation Pseudo Mercator",
>
>             ID["EPSG",1024]],
>
>         PARAMETER["Latitude of natural origin",0,
>
>             ANGLEUNIT["degree",0.0174532925199433],
>
>             ID["EPSG",8801]],
>
>         PARAMETER["Longitude of natural origin",0,
>
>             ANGLEUNIT["degree",0.0174532925199433],
>
>             ID["EPSG",8802]],
>
>         PARAMETER["False easting",0,
>
>             LENGTHUNIT["metre",1],
>
>             ID["EPSG",8806]],
>
>         PARAMETER["False northing",0,
>
>             LENGTHUNIT["metre",1],
>
>             ID["EPSG",8807]]],
>
>     CS[Cartesian,2],
>
>         AXIS["easting (X)",east,
>
>             ORDER[1],
>
>             LENGTHUNIT["metre",1]],
>
>         AXIS["northing (Y)",north,
>
>             ORDER[2],
>
>             LENGTHUNIT["metre",1]],
>
>     USAGE[
>
>         SCOPE["unknown"],
>
>         AREA["World - 85°S to 85°N"],
>
>         BBOX[-85.06,-180,85.06,180]],
>
>     ID["EPSG",3857]]
>
> Data axis to CRS axis mapping: 1,2
>
> Origin = (-20037507.987483192235231,18434491.525901496410370)
>
> Pixel Size = (1236.473576745130231,-1236.511728912020544)
>
> Metadata:
>
>   AREA_OR_POINT=Area
>
> Image Structure Metadata:
>
>   COMPRESSION=PACKBITS
>
>   INTERLEAVE=PIXEL
>
> Corner Coordinates:
>
> Upper Left  (-20037507.987,18434491.526) (179d59'59.99"W, 83d38'22.73"N)
>
> Lower Left  (-20037507.987,-7555748.504) (179d59'59.99"W, 55d59'11.76"S)
>
> Upper Right (20036600.635,18434491.526) (179d59'30.65"E, 83d38'22.73"N)
>
> Lower Right (20036600.635,-7555748.504) (179d59'30.65"E, 55d59'11.76"S)
>
> Center      (    -453.676, 5439371.511) (  0d 0'14.67"W, 43d49'52.66"N)
>
> Band 1 Block=256x256 Type=Byte, ColorInterp=Red
>
>   Mask Flags: PER_DATASET ALPHA
>
> Band 2 Block=256x256 Type=Byte, ColorInterp=Green
>
>   Mask Flags: PER_DATASET ALPHA
>
> Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
>
>   Mask Flags: PER_DATASET ALPHA
>
> Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha
>
>
>
> *GEOSERVER ERROR LOG:*
>
> Caused by: java.io.IOException: Failed to create reader from
> file:///home/nvidia/Projects/onr/map_layers/GHS_SMOD_POP2015_GLOBE_R2016A_54009_1k_v1_0/outputv2.tif
> and hints Hints:
>
>   REPOSITORY       = org.geoserver.catalog.CatalogRepository@2c66076d
>
>
>   EXECUTOR_SERVICE =
> java.util.concurrent.ThreadPoolExecutor@61c35bab[Running, pool size = 0,
> active threads = 0, queued tasks = 0, completed tasks = 0]
>
> System defaults:
>
>   FORCE_LONGITUDE_FIRST_AXIS_ORDER =
> true
>
>   FILTER_FACTORY                   =
> FilterFactoryImpl
>
>   FORCE_AXIS_ORDER_HONORING        =
> http
>
>   LENIENT_DATUM_SHIFT              =
> true
>
>   FEATURE_FACTORY                  =
> org.geotools.feature.LenientFeatureFactoryImpl@66e8997c
>
>   STYLE_FACTORY                    =
> StyleFactoryImpl
>
>   COMPARISON_TOLERANCE             =
> 1.0E-8
>
>   GRID_COVERAGE_FACTORY            =
> GridCoverageFactory
>
>     TILE_ENCODING                  =
> null
>
>
>
>                at
> org.geoserver.catalog.ResourcePool.getGridCoverageReader(ResourcePool.java:1492)
>
>                at
> org.geoserver.catalog.ResourcePool.getGridCoverageReader(ResourcePool.java:1436)
>
>                at
> org.geoserver.catalog.impl.CoverageStoreInfoImpl.getGridCoverageReader(CoverageStoreInfoImpl.java:53)
>
>                at
> jdk.internal.reflect.GeneratedMethodAccessor426.invoke(Unknown Source)
>
>                at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
>                at
> java.base/java.lang.reflect.Method.invoke(Method.java:566)
>
>                at
> org.geoserver.catalog.impl.ModificationProxy.invoke(ModificationProxy.java:127)
>
>                at com.sun.proxy.$Proxy35.getGridCoverageReader(Unknown
> Source)
>
>                at
> org.geoserver.web.data.layer.NewLayerPageProvider.getItemsInternal(NewLayerPageProvider.java:86)
>
>                ... 140 more
>
>
> *Constant Marks *Research Assistant | Computer Science and Engineering
> University of North Texas
>
> Office: Discovery Parks F216
> e: [email protected]
> t: (303) 482 7292
>
>
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to