Java Code Examples for com.esri.core.geometry.GeometryEngine#buffer()
The following examples show how to use
com.esri.core.geometry.GeometryEngine#buffer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BufferProcessor.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 6 votes |
private com.esri.ges.spatial.Geometry constructBuffer(double x, double y, double radius, String units, int wkidin, int wkidbuffer, int wkidout) throws GeometryException { Point center = new Point(); center.setX(x); center.setY(y); SpatialReference srIn = SpatialReference.create(wkidin); SpatialReference srBuffer = SpatialReference.create(wkidbuffer); SpatialReference srOut = SpatialReference.create(wkidout); UnitConverter uc = new UnitConverter(); String c_name = uc.findConnonicalName(units); int unitout = uc.findWkid(c_name); Unit u = new LinearUnit(unitout); Point centerProj = (Point) GeometryEngine.project(center, srIn, srBuffer); Geometry buffer = GeometryEngine.buffer(centerProj, srBuffer, radius, u); Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut); String json = GeometryEngine.geometryToJson(srOut, bufferout); return spatial.fromJson(json); }
Example 2
Source File: BufferProcessor.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 6 votes |
private Geometry constructBuffer(double x, double y, double radius, String units, int wkidin, int wkidbuffer, int wkidout) { Point center = new Point(); center.setX(x); center.setY(y); SpatialReference srIn = SpatialReference.create(wkidin); SpatialReference srBuffer = SpatialReference.create(wkidbuffer); SpatialReference srOut = SpatialReference.create(wkidout); UnitConverter uc = new UnitConverter(); String c_name = uc.findConnonicalName(units); int unitout = uc.findWkid(c_name); Unit u = LinearUnit.create(unitout); Point centerProj = (Point) GeometryEngine.project(center, srIn, srBuffer); Geometry buffer = GeometryEngine .buffer(centerProj, srBuffer, radius, u); Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut); //String json = GeometryEngine.geometryToJson(srOut, bufferout); return bufferout; }
Example 3
Source File: DemoTheatreApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 6 votes |
private void highlightGeometry(Point point) { if (point == null) { return; } graphicsLayer.removeAll(); graphicsLayer.addGraphic( new Graphic(point, new SimpleMarkerSymbol(Color.CYAN, 20, SimpleMarkerSymbol.Style.CIRCLE))); // ----------------------------------------------------------------------------------------- // Zoom to the highlighted graphic // ----------------------------------------------------------------------------------------- Geometry geometryForZoom = GeometryEngine.buffer( point, map.getSpatialReference(), map.getFullExtent().getWidth() * 0.10, map.getSpatialReference().getUnit()); map.zoomTo(geometryForZoom); }
Example 4
Source File: QueryReportProcessor.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 5 votes |
private com.esri.ges.spatial.Geometry constructBuffer(Geometry geo, double radius, Unit u) throws GeometryException, JsonParseException, IOException { com.esri.core.geometry.Geometry buffer = GeometryEngine.buffer(inGeometry, srBuffer, radius, u); com.esri.core.geometry.Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut); String json = GeometryEngine.geometryToJson(srOut, bufferout); return spatial.fromJson(json); }
Example 5
Source File: QueryReportProcessor.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 5 votes |
private MapGeometry constructBuffer(Geometry geo, double radius, Unit u) throws JsonParseException, IOException { Polygon buffer = GeometryEngine.buffer(inGeometry, srBuffer, radius, u); Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut); MapGeometry mapGeo = new MapGeometry(bufferout, srOut); return mapGeo; //String json = GeometryEngine.geometryToJson(srOut, bufferout); //return spatial.fromJson(json); }
Example 6
Source File: SpatialQProcessor.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 5 votes |
private MapGeometry constructBuffer(Geometry geo, double radius, Unit u) throws JsonParseException, IOException { Polygon buffer = GeometryEngine.buffer(inGeometry, srBuffer, radius, u); Geometry bufferout = GeometryEngine.project(buffer, srBuffer, srOut); MapGeometry mapGeo = new MapGeometry(bufferout, srOut); return mapGeo; }
Example 7
Source File: ViewshedController.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 5 votes |
/** * Displays a temporary graphic on the map representing the bounds of the viewshed * that will be calculated if the given points are used. * @param viewshedCenter the center of the proposed viewshed (i.e. the observer). * @param radius the radius of the proposed viewshed. * @see #showViewshedBoundsGraphic(com.esri.core.geometry.Point, com.esri.core.geometry.Point) * @see #removeViewshedBoundsGraphic() */ public void showViewshedBoundsGraphic(Point viewshedCenter, double radius) { Polygon buffer = GeometryEngine.buffer( viewshedCenter, mapController.getSpatialReference(), radius, mapController.getSpatialReference().getUnit()); if (0 > viewshedBoundsGraphicId) { viewshedBoundsGraphicId = addGraphic( new Graphic(buffer, VIEWSHED_BOUNDS_SYMBOL)); } else { updateGraphic(viewshedBoundsGraphicId, buffer); } }
Example 8
Source File: GeometryOnlineApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 5 votes |
@Override public void onMouseClicked(MouseEvent event) { graphicsLayer.removeAll(); // add buffer as a graphic Point mapPoint = map.toMapPoint(event.getX(), event.getY()); final Geometry buffer = GeometryEngine.buffer( mapPoint, map.getSpatialReference(), 200000, map.getSpatialReference().getUnit()); graphicsLayer.addGraphic(new Graphic(buffer, new SimpleFillSymbol(new Color(255, 0, 0, 255)))); // get states at the buffered area QueryTask queryTask = new QueryTask(featureLayer.getUrl()); QueryParameters queryParams = new QueryParameters(); queryParams.setInSpatialReference(map.getSpatialReference()); queryParams.setOutSpatialReference(map.getSpatialReference()); queryParams.setGeometry(buffer); queryParams.setReturnGeometry(true); queryParams.setOutFields(new String[] {"STATE_NAME"}); queryTask.execute(queryParams, new CallbackListener<FeatureResult>() { @Override public void onError(Throwable arg0) { // deal with any exception } @Override public void onCallback(FeatureResult result) { for (Object objFeature : result) { Feature feature = (Feature) objFeature; graphicsLayer.addGraphic(new Graphic(feature.getGeometry(), stateSymbol)); graphicsLayer.addGraphic(new Graphic(buffer, new SimpleFillSymbol(new Color(255, 0, 0, 255)))); } } }); }
Example 9
Source File: OverlayApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 5 votes |
@Override public void onMouseClicked(MouseEvent e) { Point pt = map.toMapPoint(e.getX(), e.getY()); Geometry buffer = GeometryEngine.buffer(pt, map.getSpatialReference(), 200000, map.getSpatialReference().getUnit()); Graphic g = new Graphic(buffer, bufferSymbol); graphicsLayer.addGraphic(g); }
Example 10
Source File: GeometryOnlineApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 5 votes |
@Override public void onMouseClicked(MouseEvent event) { graphicsLayer.removeAll(); // add buffer as a graphic Point mapPoint = map.toMapPoint(event.getX(), event.getY()); Geometry buffer = GeometryEngine.buffer( mapPoint, map.getSpatialReference(), 200000, map.getSpatialReference().getUnit()); graphicsLayer.addGraphic(new Graphic(buffer, new SimpleFillSymbol(new Color(100, 0, 0, 80)))); // get states at the buffered area QueryTask queryTask = new QueryTask(featureLayer.getUrl()); QueryParameters queryParams = new QueryParameters(); queryParams.setInSpatialReference(map.getSpatialReference()); queryParams.setOutSpatialReference(map.getSpatialReference()); queryParams.setGeometry(buffer); queryParams.setReturnGeometry(true); queryParams.setOutFields(new String[] {"STATE_NAME"}); queryTask.executeAsync(queryParams, new CallbackListener<FeatureResult>() { @Override public void onError(Throwable arg0) { // deal with any exception } @Override public void onCallback(FeatureResult result) { for (Object objFeature : result) { Feature feature = (Feature) objFeature; graphicsLayer.addGraphic(new Graphic(feature.getGeometry(), stateSymbol)); } } }); }
Example 11
Source File: OverlayApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 5 votes |
@Override public void onMouseClicked(MouseEvent e) { Point pt = map.toMapPoint(e.getX(), e.getY()); Geometry buffer = GeometryEngine.buffer(pt, map.getSpatialReference(), 200000, map.getSpatialReference().getUnit()); Graphic g = new Graphic(buffer, bufferSymbol); graphicsLayer.addGraphic(g); }
Example 12
Source File: GeoFunctions.java From Bats with Apache License 2.0 | 4 votes |
/** Computes a buffer around {@code geom}. */ public static Geom ST_Buffer(Geom geom, double distance) { final Polygon g = GeometryEngine.buffer(geom.g(), geom.sr(), distance); return geom.wrap(g); }
Example 13
Source File: GeoFunctions.java From Quicksql with MIT License | 4 votes |
/** Computes a buffer around {@code geom}. */ public static Geom ST_Buffer(Geom geom, double distance) { final Polygon g = GeometryEngine.buffer(geom.g(), geom.sr(), distance); return geom.wrap(g); }
Example 14
Source File: GeoFunctions.java From calcite with Apache License 2.0 | 4 votes |
/** Computes a buffer around {@code geom}. */ public static Geom ST_Buffer(Geom geom, double distance) { final Polygon g = GeometryEngine.buffer(geom.g(), geom.sr(), distance); return geom.wrap(g); }
Example 15
Source File: GeometryOfflineApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 4 votes |
/** * Handle mouse-clicks. * On left-click - draws either a polyline or a point. * On right-click - computes and draws the buffer of the polyline or point. */ @Override public void onMouseMoved(MouseEvent event) { super.onMouseMoved(event); gLayer.removeAll(); Point currPoint = jMap.toMapPoint(event.getX(), event.getY()); // point bufferedArea = GeometryEngine.buffer( currPoint, jMap.getSpatialReference(), BUFFER_DISTANCE, jMap.getSpatialReference().getUnit()); Graphic currPointGraphic = new Graphic(currPoint, GeometryOfflineApp.SYM_POINT); gLayer.addGraphic(currPointGraphic); // add the buffered area to the graphics layer Graphic bufferedGraphic = new Graphic(bufferedArea, GeometryOfflineApp.SYM_BUFFER); gLayer.addGraphic(bufferedGraphic); if (queryInProgress.get() == false) { // query QueryParameters query = new QueryParameters(); query.setReturnGeometry(true); query.setGeometry(bufferedArea); query.setOutFields(new String[] {"STATE_NAME"}); // execute the query. table.queryFeatures(query, new CallbackListener<FeatureResult>() { @Override public void onError(Throwable e) { e.printStackTrace(); } @Override public void onCallback(FeatureResult result) { gLayerResults.removeAll(); for (Object objFeature : result) { Feature feature = (Feature) objFeature; gLayerResults.addGraphic(new Graphic(feature.getGeometry(), SYM_BUFFER)); } queryInProgress.set(false); } }); queryInProgress.set(true); } prevPoint = null; polyLine.setEmpty(); return; }
Example 16
Source File: GeometryApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 4 votes |
/** * Handle mouse-clicks. * On left-click - draws either a polyline or a point. * On right-click - computes and draws the buffer of the polyline or point. */ @Override public void onMouseMoved(MouseEvent event) { super.onMouseMoved(event); gLayer.removeAll(); Point currPoint = jMap.toMapPoint(event.getX(), event.getY()); // point bufferedArea = GeometryEngine.buffer( currPoint, jMap.getSpatialReference(), BUFFER_DISTANCE, jMap.getSpatialReference().getUnit()); Graphic currPointGraphic = new Graphic(currPoint, GeometryApp.SYM_POINT); gLayer.addGraphic(currPointGraphic); // add the buffered area to the graphics layer Graphic bufferedGraphic = new Graphic(bufferedArea, GeometryApp.SYM_BUFFER); gLayer.addGraphic(bufferedGraphic); if (queryInProgress.get() == false) { // query QueryParameters query = new QueryParameters(); query.setReturnGeometry(true); query.setGeometry(bufferedArea); query.setOutFields(new String[] {"STATE_NAME"}); // execute the query. table.queryFeatures(query, new CallbackListener<FeatureResult>() { @Override public void onError(Throwable e) { e.printStackTrace(); } @Override public void onCallback(FeatureResult result) { gLayerResults.removeAll(); for (Object objFeature : result) { Feature feature = (Feature) objFeature; gLayerResults.addGraphic(new Graphic(feature.getGeometry(), SYM_BUFFER)); } queryInProgress.set(false); } }); queryInProgress.set(true); } prevPoint = null; polyLine.setEmpty(); return; }