Hey, The programm is:
------------- import org.geotools.referencing.CRS; import org.opengis.referencing.FactoryException; import org.opengis.referencing.crs.CoordinateReferenceSystem; public class Test { public static void main(String[] args) { Test test = new Test(); test.run(); } public void run() { try { CoordinateReferenceSystem crs = CRS.decode("EPSG:4326"); if (CRS.getProjectedCRS(crs).equals(null)) { System.out.println("Spherical"); } else { System.out.println("Cartographic"); } } catch (FactoryException e) { System.out.println("CRS Decode went wrong: " + e.getMessage()); } } } ------------- Regards, Jochen Am Mittwoch 04 Januar 2017 11:44:37 schrieben Sie: > Can you share a self contained program replicating such NPE? > > Cheers > Andrea > > On Wed, Jan 4, 2017 at 11:41 AM, Jochen Saalfeld <joc...@intevation.de> > > wrote: > > Hi there, > > > > unfortunately, this results in a NullPointerException. > > > > Regards, > > Jochen > > > > Am Dienstag 03 Januar 2017 13:36:18 schrieben Sie: > > > Hi, > > > if I understand correctly what you want, I'd call > > > > CRS.getProjectedCRS(crs) > > > > > and check > > > if the result is null (which I believe is your spherical case, in > > > > geotools > > > > > they are called > > > GeographicCRS) or projected (which seems to match your notion of > > > cartographic) > > > > > > Cheers > > > Andrea > > > > > > > > > On Tue, Jan 3, 2017 at 11:56 AM, Jochen Saalfeld <joc...@intevation.de> > > > > > > wrote: > > > > Hi, > > > > > > > > In the last couple of days I fiddled around with checking when a CRS > > > > Object is cartographic or spherical, but it seems, that there is no > > > > built-in Function for that. I have a CoordinateReferenceSystem Object > > > > and want to determine if that CRS is spherical or not. The task > > > > itself seems rather simple, but I didn't find a suitable solution. I > > > > hope some of you may can help or refer to a solution. > > > > > > > > Kind regards, > > > > Jochen > > > > > > > > > > > > > > > > ------------------------------------------------------------ > > > > ------------------ > > > > Check out the vibrant tech community on one of the world's most > > > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > > > > _______________________________________________ > > > > GeoTools-GT2-Users mailing list > > > > GeoTools-GT2-Users@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > > > -- > > joc...@intevation.de | intevation.de/ | 0541335083214 | PGPkey: > > 0x64B67DF4 Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG > > Osnabrueck, HR B 18998 > > Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner -- joc...@intevation.de | intevation.de/ | 0541335083214 | PGPkey: 0x64B67DF4 Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG Osnabrueck, HR B 18998 Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users