java - JTS/Geotools Correct union/difference of multiple geometry -
problem :
i have shape file contains targeted area (yellow).
i have shape file contains buildings (green).
i need white space in yellow area.
picture : ://db.tt/kjjxzlqf
my solutions :
get buildings in area
filter inpolygon = cql.tofilter("within(the_geom,"+wktwriter.write(targetarea) + ")");featurecollection<simplefeaturetype, simplefeature> collection = featuresource.getfeatures(inpolygon);//this worksfrom every building it's geometry , use difference on target area
tocover = tocover.difference(building);
or second solution :
union of every building , difference @ end.
or third solution :
put them in geomtrycollection call union , use difference
everyone of these solutions give me following picture
picture : https://dl.dropboxusercontent.com/u/639458/stackoverflow/stfr2.png
let clear tried out several ways solve problem, using different ways of creating / making or using it. given code in site below did not work correct.
http://docs.geotools.org/latest/userguide/library/jts/combine.html
my problems solved in end @mdup had suggested use of
.buffer(0)
Comments
Post a Comment