/** * Sets the SRID, if it was specified in the WKB * * @param g the geometry to update * @return the geometry with an updated SRID value, if required */ private Geometry setSRID(Geometry g, int SRID) { if (SRID != 0) g.setSRID(SRID); return g; }
/** * Sets the SRID, if it was specified in the WKB * * @param g the geometry to update * @return the geometry with an updated SRID value, if required */ private Geometry setSRID(Geometry g, int SRID) { if (SRID != 0) g.setSRID(SRID); return g; }
/** * Sets the SRID, if it was specified in the WKB * * @param g the geometry to update * @return the geometry with an updated SRID value, if required */ private Geometry setSRID(Geometry g) { if (SRID != 0) g.setSRID(SRID); return g; }
public void setSRID(int SRID) { geometry.setSRID(SRID); }
private Geometry asGeometry(Object geometry) { if (geometry instanceof Geometry) { Geometry geom = (Geometry) geometry; geom.setSRID(srid); return geom; } else { throw new IllegalStateException("Cannot handle " + geometry + " as geometry."); } }
/** * @param geometry Geometry instance * @return Geometry envelope */ public static Geometry getBoundary(Geometry geometry, int srid) { if(geometry==null) { return null; } Geometry geometryEnvelope = geometry.getBoundary(); geometryEnvelope.setSRID(srid); return geometryEnvelope; }
/** * @param geometry Geometry instance * @return Geometry envelope */ public static Geometry getBoundary(Geometry geometry, int srid) { if(geometry==null) { return null; } Geometry geometryEnvelope = geometry.getBoundary(); geometryEnvelope.setSRID(srid); return geometryEnvelope; }
/** * @param geometry Geometry instance * @return Geometry envelope */ public static Geometry getBoundary(Geometry geometry, int srid) { if(geometry==null) { return null; } Geometry geometryEnvelope = geometry.getBoundary(); geometryEnvelope.setSRID(srid); return geometryEnvelope; }
/** * @param geometry Geometry instance * @param srid input SRID * @return Geometry envelope */ public static Geometry getEnvelope(Geometry geometry, int srid) { if(geometry==null) { return null; } Geometry geometryEnvelope = geometry.getEnvelope(); geometryEnvelope.setSRID(srid); return geometryEnvelope; }
/** * @param geometry Geometry instance * @param srid input SRID * @return Geometry envelope */ public static Geometry getEnvelope(Geometry geometry, int srid) { if(geometry==null) { return null; } Geometry geometryEnvelope = geometry.getEnvelope(); geometryEnvelope.setSRID(srid); return geometryEnvelope; }
/** * @param geometry Geometry instance * @param srid input SRID * @return Geometry envelope */ public static Geometry getEnvelope(Geometry geometry, int srid) { if(geometry==null) { return null; } Geometry geometryEnvelope = geometry.getEnvelope(); geometryEnvelope.setSRID(srid); return geometryEnvelope; }
public static GeometryType makeEnvelope(double xmin, double ymin, double xmax, double ymax, Integer srid) { Geometry geom = GEOMETRY_FACTORY.createPolygon(new Coordinate[] {new Coordinate(xmin, ymin), new Coordinate(xmin, ymax), new Coordinate(xmax, ymax), new Coordinate(xmax, ymin), new Coordinate(xmin, ymin)}); if (srid != null) { geom.setSRID(srid); } return getGeometryType(geom); }
public static GeometryType makeEnvelope(double xmin, double ymin, double xmax, double ymax, Integer srid) { Geometry geom = GEOMETRY_FACTORY.createPolygon(new Coordinate[] {new Coordinate(xmin, ymin), new Coordinate(xmin, ymax), new Coordinate(xmax, ymax), new Coordinate(xmax, ymin), new Coordinate(xmin, ymin)}); if (srid != null) { geom.setSRID(srid); } return getGeometryType(geom); }
public static GeometryType makeEnvelope(double xmin, double ymin, double xmax, double ymax, Integer srid) { Geometry geom = GEOMETRY_FACTORY.createPolygon(new Coordinate[] {new Coordinate(xmin, ymin), new Coordinate(xmin, ymax), new Coordinate(xmax, ymax), new Coordinate(xmax, ymin), new Coordinate(xmin, ymin)}); if (srid != null) { geom.setSRID(srid); } return getGeometryType(geom); }
/** * Allows to manually overwrite the coordinate reference system (e.g. if the * ZoneLayer is read from a shape file without crs information). * * @param crs a coordinate reference system. */ public void overwriteCRS(CoordinateReferenceSystem crs) { this.crs = crs; this.srid = CRSUtils.getSRID(crs); for(Zone<?> zone : zones) { zone.getGeometry().setSRID(srid); } }
public static GeometryType getGeometryType(Geometry jtsGeom, int srid) { jtsGeom.setSRID(srid); byte[] bytes = getBytes(jtsGeom, true); GeometryType result = new GeometryType(bytes, srid); result.setGeoCache(jtsGeom); return result; }
public static GeometryType getGeometryType(Geometry jtsGeom, int srid) { jtsGeom.setSRID(srid); byte[] bytes = getBytes(jtsGeom, true); GeometryType result = new GeometryType(bytes, srid); result.setGeoCache(jtsGeom); return result; }
private Geometry convertGeometryCollection(GeometryCollection collection) { org.postgis.Geometry[] geometries = collection.getGeometries(); com.vividsolutions.jts.geom.Geometry[] jtsGeometries = new com.vividsolutions.jts.geom.Geometry[geometries.length]; for (int i = 0; i < geometries.length; i++) { jtsGeometries[i] = convert2JTS(geometries[i]); //TODO - refactor this so the following line is not necessary jtsGeometries[i].setSRID(0); // convert2JTS sets SRIDs, but constituent geometries in a collection must have srid == 0 } com.vividsolutions.jts.geom.GeometryCollection jtsGCollection = getGeometryFactory() .createGeometryCollection(jtsGeometries); return jtsGCollection; }
private Geometry forceEmptyToGeometryCollection(Geometry jtsGeom) { Geometry forced = jtsGeom; if (forced.isEmpty()) { GeometryFactory factory = jtsGeom.getFactory(); if (factory == null) { factory = HBSpatialExtension.getDefaultGeomFactory(); } forced = factory.createGeometryCollection(null); forced.setSRID(jtsGeom.getSRID()); } return forced; }
public static GeometryType polygon(GeometryType geom, int srid) throws FunctionExecutionException { Geometry g = getGeometry(geom); if (!(g instanceof LineString)) { throw new FunctionExecutionException(QueryPlugin.Event.TEIID31207, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31207)); } LineString ls = (LineString)g; Geometry result = GEOMETRY_FACTORY.createPolygon(ls.getCoordinateSequence()); result.setSRID(srid); return getGeometryType(result); }