本文整理汇总了Java中com.vividsolutions.jts.operation.valid.TopologyValidationError类的典型用法代码示例。如果您正苦于以下问题:Java TopologyValidationError类的具体用法?Java TopologyValidationError怎么用?Java TopologyValidationError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TopologyValidationError类属于com.vividsolutions.jts.operation.valid包,在下文中一共展示了TopologyValidationError类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkJTSFootprint
import com.vividsolutions.jts.operation.valid.TopologyValidationError; //导入依赖的package包/类
/**
* Check JTS Footprint validity
*/
public static boolean checkJTSFootprint (String footprint)
{
try
{
WKTReader wkt = new WKTReader();
Geometry geom = wkt.read(footprint);
IsValidOp vaildOp = new IsValidOp(geom);
TopologyValidationError err = vaildOp.getValidationError();
if (err != null)
{
throw new IllegalParameterException(err.getMessage());
}
return true;
}
catch (Exception e)
{
LOGGER.error("JTS Footprint error : " + e.getMessage());
return false;
}
}
示例2: testCountryBoundariesGeoJson
import com.vividsolutions.jts.operation.valid.TopologyValidationError; //导入依赖的package包/类
public void testCountryBoundariesGeoJson() throws IOException
{
String geoJson = StreamUtils.readToString(getContext().getAssets().open("countryBoundaries.json"));
GeometryCollection countriesBoundaries = (GeometryCollection) new GeoJsonReader().read(geoJson);
for(int i = 0; i < countriesBoundaries.getNumGeometries(); ++i)
{
Geometry countryBoundary = countriesBoundaries.getGeometryN(i);
Map<String,String> props = (Map<String,String>) countryBoundary.getUserData();
TopologyValidationError err = new IsValidOp(countryBoundary).getValidationError();
if(err != null) {
String countryCode = props.get("ISO3166-1:alpha2");
if(countryCode == null) countryCode = props.get("ISO3166-2");
fail("" + countryCode + ": " + err.toString());
}
}
}