What do I have to write if I want to tranform to KML a list of Geometries.
I've frote such code:
LOG.info("geometryList.size {}",geometryList.size());
Encoder encoder = new Encoder(new KMLConfiguration());
encoder.setIndenting(true);
for(Geometry geometry : geometryList){
LOG.info("Geometry: {}", geometry);
encoder.encode(geometry, KML.Polygon, System.out);
}
And I do get an exception:
013-02-13 17:43:54 INFO SingleRetailsStoreIntersectionVisualizationTest:59
- Geometry: POLYGON ((155.61859130859375 37.506622314453125,
155.4212641514209 43.785674267384465, 154.83006144004153 50.039945670883554,
153.84731638146263 56.24475377302559, 152.47690742145687 62.3756110309386,
150.72424293810911 68.40832175194787, 148.59623989741888 74.31907758292093,
146.1012965551957 80.0845514709604, 143.24925931298012 85.68198972462466,
140.05138385879525 91.0893018123528, 136.5202907460885 96.28514754370045,
132.66991558617266 101.2490212893221, 128.5154540507349 105.961332907322,
124.07330190146263 110.40348505659428, 119.36099028346271
114.55794659203205, 114.39711653784104 118.40832175194787, 109.2012708064934
121.93941486465464, 103.79395871876527 125.13729031883949, 98.19652046510102
127.98932756105508, 92.43104657706154 130.4842709032783, 86.52029074608849
132.6122739439685, 80.48758002507923 134.36493842731625, 74.3567227671662
135.735347387322, 68.15191466502418 136.7180924459009, 61.89764326152508
137.30929515728027, 55.618591308593736 137.50662231445312, 49.33953935566241
137.30929515728027, 43.08526795216331 136.7180924459009, 36.88045985002127
135.73534738732198, 30.749602592108264 134.36493842731625,
24.716891871098994 132.6122739439685, 18.80613604012595 130.4842709032783,
13.040662152086476 127.98932756105508, 7.443223898422204 125.13729031883948,
2.03591181069406 121.93941486465462, -3.1599339206535504 118.40832175194787,
-8.123807666275226 114.55794659203205, -12.836119284275128
110.40348505659426, -17.278271433547417 105.96133290732197,
-21.432732968985192 101.24902128932209, -25.283108128900977
96.28514754370045, -28.814201241607762 91.0893018123528, -32.012076695792615
85.68198972462464, -34.8641139380082 80.08455147096038, -37.3590572802314
74.3190775829209, -39.487060320921614 68.40832175194784, -41.23972480426936
62.37561103093861, -42.61013376427512 56.24475377302558, -43.59287882285403
50.03994567088353, -44.1840815342334 43.78567426738444, -44.38140869140625
37.50662231445309, -44.1840815342334 31.227570361521792, -43.59287882285403
24.973298958022696, -42.610133764275105 18.76849085588065,
-41.23972480426936 12.637633597967625, -39.4870603209216 6.6049228769583515,
-37.35905728023137 0.6941670459852958, -34.8641139380082 -5.071306842054142,
-32.012076695792615 -10.668745095718414, -28.814201241607748
-16.07605718344655, -25.283108128900977 -21.27190291479421,
-21.43273296898515 -26.235776660415873, -17.278271433547403
-30.948088278415753, -12.836119284275114 -35.39024042768803,
-8.123807666275205 -39.54470196312582, -3.1599339206535717
-43.3950771230416, 2.0359118106941168 -46.9261702357484, 7.443223898422225
-50.12404568993324, 13.040662152086533 -52.976082932148856,
18.80613604012597 -55.47102627437202, 24.716891871098994
-57.599029315062225, 30.749602592108307 -59.35169379841, 36.88045985002128
-60.722102758415744, 43.08526795216338 -61.70484781699466, 49.33953935566243
-62.296050528374025, 55.61859130859373 -62.493377685546875,
61.89764326152512 -62.296050528374025, 68.15191466502418 -61.70484781699466,
74.35672276716626 -60.72210275841573, 80.48758002507924 -59.35169379840998,
86.52029074608848 -57.59902931506224, 92.43104657706158 -55.471026274371994,
98.196520465101 -52.97608293214883, 103.79395871876532 -50.12404568993321,
109.20127080649343 -46.92617023574837, 114.39711653784113
-43.395077123041574, 119.36099028346274 -39.544701963125775,
124.07330190146261 -35.39024042768803, 128.51545405073495
-30.948088278415696, 132.6699155861727 -26.235776660415837,
136.52029074608853 -21.271902914794133, 140.05138385879525
-16.07605718344651, 143.24925931298012 -10.668745095718407,
146.10129655519572 -5.071306842054099, 148.5962398974189 0.6941670459853384,
150.72424293810911 6.604922876958447, 152.47690742145687 12.637633597967675,
153.84731638146263 18.768490855880657, 154.83006144004153
24.973298958022745, 155.4212641514209 31.2275703615218, 155.61859130859375
37.506622314453125))
<?xml version="1.0" encoding="UTF-8"?>
<kml:Polygon xmlns:kml="http://earth.google.com/kml/2.1">
<kml:outerBoundaryIs>
<kml:LinearRing>
<kml:coordinates>BAL BLA BLA</kml:coordinates>
</kml:LinearRing>
</kml:outerBoundaryIs>
</kml:Polygon>
2013-02-13 17:43:54 INFO SingleRetailsStoreIntersectionVisualizationTest:59
- Geometry: LINESTRING BAL BLA BLA
java.lang.NullPointerException
at
org.geotools.xml.impl.SchemaIndexImpl.destroy(SchemaIndexImpl.java:105)
at org.geotools.xml.Encoder.encode(Encoder.java:1067)
at org.geotools.xml.Encoder.encode(Encoder.java:603)
I do understand why but what do I have to use to serialize to KML a list of
geometries?
--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/Encoding-to-KML-tp4322825p5033966.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users