View on GitHub Sample viewer app

Create and display geodesic sectors and ellipses.

Image of geodesic sector and ellipse

Use case

Geodesic sectors and ellipses can be used in a wide range of analyses ranging from projectile landing zones to antenna coverage. For example, given the strength and direction of a cellular tower’s signal, you could generate cell coverage geometries to identify areas without sufficient connectivity.

How to use the sample

The geodesic sector and ellipse will display with default parameters at the start. Click anywhere on the map to change the center of the geometries. Adjust any of the controls to see how they affect the sector and ellipse on the fly.

How it works

  1. Create GeodesicSectorParameters and GeodesicEllipseParameters using one of the constructors with default values or using each setter individually.
  2. Set the center, axisDirection, semiAxis1Length, and the semiAxis2Length properties to change the general ellipse position, shape, and orientation.
  3. Set the sectorAngle and startDirection angles to change the sector’s shape and orientation.
  4. Set the maxPointCount and maxSegmentLength properties to control the complexity of the geometries and the approximation of the ellipse curve.
  5. Specify the geometryType to either POLYGON, POLYLINE, or MULTIPOINT to change the result geometry type.
  6. Pass the parameters to the related static methods: GeometryEngine.ellipseGeodesic(geodesicEllipseParameters) and GeometryEngine.sectorGeodesic(geodesicSectorParameters). The returned value will be a Geometry of the type specified by the geometryType parameter.

Relevant API

  • GeodesicEllipseParameters
  • GeodesicSectorParameters
  • GeometryEngine
  • GeometryType

Additional information

To create a circle instead of an ellipse, simply set semiAxis2Length to 0.0 and semiAxis1Length to the desired radius of the circle. This eliminates the need to update both parameters to the same value.

Tags

ellipse, geodesic, geometry, sector

Sample Code

module-info.java module-info.java GeodesicSectorAndEllipseController.java GeodesicSectorAndEllipseSample.java
/*
* Copyright 2022 Esri.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module com.esri.samples.geodesic_sector_and_ellipse {
// require ArcGIS Maps SDK for Java module
requires com.esri.arcgisruntime;
// handle SLF4J http://www.slf4j.org/codes.html#StaticLoggerBinder
requires org.slf4j.nop;
// require JavaFX modules that the application uses
requires javafx.graphics;
requires javafx.controls;
requires javafx.fxml;
// make all @FXML annotated objects reflectively accessible to the javafx.fxml module
opens com.esri.samples.geodesic_sector_and_ellipse to javafx.fxml;
exports com.esri.samples.geodesic_sector_and_ellipse;
}