Dear Andrea,

I tried all possible combinations of gt-epsg-wkt and/or gt-epsg-wkt.

What I don't understand:
I add the defintion to the ReferencingFactory and
CRS.decode("EPSG:54009")
prints correctly.

But GeoTiffReader seems not to pick it up.
Do I have to give "hints" to the GeoTiffReader about the registered Epsg
definition ?

My code


URL epsg = getClass().getClassLoader().getResource("epsg.properties");

Hints hints = new Hints(Hints.CRS_AUTHORITY_FACTORY,
PropertyAuthorityFactory.class);
ReferencingFactoryContainer referencingFactoryContainer =
ReferencingFactoryContainer.instance(hints);
PropertyAuthorityFactory factory;
factory = new PropertyAuthorityFactory(referencingFactoryContainer,
Citations.fromName("EPSG"), epsg);
ReferencingFactoryFinder.addAuthorityFactory(factory);
ReferencingFactoryFinder.scanForPlugins();

System.out.println(CRS.decode("EPSG:54009"));

String fileName =
"xxx/Downloads/pop/GHS_POP_GPW42015_GLOBE_R2015A_54009_1k_v1_0.tif";


new GeoTiffReader(new FileInputStream(new File(fileName)));




On 06/03/2019 10:11, Andrea Aime wrote:
> Just to be sure, which EPSG plugin do you have in the classpath?
> You need to have one, probably works best with gt-epsg-hsql
>
> Cheers
> Andrea
>
> On Wed, Mar 6, 2019 at 10:08 AM Peter <dojouserpe...@orange.fr
> <mailto:dojouserpe...@orange.fr>> wrote:
>
>     Dear Daniele,
>
>     thank you for the hint! Unfortunately, that didn't help.
>     I also added the definition to the CRS factory and CRS.decode()
>     works fine. But still the same error.
>     I have put all information on
>     
> https://gis.stackexchange.com/questions/314421/geotiff-geotools-mollweide-customer-projection-not-recognized
>
>     Any idea ?
>     Thank you!
>     Peter
>
>
>     On 05/03/2019 14:25, Daniele Romagnoli wrote:
>>     Dear Peter,
>>     you may want to try to put a
>>     GHS_POP_GPW42015_GLOBE_R2015A_54009_1k_v1_0.prj file right beside
>>     your tiff data,
>>     containing this text:
>>     PROJCS["World_Mollweide", 
>>       GEOGCS["GCS_WGS_1984", 
>>         DATUM["D_WGS_1984", 
>>           SPHEROID["WGS_1984", 6378137.0, 298.257223563]], 
>>         PRIMEM["Greenwich", 0.0], 
>>         UNIT["degree", 0.017453292519943295], 
>>         AXIS["Longitude", EAST], 
>>         AXIS["Latitude", NORTH]], 
>>       PROJECTION["Mollweide"], 
>>       PARAMETER["semi_minor", 6378137.0], 
>>       PARAMETER["false_easting", 0.0], 
>>       PARAMETER["false_northing", 0.0], 
>>       PARAMETER["central_meridian", 0.0], 
>>       UNIT["m", 1.0], 
>>       AXIS["x", EAST], 
>>       AXIS["y", NORTH], 
>>       AUTHORITY["EPSG","54009"]]
>>     By this way, the GeoTIFF reader will override the CRS parsing,
>>     reading the projection from the .prj definition.
>>     Please, let us know if that solves the problem.
>>
>>     Regards,
>>     Daniele
>>
>>
>>     On Sun, Mar 3, 2019 at 11:47 AM Peter <dojouserpe...@orange.fr
>>     <mailto:dojouserpe...@orange.fr>> wrote:
>>
>>         Dear All,
>>
>>         I must read population data from a GeoTiff Grid.
>>
>>         The following throws a runtime error
>>
>>         GridCoverage2D image  = new GeoTiffReader(f)
>>
>>         Error message:
>>         GeoTiffMetadata2CRSAdapter::createCoordinateSystem:Only
>>         Geographic & Projected Systems are supported.
>>
>>         Is there a way to convert the tiff file ? Below is the
>>         gdalinfo. Thank
>>         you ! Peter
>>
>>         Driver: GTiff/GeoTIFF
>>         Files: GHS_POP_GPW42015_GLOBE_R2015A_54009_1k_v1_0.tif
>>                GHS_POP_GPW42015_GLOBE_R2015A_54009_1k_v1_0.tif.ovr
>>                GHS_POP_GPW42015_GLOBE_R2015A_54009_1k_v1_0.tif.aux.xml
>>         Size is 35497, 15236
>>         Coordinate System is:
>>         PROJCS["World_Mollweide",
>>             GEOGCS["GCS_WGS_1984",
>>                 DATUM["D_WGS_1984",
>>                     SPHEROID["WGS_1984",6378137.0,298.257223563]],
>>                 PRIMEM["Greenwich",0.0],
>>                 UNIT["Degree",0.017453292519943295]],
>>             PROJECTION["Mollweide"],
>>             PARAMETER["False_Easting",0.0],
>>             PARAMETER["False_Northing",0.0],
>>             PARAMETER["Central_Meridian",0.0],
>>             UNIT["Meter",1.0]]
>>         Origin = (-17619594.547443531453609,8751029.461868489161134)
>>         Pixel Size = (1000.000000000000000,-1000.000000000000000)
>>         Metadata:
>>           AREA_OR_POINT=Area
>>         Image Structure Metadata:
>>           COMPRESSION=LZW
>>           INTERLEAVE=BAND
>>         Corner Coordinates:
>>         Upper Left  (-17619594.547, 8751029.462) (  5d15'16.97"W,
>>         83d38'22.73"N)
>>         Lower Left  (-17619594.547,-6484970.538) (107d 3'58.73"E,
>>         55d59' 2.97"S)
>>         Upper Right (17877405.453, 8751029.462) ( 15d52' 0.05"E,
>>         83d38'22.73"N)
>>         Lower Right (17877405.453,-6484970.538) (103d21'55.35"W,
>>         55d59' 2.97"S)
>>         Center      (  128905.453, 1133029.462) (  1d17'47.25"E, 
>>         9d10'43.07"N)
>>
>>
>>
>>
>>
>>
>>
>>
>>         _______________________________________________
>>         GeoTools-GT2-Users mailing list
>>         GeoTools-GT2-Users@lists.sourceforge.net
>>         <mailto:GeoTools-GT2-Users@lists.sourceforge.net>
>>         https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>>
>>
>>     -- 
>>     Regards,
>>     Daniele Romagnoli
>>     ==
>>     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 di Montramito 3/A
>>     55054  Massarosa (LU)
>>     Italy
>>     phone: +39 0584 962313
>>     fax:      +39 0584 1660272
>>
>>     http://www.geo-solutions.it
>>     http://twitter.com/geosolutions_it
>>
>>     -------------------------------------------------------
>>
>>     Con riferimento alla normativa sul trattamento dei dati personali
>>     (Reg. UE 2016/679 - Regolamento generale sulla protezione dei
>>     dati “GDPR”), si precisa che ogni circostanza inerente alla
>>     presente email (il suo contenuto, gli eventuali allegati, etc.) è
>>     un dato la cui conoscenza è riservata al/i solo/i destinatario/i
>>     indicati dallo scrivente. Se il messaggio Le è giunto per errore,
>>     è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le
>>     sarei comunque grato se potesse darmene notizia.
>>
>>     This email is intended only for the person or entity to which it
>>     is addressed and may contain information that is privileged,
>>     confidential or otherwise protected from disclosure. We remind
>>     that - as provided by European Regulation 2016/679 “GDPR” -
>>     copying, dissemination or use of this e-mail or the information
>>     herein by anyone other than the intended recipient is prohibited.
>>     If you have received this email by mistake, please notify us
>>     immediately by telephone or e-mail.
>
>
>     _______________________________________________
>     GeoTools-GT2-Users mailing list
>     GeoTools-GT2-Users@lists.sourceforge.net
>     <mailto:GeoTools-GT2-Users@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
> -- 
>
> Regards, Andrea Aime == 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 di
> Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39
> 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
> ------------------------------------------------------- /Con
> riferimento alla normativa sul trattamento dei dati personali (Reg. UE
> 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
> precisa che ogni circostanza inerente alla presente email (il suo
> contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
> riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
> messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
> operazione è illecita. Le sarei comunque grato se potesse darmene
> notizia. This email is intended only for the person or entity to which
> it is addressed and may contain information that is privileged,
> confidential or otherwise protected from disclosure. We remind that -
> as provided by European Regulation 2016/679 “GDPR” - copying,
> dissemination or use of this e-mail or the information herein by
> anyone other than the intended recipient is prohibited. If you have
> received this email by mistake, please notify us immediately by
> telephone or e-mail./
>

_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to