- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在处理一个简单的任务:使用
从 EPSG 代码创建CoordinateReferenceSystem
String code = "26910";
CoordinateReferenceSystem crs = ReferencingFactoryFinder.getCRSAuthorityFactory
("EPSG",null).createCoordinateReferenceSystem(code);
此代码段产生:
`Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.hsqldb.lib.FrameworkLogger
at org.hsqldb.persist.Logger.getEventLogger(Unknown Source)
at org.hsqldb.persist.Logger.logInfoEvent(Unknown Source)
at org.hsqldb.persist.Logger.closePersistence(Unknown Source)
at org.hsqldb.Database.reopen(Unknown Source)
at org.hsqldb.Database.open(Unknown Source)
at org.hsqldb.DatabaseManager.getDatabase(Unknown Source)
at org.hsqldb.DatabaseManager.newSession(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCDriver.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDataSource.getConnection(Unknown Source)
at org.hsqldb.jdbc.JDBCDataSource.getConnection(Unknown Source)
at org.geotools.referencing.factory.epsg.DirectEpsgFactory.getConnection(DirectEpsgFactory.java:3196)
at org.geotools.referencing.factory.epsg.ThreadedEpsgFactory.createBackingStore(ThreadedEpsgFactory.java:436)
at org.geotools.referencing.factory.DeferredAuthorityFactory.getBackingStore(DeferredAuthorityFactory.java:133)
at org.geotools.referencing.factory.BufferedAuthorityFactory.isAvailable(BufferedAuthorityFactory.java:235)
at org.geotools.referencing.factory.DeferredAuthorityFactory.isAvailable(DeferredAuthorityFactory.java:119)
at org.geotools.factory.FactoryRegistry.isAvailable(FactoryRegistry.java:667)
at org.geotools.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:501)
at org.geotools.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:437)
at org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:365)
at org.geotools.factory.FactoryCreator.getServiceProvider(FactoryCreator.java:145)
at org.geotools.referencing.ReferencingFactoryFinder.getAuthorityFactory(ReferencingFactoryFinder.java:220)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactory(ReferencingFactoryFinder.java:440)`
我对使用 hsqldb 很感兴趣。 hsqldb-2.2.8.jar 在 CLASSPATH 中。我应该如何在 Java 代码中组织数据库连接?
更新
我的主要目标是使用 GeoTools 处理坐标转换,但这似乎并不容易。请查看下面的错误代码:
import org.geotools.referencing.CRS;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import org.geotools.geojson.geom.GeometryJSON;
import com.vividsolutions.jts.geom.Geometry;
import org.geotools.geometry.jts.*;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
//------------------------------
CoordinateReferenceSystem sourceCRS = null;
CoordinateReferenceSystem targetCRS = null;
try {
sourceCRS = CRS.decode("epsg:4326");
System.out.println("SOURCE \n" + sourceCRS);
targetCRS = CRS.decode("epsg:23032");
System.out.print("\nTARGET \n" + targetCRS);
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, true);
GeometryJSON jsonReader = new GeometryJSON();
Geometry sourceGeometry = jsonReader.read(new FileInputStream("simple-geometry.json"));
System.out.println("\n" + sourceGeometry.getCoordinate().toString());
//the problem's here
Geometry targetGeometry = JTS.transform(sourceGeometry, transform);
} catch (FactoryException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
问题是我的 IDE 无法解析 JTS.transform(/.../).
我在 CLASSPATH 中有 gt-epsg-hsql-13.0、gt-geojson-13.0、gt-jts-wrapper-13.0、gt-opengis-13.0、gt-referencing-13.0、jts-1.13。
我的 pom.xml 是:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>geotools_test_3</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
<version>${geotools.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
有人知道问题出在哪里吗?
最佳答案
生成坐标系的最简单方法是使用以下代码:
CoordinateReferenceSystem crs = null;
try {
crs = CRS.decode("epsg:26910");
System.out.println("got "+crs);
} catch (FactoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
确保您的 pom 文件中包含以下内容
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geotools.version}</version>
</dependency>
关于java - 使用 GeoTools 坐标投影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30619092/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
我也是 Geotools 和 Maven 的新手。我尝试了快速入门来开始使用地理工具,一切都运行良好,直到我尝试创建示例应用程序。所有以 org.geotools 开头的导入都被标记为不存在。查找依赖
我目前正在使用 GeoTools 工具包对海洋船只数据进行计算,例如计算两个经/纬度点之间的大圆距离。我还有两个需要满足的其他要求,但我不确定在 GeoTools 中的什么地方可以找到执行此类计算的类
我正在研究一个Java项目,该项目需要将WGS84转换为UMT。我使用geotools v20.5通过以下代码创建了一个转换: transform = CRS.findMathTransform(
有人可以告诉我如何通过 java geotools api 获取特征的顶点吗? 就我而言,我在postgis中有一个多边形层,我可以查询该层的所有特征,并且我需要知道每个特征的顶点。
我正在使用 geotools.js 将操作系统网格引用转换为纬度和经度。不幸的是,默认情况下(我相信)输出限制为小数点后两位。为了更准确的读数,我需要它是小数点后 5 位。 我尝试在自己的代码中删除对
我正在使用 geotools 库。我的目标是输入一个坐标,然后获取包含它的要素信息。 Geotools Quickstart 教程的 map 完全按照我想要的方式使用我在下面用红色圈出的按钮。但是,我
我正在使用 GeoTools Java 库进行一些几何计算。就我而言,我使用的是一个形状文件,其中包含某个城市的所有邻域多面体。我想知道那个城市的每一个可能的坐标,它对应于哪个街区。所以我的方法是简单
我正在使用 Java Geotools 库来检查 POINT(...) 是否包含在 POLYGON(...) 中。 我已经完成了: Geometry sPG = reader.read(wktStar
本文整理了Java中org.geotools.util.WeakCollectionCleaner类的一些代码示例,展示了WeakCollectionCleaner类的具体用法。这些代码示例主要来源于
本文整理了Java中org.geotools.resources.XArray类的一些代码示例,展示了XArray类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Mave
本文整理了Java中org.geotools.resources.XMath类的一些代码示例,展示了XMath类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等
本文整理了Java中org.geotools.xs.XSSchema类的一些代码示例,展示了XSSchema类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平
本文整理了Java中org.geotools.ysld.Ysld类的一些代码示例,展示了Ysld类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些
本文整理了Java中org.geotools.ysld.YamlSeq类的一些代码示例,展示了YamlSeq类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平
本文整理了Java中org.geotools.ysld.YamlUtil类的一些代码示例,展示了YamlUtil类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 6 个月前关闭。 Improve
我正在实现轨迹点的插值。所以,基本上,我需要沿着从起点到终点的方位角创建几个点。问题是,我无法将创建的点添加到集合中: SimpleFeatureType featureType = featureS
我有很多点导致 getOrthodromicDistance 方法在 geotools lib 中失败并出现异常,而这些点是有效的经纬度点: 抛出异常的点(纬度,经度): val p1= (5.318
我是一名优秀的程序员,十分优秀!