public void eval() { double lon = lonParam.value; double lat = latParam.value; com.esri.core.geometry.ogc.OGCPoint point = new com.esri.core.geometry.ogc.OGCPoint( new com.esri.core.geometry.Point(lon, lat), com.esri.core.geometry.SpatialReference.create(4326)); java.nio.ByteBuffer pointBytes = point.asBinary(); out.buffer = buffer; out.start = 0; out.end = pointBytes.remaining(); buffer.setBytes(0, pointBytes); } }
public int SRID() { if (esriSR == null) return 0; return esriSR.getID(); }
/** * Returns string representation of the class for debugging purposes. The * format and content of the returned string is not part of the contract of * the method and is subject to change in any future release or patch * without further notice. */ public String toString() { return "[ tol: " + getTolerance() + "; wkid: " + getID() + "; wkt: " + getText() + "]"; } }
@Override public SpatialReference deserialize(JsonParser parser, DeserializationContext arg1) throws IOException, JsonProcessingException { try { return SpatialReference.fromJson(parser); } catch (Exception e) { return null; } } }
private static void writeSR(SpatialReference spatialReference, JsonWriter jsonWriter) { int wkid = spatialReference.getOldID(); if (wkid > 0) { jsonWriter.addPairObject("spatialReference"); jsonWriter.addPairInt("wkid", wkid); int latest_wkid = spatialReference.getLatestID(); if (latest_wkid > 0 && latest_wkid != wkid) { jsonWriter.addPairInt("latestWkid", latest_wkid); } jsonWriter.endObject(); } else { String wkt = spatialReference.getText(); if (wkt != null) { jsonWriter.addPairObject("spatialReference"); jsonWriter.addPairString("wkt", wkt); jsonWriter.endObject(); } } } }
private static void exportSpatialReference(int export_flags, SpatialReference spatial_reference, JsonWriter json_writer) { if (spatial_reference != null) { int wkid = spatial_reference.getLatestID(); if (wkid <= 0) throw new GeometryException("invalid call"); json_writer.startObject(); json_writer.addFieldName("type"); json_writer.addValueString("name"); json_writer.addFieldName("properties"); json_writer.startObject(); json_writer.addFieldName("name"); String authority = ((SpatialReferenceImpl) spatial_reference).getAuthority(); authority = authority.toUpperCase(); StringBuilder crs_identifier = new StringBuilder(authority); crs_identifier.append(':'); crs_identifier.append(wkid); json_writer.addValueString(crs_identifier.toString()); json_writer.endObject(); json_writer.endObject(); } else { json_writer.addValueNull(); } }
public int SRID() { if (esriSR == null) return 0; return esriSR.getID(); }
/** * Returns string representation of the class for debugging purposes. The * format and content of the returned string is not part of the contract of * the method and is subject to change in any future release or patch * without further notice. */ public String toString() { return "[ tol: " + getTolerance() + "; wkid: " + getID() + "; wkt: " + getText() + "]"; } }
/** * Returns spatial reference from the JsonParser. * * @param parser * The JSON parser. * @return The spatial reference or null if there is no spatial reference * information, or the parser does not point to an object start. * @throws Exception * if parsing has failed */ public static SpatialReference fromJson(JsonParser parser) throws Exception { return fromJson(new JsonParserReader(parser)); }
private static void writeSR(SpatialReference spatialReference, JsonWriter jsonWriter) { int wkid = spatialReference.getOldID(); if (wkid > 0) { jsonWriter.addPairObject("spatialReference"); jsonWriter.addPairInt("wkid", wkid); int latest_wkid = spatialReference.getLatestID(); if (latest_wkid > 0 && latest_wkid != wkid) { jsonWriter.addPairInt("latestWkid", latest_wkid); } jsonWriter.endObject(); } else { String wkt = spatialReference.getText(); if (wkt != null) { jsonWriter.addPairObject("spatialReference"); jsonWriter.addPairString("wkt", wkt); jsonWriter.endObject(); } } } }
private static void exportSpatialReference(int export_flags, SpatialReference spatial_reference, JsonWriter json_writer) { if (spatial_reference != null) { int wkid = spatial_reference.getLatestID(); if (wkid <= 0) throw new GeometryException("invalid call"); json_writer.startObject(); json_writer.addFieldName("type"); json_writer.addValueString("name"); json_writer.addFieldName("properties"); json_writer.startObject(); json_writer.addFieldName("name"); String authority = ((SpatialReferenceImpl) spatial_reference).getAuthority(); authority = authority.toUpperCase(); StringBuilder crs_identifier = new StringBuilder(authority); crs_identifier.append(':'); crs_identifier.append(wkid); json_writer.addValueString(crs_identifier.toString()); json_writer.endObject(); json_writer.endObject(); } else { json_writer.addValueNull(); } }
@Override public void output() { if (nonNullCount.value > 0) { out.isSet = 1; java.util.List<com.esri.core.geometry.Geometry> tmp = (java.util.ArrayList<com.esri.core.geometry.Geometry>) value.obj; com.esri.core.geometry.SpatialReference spatialRef = null; if (srid.value != 0){ spatialRef = com.esri.core.geometry.SpatialReference.create(4326); } com.esri.core.geometry.Geometry[] geomArr = (com.esri.core.geometry.Geometry[]) tmp.toArray(new com.esri.core.geometry.Geometry[0]); com.esri.core.geometry.Geometry geom = com.esri.core.geometry.GeometryEngine.union(geomArr, spatialRef); com.esri.core.geometry.ogc.OGCGeometry unionGeom = com.esri.core.geometry.ogc.OGCGeometry.createFromEsriGeometry(geom, spatialRef); java.nio.ByteBuffer unionGeomBytes = unionGeom.asBinary(); int outputSize = unionGeomBytes.remaining(); buf = out.buffer = buf.reallocIfNeeded(outputSize); out.start = 0; out.end = outputSize; buf.setBytes(0, unionGeomBytes); } else { out.isSet = 0; } }
@Override public void serialize(SpatialReference spatialReference, JsonGenerator jsonGenerator, SerializerProvider arg2) throws IOException, JsonProcessingException { int wkid = spatialReference.getID(); jsonGenerator.writeStartObject(); jsonGenerator.writeObjectField("wkid", wkid); jsonGenerator.writeEndObject(); }
/** * Returns spatial reference from the JsonParser. * * @param parser * The JSON parser. * @return The spatial reference or null if there is no spatial reference * information, or the parser does not point to an object start. * @throws Exception * if parsing has failed */ public static SpatialReference fromJson(JsonParser parser) throws Exception { return fromJson(new JsonParserReader(parser)); }
public void eval() { int srid = sridParam.value; String wktText = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(input.start, input.end, input.buffer); com.esri.core.geometry.ogc.OGCGeometry geom; geom = com.esri.core.geometry.ogc.OGCGeometry.fromText(wktText); geom.setSpatialReference(com.esri.core.geometry.SpatialReference.create(srid)); java.nio.ByteBuffer pointBytes = geom.asBinary(); int outputSize = pointBytes.remaining(); buffer = out.buffer = buffer.reallocIfNeeded(outputSize); out.start = 0; out.end = outputSize; buffer.setBytes(0, pointBytes); } }
public Geom transform(int srid) { if (srid == SPATIAL_REFERENCE.getID()) { return this; } return bind(g, srid); }
public static SpatialReference fromJson(String string) throws Exception { return fromJson(JsonParserReader.createFromString(string)); }
com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.create(sridTgt); java.nio.ByteBuffer geomBytes;