我有一个Java geotools程序可以在两个坐标系之间转换坐标。它尝试在坐标系ESPG:4326和ESPG:5179之间进行转换。
尝试在我的代码中执行此行时收到以下异常:
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
Exception in thread "main" org.opengis.referencing.NoSuchAuthorityCodeException: No code "EPSG:4326" from authority "EPSG" found for object of type "EngineeringCRS".
at org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.noSuchAuthorityException(CartesianAuthorityFactory.java:137)
at org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.createEngineeringCRS(CartesianAuthorityFactory.java:129)
at org.geotools.referencing.factory.epsg.CartesianAuthorityFactory.createCoordinateReferenceSystem(CartesianAuthorityFactory.java:120)
at org.geotools.referencing.factory.AuthorityFactoryAdapter.createCoordinateReferenceSystem(AuthorityFactoryAdapter.java:780)
at org.geotools.referencing.factory.ThreadedAuthorityFactory.createCoordinateReferenceSystem(ThreadedAuthorityFactory.java:636)
at org.geotools.referencing.DefaultAuthorityFactory.createCoordinateReferenceSystem(DefaultAuthorityFactory.java:177)
at org.geotools.referencing.CRS.decode(CRS.java:517)
at org.geotools.referencing.CRS.decode(CRS.java:440)
at main.main(main.java:13)
我的测试程序:
import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;
import org.locationtech.jts.geom.Coordinate;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import javax.xml.crypto.dsig.TransformException;
public class main {
public static void main(String[] args) throws Exception {
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:5179");
double coordinateX = 1307285;
double coordinateY = 2229260;
Coordinate in = new Coordinate(coordinateX, coordinateY);
Coordinate out = in;
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
Coordinate result = JTS.transform(in, out, transform);
result.toString();
}
}
我的build.gradle:
plugins {
id 'java'
}
repositories {
flatDir {
dirs 'libs'
}
maven {
url "http://download.osgeo.org/webdav/geotools/"
}
mavenCentral()
}
dependencies {
implementation group: 'org.geotools', name: 'gt-main', version: '20.2'
implementation('org.geotools:gt-referencing:20.2') {
exclude group: 'javax.units', module: 'jsr108'
}
files('libs/js4108-0.01.jar')
}
我认为依靠gt-main
和gt-referencing
就足够了。
答案 0 :(得分:1)
我需要添加以下依赖
http://localhost:5984/<db>/_design/<design_name>/_view/<view_name>?include_docs=true&inclusive_end=true&start_key=%5B%22asset%22%2Cnull%5D&end_key=%5B%22asset%22%2C%7B%7D%5D
中