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); } }
@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; } }
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); } }
com.esri.core.geometry.SpatialReference sr = com.esri.core.geometry.SpatialReference.create(sridTgt); java.nio.ByteBuffer geomBytes;
private static SpatialReference parseSpatialReference(String input) { try { String wkid = input.toLowerCase().replace("epsg:", ""); return SpatialReference.create(Integer.parseInt(wkid)); } catch (Exception e) { throw new IllegalArgumentException("unsupported SRID"); } }
public OsGridReference(String name, int easting, int northing, Envelope boundingBox) { super("GridRef: " + name, name, "Easting: " + easting + " Northing: " + northing, new Point(easting, northing), boundingBox, SpatialReference.create(27700)); } }
protected static Geom bind(Geometry geometry, int srid) { if (geometry == null) { return null; } if (srid == NO_SRID) { return new SimpleGeom(geometry); } return bind(geometry, SpatialReference.create(srid)); }
public void parseWKT(String wkt) { OGCStructure structure; structure = wktImporter.executeOGC(WktImportFlags.wktImportNonTrusted, wkt, null); this.geometry = OGCGeometry.createFromOGCStructure(structure, SpatialReference.create(4326)); } }
protected static Geom bind(Geometry geometry, int srid) { if (geometry == null) { return null; } if (srid == NO_SRID) { return new SimpleGeom(geometry); } return bind(geometry, SpatialReference.create(srid)); }
public static OGCGeometry fromText(String text) { OperatorImportFromWkt op = (OperatorImportFromWkt) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.ImportFromWkt); OGCStructure ogcStructure = op.executeOGC(0, text, null); return OGCGeometry.createFromOGCStructure(ogcStructure, SpatialReference.create(4326)); }
public static OGCGeometry fromEsriShape(ByteBuffer buffer) { OperatorImportFromESRIShape op = (OperatorImportFromESRIShape) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.ImportFromESRIShape); Geometry g = op.execute(0, Geometry.Type.Unknown, buffer); return OGCGeometry.createFromEsriGeometry(g, SpatialReference.create(4326)); }
public static OGCGeometry fromBinary(ByteBuffer binary) { OperatorImportFromWkb op = (OperatorImportFromWkb) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.ImportFromWkb); OGCStructure ogcStructure = op.executeOGC(0, binary, null); return OGCGeometry.createFromOGCStructure(ogcStructure, SpatialReference.create(4326)); }
public static OGCGeometry fromBinary(ByteBuffer binary) { OperatorImportFromWkb op = (OperatorImportFromWkb) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.ImportFromWkb); OGCStructure ogcStructure = op.executeOGC(0, binary, null); return OGCGeometry.createFromOGCStructure(ogcStructure, SpatialReference.create(4326)); }
public static OGCGeometry fromText(String text) { OperatorImportFromWkt op = (OperatorImportFromWkt) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.ImportFromWkt); OGCStructure ogcStructure = op.executeOGC(0, text, null); return OGCGeometry.createFromOGCStructure(ogcStructure, SpatialReference.create(4326)); }
public static OGCGeometry fromEsriShape(ByteBuffer buffer) { OperatorImportFromESRIShape op = (OperatorImportFromESRIShape) OperatorFactoryLocal .getInstance().getOperator(Operator.Type.ImportFromESRIShape); Geometry g = op.execute(0, Geometry.Type.Unknown, buffer); return OGCGeometry.createFromEsriGeometry(g, SpatialReference.create(4326)); }
@Override public DataByteArray exec(Tuple input) throws IOException { if (input.size() != 2) throw new GeoException("MakePoint takes two numerical arguments"); double x = ESRIGeometryParser.parseDouble(input.get(0)); double y = ESRIGeometryParser.parseDouble(input.get(1)); Point point = new Point(x, y); OGCPoint ogc_point = new OGCPoint(point, SpatialReference.create(4326)); return new DataByteArray(ogc_point.asBinary().array()); } }
public STMakePointEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext ctx) throws HyracksDataException { resultStorage = new ArrayBackedValueStorage(); out = resultStorage.getDataOutput(); inputArg0 = new VoidPointable(); inputArg1 = new VoidPointable(); eval0 = args[0].createScalarEvaluator(ctx); eval1 = args[1].createScalarEvaluator(ctx); point = new Point(0, 0); pointGeometry = new AGeometry(new OGCPoint(point, SpatialReference.create(4326))); }
public STMakePoint3DEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext ctx) throws HyracksDataException { resultStorage = new ArrayBackedValueStorage(); out = resultStorage.getDataOutput(); inputArg0 = new VoidPointable(); inputArg1 = new VoidPointable(); inputArg2 = new VoidPointable(); eval0 = args[0].createScalarEvaluator(ctx); eval1 = args[1].createScalarEvaluator(ctx); eval2 = args[2].createScalarEvaluator(ctx); point = new Point(0, 0, 0); pointGeometry = new AGeometry(new OGCPoint(point, SpatialReference.create(4326))); }