本文整理了Java中com.vividsolutions.jts.geom.Point.getSRID()
方法的一些代码示例,展示了Point.getSRID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.getSRID()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Point
类名称:Point
方法名: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 point without exactly one coordinate");
int srid = getSrid(arg.attrs,gf.getSRID());
Object c = arg.children.get(0);
Point p = null;
if(c instanceof Coordinate){
p = gf.createPoint((Coordinate)c);
}else{
p = gf.createPoint((CoordinateSequence)c);
}
if(p.getSRID()!=srid)
p.setSRID(srid);
return p;
}
});
代码示例来源:origin: Impetus/Kundera
public Point(com.vividsolutions.jts.geom.Point point)
{
super(point.getCoordinate(), point.getPrecisionModel(), point.getSRID());
}
代码示例来源:origin: org.geotools/gt-render
public int getSRID() {
return point.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 point without exactly one coordinate");
int srid = getSrid(arg.attrs,gf.getSRID());
Object c = arg.children.get(0);
Point p = null;
if(c instanceof Coordinate){
p = gf.createPoint((Coordinate)c);
}else{
p = gf.createPoint((CoordinateSequence)c);
}
if(p.getSRID()!=srid)
p.setSRID(srid);
return p;
}
});
代码示例来源:origin: matsim-org/matsim
@SuppressWarnings("unchecked")
private List<Zone<T>> getZones(Point point) {
if(point.getSRID() != srid)
point = transformPoint(point);
List<Zone<T>> result = quadtree.query(point.getEnvelopeInternal());
List<Zone<T>> zones = new ArrayList<Zone<T>>(result.size());
for(Zone<T> z : result) {
if(z.getGeometry().contains(point))
zones.add(z);
}
return zones;
}
代码示例来源:origin: matsim-org/matsim
/**
* Calculates the distance between two points. If the SRID is 0, a cartesian coordinate system is assumed and {@link
* CartesianDistanceCalculator} is used, otherwise {@link JTS#orthodromicDistance(Coordinate, Coordinate,
* CoordinateReferenceSystem)} is used.
*
* @param p1 the source point
* @param p2 the target point
* @return the distance between <tt>p1</tt> and <tt>p2</tt> or {@code Double.NaN} if the distance cannot be
* calculated.
* @throws RuntimeException if points have different SRIDs
*/
@Override
public double distance(Point p1, Point p2) {
if (p1.getSRID() == p2.getSRID()) {
if (p1.getSRID() == 0) {
return CartesianDistanceCalculator.getInstance().distance(p1, p2);
} else {
try {
return JTS.orthodromicDistance(p1.getCoordinate(), p2.getCoordinate(),
CRSUtils.getCRS(p1.getSRID()));
} catch (TransformException e) {
e.printStackTrace();
return Double.NaN;
}
}
} else {
throw new RuntimeException("Incompatible coordinate reference systems.");
}
}
代码示例来源:origin: org.hibernatespatial/hibernate-spatial-postgis
private Point convertJTSPoint(com.vividsolutions.jts.geom.Point point) {
org.postgis.Point pgPoint = new org.postgis.Point();
pgPoint.srid = point.getSRID();
pgPoint.x = point.getX();
pgPoint.y = point.getY();
Coordinate coordinate = point.getCoordinate();
if (Double.isNaN(coordinate.z)) {
pgPoint.dimension = 2;
} else {
pgPoint.z = coordinate.z;
pgPoint.dimension = 3;
}
pgPoint.haveMeasure = false;
if (coordinate instanceof MCoordinate && !Double.isNaN(((MCoordinate) coordinate).m)) {
pgPoint.m = ((MCoordinate) coordinate).m;
pgPoint.haveMeasure = true;
}
return pgPoint;
}
代码示例来源:origin: org.n52.shetland/shetland
/**
* Get the extent of all {@link Point}s
*
* @return The extent as {@link Polygon}
*/
public Polygon getExtent() {
if (isSetValue()) {
int srid = -1;
List<Coordinate> coordinates = Lists.newLinkedList();
for (PointValuePair pointValuePair : getValue()) {
Point point = pointValuePair.getPoint();
coordinates.add(point.getCoordinate());
if (point.getSRID() != srid) {
srid = point.getSRID();
}
}
GeometryFactory geometryFactory;
if (srid > 0) {
geometryFactory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), srid);
} else {
geometryFactory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING));
}
return geometryFactory.createPolygon(coordinates.toArray(new Coordinate[coordinates.size()]));
}
return null;
}
代码示例来源:origin: matsim-org/matsim
private Point transformPoint(Point point) {
CoordinateReferenceSystem sourceCRS = CRSUtils.getCRS(point.getSRID());
CoordinateReferenceSystem targetCRS = crs;
try {
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
return CRSUtils.transformPoint(point, transform);
} catch (FactoryException e) {
e.printStackTrace();
return null;
}
}
/**
代码示例来源:origin: sinergise/Sentinel2ProductIngestor
public static org.geojson.Point toGeoJson(Point jtsPoint) {
if (jtsPoint == null)
return null;
org.geojson.Point geoJsonPoint = new org.geojson.Point(new LngLatAlt(jtsPoint.getX(), jtsPoint.getY()));
geoJsonPoint.setCrs(createCrsForEpsgCode(jtsPoint.getSRID()));
return geoJsonPoint;
}
代码示例来源:origin: org.hibernatespatial/hibernate-spatial-oracle
private SDOGeometry convertJTSPoint(Point jtsGeom) {
int dim = getCoordDimension(jtsGeom);
int lrsDim = getCoordinateLrsPosition(jtsGeom);
boolean isLrs = (lrsDim != 0);
Double[] coord = convertCoordinates(jtsGeom.getCoordinates(), dim,
isLrs);
SDOGeometry geom = new SDOGeometry();
geom.setGType(new SDOGType(dim, lrsDim, TypeGeometry.POINT));
geom.setSRID(jtsGeom.getSRID());
ElemInfo info = new ElemInfo(1);
info.setElement(0, 1, ElementType.POINT, 1);
geom.setInfo(info);
geom.setOrdinates(new Ordinates(coord));
return geom;
}
代码示例来源:origin: org.n52.shetland/shetland
factory = pointValuePair.getPoint().getFactory();
if (pointValuePair.getPoint().getSRID() > 0) {
srid = pointValuePair.getPoint().getSRID();
代码示例来源:origin: org.n52.sensorweb.sos/inspire-api
factory = pointValuePair.getPoint().getFactory();
if (pointValuePair.getPoint().getSRID() > 0) {
srid = pointValuePair.getPoint().getSRID();
内容来源于网络,如有侵权,请联系作者删除!