0

I am trying to export a JTS object to a KML file. I found here that this could be done using the Encoder class, however I can't seem to find the jar file that contains the given class.

I am using maven, adding a repository is not an option, I must have all the jars used in the company repository so I would like to install the specific jar as a maven artifact manually.

I looked on the Geotools repository, in org/geotools/xml/9.3/gt-xml and in org/geotools/xml/9.3/gt-xsd-kml but I didn't find it.

Please help me.

Zoltán
  • 21,321
  • 14
  • 93
  • 134
  • 1
    maven should pull them in automatically - can you post your pom file? – Ian Turton Jun 25 '13 at 12:28
  • I didn't think of adding the third-party repository locally because all the jars should be available in our company repository. I did this now, and I still had to do a little bit of guessing, but I finally found it. Thanks @iant. – Zoltán Jun 26 '13 at 08:03

1 Answers1

4

I finally found it. The class is in gt-xsd-core.jar. The required maven dependency is

<dependency>
    <groupId>org.geotools.xsd</groupId>
    <artifactId>gt-xsd-core</artifactId>
    <version>9.3</version>
</dependency>

I also needed the KMLConfiguration class, which I found in gt-xsd-kml.jar. The required dependency is

<dependency>
    <groupId>org.geotools.xsd</groupId>
    <artifactId>gt-xsd-kml</artifactId>
    <version>9.3</version>
</dependency>
Zoltán
  • 21,321
  • 14
  • 93
  • 134
  • isn't that imported by org.geotools gt-xml ${geotools.version} – Ian Turton Jun 26 '13 at 08:22
  • No, it isn't. Now I have a problem finding the class org.geotools.kml.KMLConfiguration. I've imported gt-xml, gt-xsd-core, gt-xsd-fes, gt-xsd-filter, gt-xsd-ows, gt-xsd-wfs, gt-xsd-gml3, but none of them contains it. – Zoltán Jun 26 '13 at 08:34
  • can you do mvn dependency:tree – Ian Turton Jun 26 '13 at 08:38
  • I did find it in http://download.osgeo.org/webdav/geotools/org/geotools/gt2-xml-kml/, but this only has a milestone release and I would need a stable release. – Zoltán Jun 26 '13 at 08:38
  • you also seem to be mixing releases (2.7.5 v 9.x in the Q) – Ian Turton Jun 26 '13 at 08:40
  • mvn dependency:tree added to the answer. Yes, in the question I asked for the latest release, but the geotools repository gave me jars for 2.7.5, which is fine as long as I can find all the required jars. – Zoltán Jun 26 '13 at 08:45
  • 2.7 is very old - please try maven tree for 9.x – Ian Turton Jun 26 '13 at 08:49
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/32395/discussion-between-zoltan-and-iant) – Zoltán Jun 26 '13 at 08:56
  • Yes, switching to 9.3 solved all my problems. For some reason m2eclipse failed to list version 9.3 through the add dependency wizard. After I changed the version manually, everything worked fine. I updated the answer accordingly. Thanks a lot @iant. – Zoltán Jun 26 '13 at 09:26