Re: [Jts-topo-suite-user] Polygon union to kml
Brought to you by:
dr_jts
From: Veit K. <ve...@la...> - 2012-06-29 13:57:51
|
Just for your information, i found some problems. #1 if polygons touch at one point only it´s failing. i made my square polygons a tiny bit bigger so they overlap just a little - now it´s looks fine in google earth. #2 if there is a hole in the polygon it does not draw correct as kml. so i will split these areas. so it´s not the fault of the library. any hints for me would be nice, but i think i will get it best regards veit 2012/6/29 Veit Kötting <ve...@la...> > Hi there, > > i´m quite new to JTS and i already like it very much :) > > i´m have lots of square geometries with gps coordinates from a weather > radar. now i do the union.buffer(0) to make a polygon from the parts which > belong together. > it works fine. > > now i´m trying to write it to .kml and display it in google earth. > it works if the polygon doesn´t get to complex. > > i think it fails if there are two squares only connected at the corner, > not on the edge. and i think google earth depends on the correct order of > coordinates to draw a polygon like it´s supposed to. > > if it fails, there are some lines connecting squares that are not supposed > to be connected, mostly these corners where there is no contact between the > edges are connected even if they are far away (i hope you understand, my > english is not that good) > > > so, is there another way to write a geometry to a .kml? > > > this is part of my code: > > writer.writeStartElement("outerBoundaryIs"); > writer.writeCharacters("\n"); > writer.writeStartElement("LinearRing"); > writer.writeCharacters("\n"); > > writer.writeStartElement("coordinates"); > > for (Coordinate point: coordinates) { > writer.writeCharacters(ConvertCoordToString(point.y) + "," + > ConvertCoordToString(point.x) + "," + > "0.0" + "\n"); > } > > > writer.writeEndElement(); // coordinates > writer.writeCharacters("\n"); > > |