本文整理了Java中com.vividsolutions.jts.geom.Polygon.getSRID()
方法的一些代码示例,展示了Polygon.getSRID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Polygon.getSRID()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Polygon
类名称:Polygon
方法名:getSRID
暂无
代码示例来源:origin: com.vividsolutions/jts
public Object parse(Handler arg, GeometryFactory gf) throws SAXException {
// one child, either a coord
// or a coordinate sequence
if(arg.children.size()<1)
throw new SAXException("Cannot create a polygon without atleast one linear ring");
int srid = getSrid(arg.attrs,gf.getSRID());
LinearRing outer = (LinearRing) arg.children.get(0); // will be the first
List t = arg.children.size()>1?arg.children.subList(1,arg.children.size()):null;
LinearRing[] inner = t==null?null:(LinearRing[]) t.toArray(new LinearRing[t.size()]);
Polygon p = gf.createPolygon(outer,inner);
if(p.getSRID()!=srid)
p.setSRID(srid);
return p;
}
});
代码示例来源:origin: org.geotools/gt-render
public int getSRID() {
return polygon.getSRID();
}
代码示例来源:origin: com.vividsolutions/jts-io
public Object parse(Handler arg, GeometryFactory gf) throws SAXException {
// one child, either a coord
// or a coordinate sequence
if(arg.children.size()<1)
throw new SAXException("Cannot create a polygon without atleast one linear ring");
int srid = getSrid(arg.attrs,gf.getSRID());
LinearRing outer = (LinearRing) arg.children.get(0); // will be the first
List t = arg.children.size()>1?arg.children.subList(1,arg.children.size()):null;
LinearRing[] inner = t==null?null:(LinearRing[]) t.toArray(new LinearRing[t.size()]);
Polygon p = gf.createPolygon(outer,inner);
if(p.getSRID()!=srid)
p.setSRID(srid);
return p;
}
});
代码示例来源:origin: sinergise/Sentinel2ProductIngestor
public static org.geojson.Polygon toGeoJson(Polygon jtsPolygon) {
if (jtsPolygon == null)
return null;
org.geojson.Polygon geoJsonPoly = new org.geojson.Polygon(Arrays.asList(jtsPolygon.getCoordinates()).stream()
.map(p -> new LngLatAlt(p.x, p.y)).collect(Collectors.toList()));
geoJsonPoly.setCrs(createCrsForEpsgCode(jtsPolygon.getSRID()));
return geoJsonPoly;
}
代码示例来源:origin: org.hibernatespatial/hibernate-spatial-oracle
private SDOGeometry convertJTSPolygon(Polygon polygon) {
int dim = getCoordDimension(polygon);
int lrsPos = getCoordinateLrsPosition(polygon);
SDOGeometry geom = new SDOGeometry();
geom.setGType(new SDOGType(dim, lrsPos, TypeGeometry.POLYGON));
geom.setSRID(polygon.getSRID());
addPolygon(geom, polygon);
return geom;
}
代码示例来源:origin: org.hibernatespatial/hibernate-spatial-postgis
private Polygon convertJTSPolygon(
com.vividsolutions.jts.geom.Polygon jtsPolygon) {
int numRings = jtsPolygon.getNumInteriorRing();
org.postgis.LinearRing[] rings = new org.postgis.LinearRing[numRings + 1];
rings[0] = convertJTSLineStringToLinearRing(jtsPolygon
.getExteriorRing());
for (int i = 0; i < numRings; i++) {
rings[i + 1] = convertJTSLineStringToLinearRing(jtsPolygon
.getInteriorRingN(i));
}
Polygon polygon = new org.postgis.Polygon(rings);
polygon.setSrid(jtsPolygon.getSRID());
return polygon;
}
代码示例来源:origin: org.geoserver.extension/imagemap
/**
* Gets a new polygon without holes from the given
* polygon.
* @param poly
* @return
*/
public static Polygon removeHoles(Polygon poly,double scale) {
GeometryFactory gFac=new GeometryFactory(poly.getPrecisionModel(),poly.getSRID());
// extracts the exterior ring that will be used as
// a starting polygon from which holes will be cut
LineString result=poly.getExteriorRing();
// cut every hole from the exterior ring
for(int holeCount=0;holeCount<poly.getNumInteriorRing();holeCount++) {
LineString hole=poly.getInteriorRingN(holeCount);
if(!skipHole(hole,scale)) {
// call holes remover to cut the current hole
HolesRemover remover=new HolesRemover(result,hole,gFac);
result=remover.cutHole();
}
}
// return a new polygon from the new boundary
LinearRing resultRing=gFac.createLinearRing(result.getCoordinates());
return gFac.createPolygon(resultRing, new LinearRing[] {});
}
内容来源于网络,如有侵权,请联系作者删除!