]> git.argeo.org Git - gpl/argeo-suite.git/blob - geo/JTS.java
Prepare next development cycle
[gpl/argeo-suite.git] / geo / JTS.java
1 package org.argeo.app.geo;
2
3 import org.argeo.api.cms.CmsLog;
4 import org.locationtech.jts.geom.GeometryFactory;
5 import org.locationtech.jts.geom.PrecisionModel;
6
7 /**
8 * Factories initialisation and workarounds for the JTS library. The idea is to
9 * code defensively around factory initialisation, API changes, and issues
10 * related to running in an OSGi environment. Rather see {@link GeoUtils} for
11 * functional static utilities.
12 */
13 public class JTS {
14 private final static CmsLog log = CmsLog.getLog(JTS.class);
15
16 public final static int WGS84_SRID = 4326;
17
18 /** A geometry factory with no SRID specified */
19 public final static GeometryFactory GEOMETRY_FACTORY;
20 /** A geometry factory with SRID 4326 (WGS84 in the EPSG database) */
21 public final static GeometryFactory GEOMETRY_FACTORY_WGS84;
22
23 static {
24 try {
25 GEOMETRY_FACTORY = new GeometryFactory();
26 GEOMETRY_FACTORY_WGS84 = new GeometryFactory(new PrecisionModel(), WGS84_SRID);
27 } catch (RuntimeException e) {
28 log.error("Basic JTS initialisation failed, geographical utilities are probably not available", e);
29 throw e;
30 }
31 }
32
33 }