private void writeGeometryType(int geometryType, Geometry g, OutStream os) throws IOException { int flag3D = (outputDimension == 3) ? 0x80000000 : 0; int typeInt = geometryType | flag3D; typeInt |= includeSRID ? 0x20000000 : 0; writeInt(typeInt, os); if (includeSRID) { writeInt(g.getSRID(), os); } }
public int getSRID(int def) { int ret = value.getSRID(); if (ret <= 0) ret = def; return ret; }
private String getSRID(Geometry geom) { int srid = geom.getSRID(); if (srid != 0) { // Include SRID in wkt return "SRID=".concat(String.valueOf(srid)).concat(";"); } return ""; }
public int getSRID() { if (this.envelope != null) { return envelope.getSrid(); } else if (this.geometry != null) { return this.geometry.getSRID(); } else { return -1; } }
public static ClobType geometryToClob(GeometryType geometry, boolean withSrid) throws FunctionExecutionException { Geometry jtsGeometry = getGeometry(geometry); int srid = jtsGeometry.getSRID(); StringBuilder geomText = new StringBuilder(); if (withSrid && srid != GeometryType.UNKNOWN_SRID) { geomText.append("SRID=").append(jtsGeometry.getSRID()).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ } geomText.append(jtsGeometry.toText()); return new ClobType(new ClobImpl(geomText.toString())); }
public void convert(Geometry source, SRSReferenceGroup target) { Validate.notNull(source); Validate.notNull(target); if (source.getUserData() instanceof String) { target.setSrsName((String) source.getUserData()); } else if (source.getSRID() != 0) { target.setSrsName(MessageFormat.format(this.sridPattern, source.getSRID())); } }
public static ClobType geometryToClob(AbstractGeospatialType geometry, boolean withSrid) throws FunctionExecutionException { Geometry jtsGeometry = getGeometry(geometry); int srid = jtsGeometry.getSRID(); StringBuilder geomText = new StringBuilder(); if (withSrid && srid != GeometryType.UNKNOWN_SRID) { geomText.append("SRID=").append(jtsGeometry.getSRID()).append(";"); //$NON-NLS-1$ //$NON-NLS-2$ } geomText.append(jtsGeometry.toText()); return new ClobType(new ClobImpl(geomText.toString())); }
private void writeGeometryType(int geometryType, Geometry g, OutStream os) throws IOException { int flag3D = (outputDimension == 3) ? 0x80000000 : 0; int typeInt = geometryType | flag3D; typeInt |= includeSRID ? 0x20000000 : 0; writeInt(typeInt, os); if (includeSRID) { writeInt(g.getSRID(), os); } }
private Geometry transformGeometry(FeatureEntity featureEntity, Geometry geometry) throws TransformException, FactoryException { try { String fromCrs = "EPSG:" + geometry.getSRID(); return crsUtil.transformOuterToInner(geometry, fromCrs); } catch (FactoryException e) { LOGGER.info("Unable to create CRS factory for station/feature: {}" + featureEntity.getDomainId()); return crsUtil.transformOuterToInner(geometry, CRSUtils.DEFAULT_CRS); } }
@Override public Item item(final QueryContext qc, final InputInfo ii) throws QueryException { return Uri.uri(token(checkGeo(0, qc).getSRID())); } }
public static Geospatial convertToODataValue(InputStream wkb, boolean includesSrid) throws FunctionExecutionException { Geometry g = GeometryUtils.getGeometry(wkb, null, includesSrid); JTS2OlingoBridge bridge = new JTS2OlingoBridge(Dimension.GEOMETRY, includesSrid?SRID.valueOf(String.valueOf(g.getSRID())):null); return bridge.convert(g); }
public static GeographyType getGeographyType(Geometry geom) { byte[] bytes = getBytes(geom, true); GeographyType result = new GeographyType(bytes, geom.getSRID()); result.setGeoCache(geom); return result; }
public OfferingEntity setGeometry(Geometry geometry) { this.geometryEntity = new GeometryEntity(); this.geometryEntity.setGeometry(geometry); this.geometryEntity.setSrid(geometry.getSRID()); return this; }
private static byte[] convertToWKB(Geometry g) { boolean includeSRID = g.getSRID() != 0; int dimensionCount = getDimensionCount(g); WKBWriter writer = new WKBWriter(dimensionCount, includeSRID); return writer.write(g); }
public static GeographyType getGeographyType(Geometry geom) { byte[] bytes = getBytes(geom, true); GeographyType result = new GeographyType(bytes, geom.getSRID()); result.setGeoCache(geom); return result; }
public static Geospatial convertToODataValue(InputStream wkb, boolean includesSrid) throws FunctionExecutionException { Geometry g = GeometryUtils.getGeometry(wkb, null, includesSrid); JTS2OlingoBridge bridge = new JTS2OlingoBridge(Dimension.GEOMETRY, includesSrid?SRID.valueOf(String.valueOf(g.getSRID())):null); return bridge.convert(g); }
private static byte[] convertToWKB(Geometry g) { boolean includeSRID = g.getSRID() != 0; int dimensionCount = getDimensionCount(g); WKBWriter writer = new WKBWriter(dimensionCount, includeSRID); return writer.write(g); }
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; }