0

I'm using geotools.version = 20.0.

After debugging the set reference system functionality, the following is executed but the codes list is empty:

CRSAuthorityFactory fac =ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", null);
Set<String> codes = fac.getAuthorityCodes(CoordinateReferenceSystem.class);

If I pass "CRS" to the getCRSAuthorityFactory instead, the codes list is not empty.

I've included the gt-epsg-hsql dependency and the org.apache.maven.plugins.shade.resource.ServicesResourceTransformer transformer in my pom.xml file.

I tried adding the gt-eqsg-hsql JAR file in the CLASSPATH as well as the folder extracted from the jar containing the database (the EPSG directory containing EPSG.data, EPSG.properties, and EPSG.script).

Am I still missing something or is this functionality broken?

  • how are you running your application? does the user have write permission to java.tempdir? – Ian Turton Oct 19 '18 at 8:04
  • java.io.tmpdir is set to C:\Users\<user>\AppData\Local\Temp\1 and read/write is allowed. I also verified the database files exist in that directory. – ccarlow Oct 19 '18 at 15:29
1

I determined what is causing the issue. I loaded some geoserver (gs-platform, gs-wms, gs-main) in maven just to use the legend generator for styles. Apparently gs-main causes a conflict because the following ends up being used when the backingStore of the AuthorityFactory is being generated: jar:file:org/geoserver/gs-main/2.14.0/gs-main-2.14.0.jar!/org/vfny/geoserver/crs/override_epsg.properties

Once I removed the geoserver modules from maven the EPSG reference system list was populated. I saw that geotools has some classes for handling the legend so I will try to use those instead of relying on geoserver which may ultimately just be using those classes. If not then I'll have to figure out how allow the EPSG list to be populated even if geoserver modules are loaded.

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.