java - Java 中的 SchemaException

标签 java maven geotools

我找到了一个有用的工具,可以使用 geotools 将 .csv 文件转换为形状文件。 :

但是我在运行它时遇到了问题,我得到了以下 maven 错误:

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project tutorial: Command execution failed. Process exited with an error: 1 (Exit value: 1)

这一行有一个错误:

final SimpleFeatureType TYPE = DataUtilities.createType(
                "Location",                   // <- the name for our feature type
                "location:Point:srid=4326," + // <- the geometry attribute: Point type
                "name:String"         // <- a String attribute
        );

错误:

Exception in thread "main" org.geotools.feature.SchemaException: Error decoding srs

我的 POM 文件是这样的:

<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>org.geotools</groupId>
    <artifactId>tutorial</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>tutorial</name>
    <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <geotools.version>11-SNAPSHOT</geotools.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-shapefile</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.geotools</groupId>
            <artifactId>gt-swing</artifactId>
            <version>${geotools.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>maven3-repository.dev.java.net</id>
            <name>Java.net repository</name>
            <url>http://download.java.net/maven/3</url>
        </repository>
        <repository>
            <id>osgeo</id>
            <name>Open Source Geospatial Foundation Repository</name>
            <url>http://download.osgeo.org/webdav/geotools/</url>
        </repository>
    <repository> <!--Add the snapshot repository here-->
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <id>opengeo</id>
        <name>OpenGeo Maven Repository</name>
        <url>http://repo.opengeo.org</url>
    </repository>
  </repositories>    
</project>

我在 Win8.1 上使用 Maven 3.1。

我希望有人能帮助我!

最佳答案

我刚刚遇到了同样的问题。也许这会在将来帮助某人。 将此添加到您的 pom.xml:

<dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-epsg-hsql</artifactId>
        <version>${geotools.version}</version>
</dependency>

关于java - Java 中的 SchemaException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19356113/

相关文章:

maven - 由于 Geotools Maven 库 : "SEVERE: A child container failed during start",Tomcat 无法启动

Java快速查找点是否落在国家(多边形)内的方法

java - 主线程抛出异常时停止后台线程

java.lang.IncompleteClassChangeError : the number of constructors

maven - 无法使用 Maven 从 XSD 文件生成源文件?

javascript - 管理 Web 组件的依赖关系; JS、CSS/SASS 和模板文件

java - 生成 WSDL 时删除 Nillable ="true"

java - 使用 throws 关键字并在 main 中处理它,而不是在它发生的方法中处理它

Maven 缺少 Artifact com.sun.jndi.ldap。怎么了?

java - Geotools 无法解析具有自定义属性的 GeoJSON 文件