【问题标题】:Converting KML files to geoJson in java在java中将KML文件转换为geoJson
【发布时间】:2017-01-29 23:01:46
【问题描述】:

我正在尝试按照 Convert Kml with multiple features to Geojson 将 KML 文件转换为 geoJson 文件。 但是,我无法将 jars 作为包含以下类的 maven 依赖项。 KML配置 FeatureJSON。

下面是我的 pom.xml:

http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.test.data 转换器 0.0.1-快照 原型 - 转换器 http://maven.apache.org

<dependencies>
    <!-- https://mvnrepository.com/artifact/pull-parser/pull-parser -->
    <dependency>
        <groupId>pull-parser</groupId>
        <artifactId>pull-parser</artifactId>
        <version>2.1.10</version>
    </dependency>
    <dependency>
        <groupId>org.geotools.xsd</groupId>
        <artifactId>gt-xsd-core</artifactId>
        <version>9.3</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.owasp.encoder/encoder -->
    <dependency>
        <groupId>org.owasp.encoder</groupId>
        <artifactId>encoder</artifactId>
        <version>1.1.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/commons-configuration/commons-configuration -->
    <dependency>
        <groupId>commons-configuration</groupId>
        <artifactId>commons-configuration</artifactId>
        <version>1.6</version>
    </dependency>
    <dependency>
        <groupId>org.opengis</groupId>
        <artifactId>geoapi</artifactId>
        <version>3.0.0</version>
    </dependency>

</dependencies>
<repositories>
    <repository>
        <id>maven2-repository.dev.java.net</id>
        <name>Java.net repository</name>
        <url>http://download.java.net/maven/2</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>
    <repository>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <id>boundless</id>
        <name>Boundless Maven Repository</name>
        <url>http://repo.boundlessgeo.com/main</url>
    </repository>
</repositories>

【问题讨论】:

    标签: java kml geojson


    【解决方案1】:

    我也遵循该指南并设法整理出 Maven 部门。这是我的依赖项:

    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-main</artifactId>
        <version>${geotools.version}</version>
    </dependency>
    <dependency>
        <groupId>org.geotools.xsd</groupId>
        <artifactId>gt-xsd-core</artifactId>
        <version>${geotools.version}</version>
    </dependency>
    <dependency>
        <groupId>org.geotools.xsd</groupId>
        <artifactId>gt-xsd-kml</artifactId>
        <version>${geotools.version}</version>
    </dependency>
    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-geojson</artifactId>
        <version>${geotools.version}</version>
    </dependency>
    

    带仓库

    <repository>
        <id>boundlessgeo.com</id>
        <url>http://repo.boundlessgeo.com/main/</url>
    </repository>
    <repository>
        <id>download.osgeo.org</id>
        <url>http://download.osgeo.org/webdav/geotools/</url>
    </repository>
    

    和属性

    <geotools.version>17.2</geotools.version>
    

    抱歉回复晚了(顺便说一句,不到一年:D)。

    希望对你有帮助。

    【讨论】:

    • 使用这些依赖,我得到了这个:error: cannot access XMLStreamException class file for javax.xml.stream.XMLStreamException not found
    • 看起来您缺少一个部门。尝试“Maven 更新”或显式添加此依赖项:mvnrepository.com/artifact/javax.xml.stream/stax-api
    猜你喜欢
    • 2013-04-09
    • 1970-01-01
    • 2020-07-16
    • 1970-01-01
    • 2015-12-23
    • 1970-01-01
    • 2020-03-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多