geometry

AMD: require(["esri/geometry"], (geometry) => { /* code goes here */ });
ESM: import * as geometry from "@arcgis/core/geometry.js";
Object: esri/geometry
Since: ArcGIS Maps SDK for JavaScript 4.6
Deprecated since version 4.32. Use unionTypes to import union types, or individual modules to import classes.

A convenience module for importing Geometry classes when developing with TypeScript. For example, rather than importing geometries one at a time like this:

import Point from "esri/geometry/Point";
import Polygon from "esri/geometry/Polygon";
import Polyline from "esri/geometry/Polyline";

You can use this module to import them on a single line:

import { Point, Polygon, Polyline } from "esri/geometry";

This module also allows you to implement type guards on geometries, making your code smarter.

import { GeometryUnion } from "esri/unionTypes";

function logGeometry(geometry: Geometry): void {
  if (geometry.type === "point") {
    // new at 4.6, the compiler knows the geometry is a Point instance
    console.log("point coords: ", geometry.x, geometry.y, geometry.z);
  }
  else {
    // the compiler knows the geometry must be a `Extent | Polygon | Multipoint | Polyline`
    console.log("The value is a geometry, but isn't a point.")
  }
}

Type Definitions

Extent

Type Definition
Extent Extent
Deprecated since version 4.32. Import Extent directly instead.

Extent.

Geometry

Type Definition
Geometry Extent |Multipoint |Point |Polygon |Polyline |Mesh
Deprecated since version 4.32. Use GeometryUnion instead.

Geometry types.

Multipoint

Type Definition
Multipoint Multipoint
Deprecated since version 4.32. Import Multipoint directly instead.

Multipoint.

Point

Type Definition
Point Point
Deprecated since version 4.32. Import Point directly instead.

Point.

Polygon

Type Definition
Polygon Polygon
Deprecated since version 4.32. Import Polygon directly instead.

Polygon.

Polyline

Type Definition
Polyline Polyline
Deprecated since version 4.32. Import Polyline directly instead.

Polyline.

SpatialReference

Type Definition
SpatialReference SpatialReference
Deprecated since version 4.32. Import SpatialReference directly instead.

Spatial Reference.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close