Solved!!

1) I added a .prj file with the projection definition as suggested

2) I had used a copy-paste example:

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

Of course, with a FileInputStream as source, the prj file will not be used.

        new GeoTiffReader(new File(fileName));

now works !

Thank you to everyone !


On 06/03/2019 10:56, Peter wrote:
> Dear All,
>
> I started to debug GeoTiffReader.
>
> metadata.getGeoKey(GeoTiffConstants.GTModelTypeGeoKey)
>
> gives 32767
>
> so that this fails:
>
>   crs = gtcs.createCoordinateSystem(metadata);
>
>
> However, I can't find where this geokey in the metadata is
> set/transformed. Any hints?
>
> Thank you! Peter
>
>
>
> On 06/03/2019 10:24, Peter wrote:
>> 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
>>>
>
>
>
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


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

Reply via email to