Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "geocortex/infrastructure/GeometryUtils"

Index

Variables

Const DEFAULT_GEOMETRY_SERVICE_URI

DEFAULT_GEOMETRY_SERVICE_URI: string

Functions

_getGeometryService

  • _getGeometryService(app: Application): GeometryService
  • This "protected" method is deprecated. Use the public "getGeometryService" instead. This is being retained in order to avoid breaking external/services code that may be using it.

    Parameters

    Returns GeometryService

Private _projectLocally

  • _projectLocally(geometries: Geometry[], outSR: SpatialReference, callback: function, errback: function): void
  • Projects the geometries locally.

    Parameters

    • geometries: Geometry[]

      An array of geometries which needs to be projected.

    • outSR: SpatialReference

      outSR The spatial reference to which the geometries should be converted

    • callback: function

      A function to be called after the geometries have been projected.

        • (geometries: Geometry[]): void
        • Parameters

          • geometries: Geometry[]

          Returns void

    • errback: function

      The error callback function.

        • (error: Error): void
        • Parameters

          • error: Error

          Returns void

    Returns void

convertMetersToMapPoints

  • convertMetersToMapPoints(essentialsMap: EssentialsMap, inputMeters: number): Promise<number>
  • Converts a specified number of meters on the current map given the current coordinate system (geographic or projected) to the corresponding number of map points.

    Parameters

    • essentialsMap: EssentialsMap
    • inputMeters: number

    Returns Promise<number>

createCircle

  • createCircle(spatialReference: SpatialReference, centerPoint: Point, radius: number, ringSize: number): Polygon
  • Creates and returns a circle with given specifications

    params

    spatialReference Spatial Reference of the map centerPoint Center point of the circle radius Radius of the circle in meters ringSize Number of points in the ring that proximate the circle

    Parameters

    • spatialReference: SpatialReference
    • centerPoint: Point
    • radius: number
    • ringSize: number

    Returns Polygon

createToleranceEnvelope

  • createToleranceEnvelope(map: Map, geometry: Geometry, pixelTolerance: number): Geometry
  • Creates a tolerance envelope around a point. Only applies to points; other geometries are returned as-is.

    Parameters

    • map: Map

      The map instance.

    • geometry: Geometry

      The geometry to create an envelope for.

    • pixelTolerance: number

      A positive integer that defines the maximum number of pixels away from the point geometry. Determines the width of the generated envelope.

    Returns Geometry

cutGeometries

  • cutGeometries(geometries: Geometry[], cutter: Polyline, app: Application): Promise<Geometry[][]>
  • Split polyline or polygon geometries where they cross the cutter polyline.

    Parameters

    • geometries: Geometry[]

      The polyline or polygon geometries to cut.

    • cutter: Polyline

      The polyline used to cut the geometries.

    • app: Application

      The {@link geocortex.framework.application.Application}.

    Returns Promise<Geometry[][]>

cutGeometry

  • cutGeometry(geometry: Geometry, cutter: Geometry): Promise<Geometry[]>
  • Parameters

    • geometry: Geometry
    • cutter: Geometry

    Returns Promise<Geometry[]>

explodeGeometry

  • explodeGeometry(geometry: Geometry): Geometry[]
  • Separate a multi-part geometry into a list of individual geometries.

    Parameters

    • geometry: Geometry

      The geometry to separate.

    Returns Geometry[]

extentToPolygon

  • extentToPolygon(envelope: Extent): Polygon
  • Converts an extent to a polygon.

    Parameters

    • envelope: Extent

    Returns Polygon

fixAspectRatio

  • fixAspectRatio(newExtent: Extent, referenceExtent: Extent): Extent
  • Fixes the aspect ratio, such that the width or height of the envelope is expanded so that the aspect ratio of the envelope matches that of the reference envelope.

    Parameters

    • newExtent: Extent
    • referenceExtent: Extent

    Returns Extent

    A new envelope with the width or height adjusted to match the aspect ratio of the reference envelope.

getDatumTransformParameters

  • Retrieves the datum transform to be used when projecting geometries between the specified spatial references, and whether to transform forward.

    Parameters

    • from: SpatialReference

      The spatial reference you are projecting from.

    • to: SpatialReference

      The spatial reference you are projecting to.

    Returns DatumTransformParameters

    An object with the properties transformation and transformForward, relating to the datum transform for the given spatial reference parameters.

getEsriGeometryType

  • getEsriGeometryType(typeName: string, defaultType?: string): string
  • Returns the type of ESRI geometry

    Parameters

    • typeName: string
    • Optional defaultType: string

    Returns string

getGeometryService

  • getGeometryService(app: Application): GeometryService
  • Returns the ESRI geometry service

    Parameters

    • app: Application

      The {@link geocortex.framework.application.Application}

    Returns GeometryService

getGeometryServiceArcGisVersion

  • getGeometryServiceArcGisVersion(app: Application, geometryServiceUrl?: string): Promise<number>
  • Returns the ArcGis version that the geometry service is hosted on. Returns null if unable to resolve. The resultant promise is never rejected. If no geometry service url is provided, will retrieve version of default geometry service configured in the app.

    Parameters

    • app: Application

      The {@link geocortex.framework.application.Application}

    • Optional geometryServiceUrl: string

    Returns Promise<number>

getMiddle

  • getMiddle(geometry: Geometry): Point
  • Returns an approximation of the center point of the given geometry, as measured in Cartesian space.

    Parameters

    • geometry: Geometry

      The geometry whose center needs to be returned

    Returns Point

getMidpoint

  • getMidpoint(pointA: Point, pointB: Point): Point
  • Returns the midpoint of the line segment defined by two endpoints.

    Parameters

    • pointA: Point

      The beginning point of the line segment.

    • pointB: Point

      The ending point of the line segment.

    Returns Point

getRamerDouglasPeuckerSimplifiedGeometry

  • getRamerDouglasPeuckerSimplifiedGeometry(geom: Geometry, epsilon: number): Geometry
  • Parameters

    • geom: Geometry
    • epsilon: number

    Returns Geometry

hashGraphicGeometry

  • hashGraphicGeometry(object: Graphic | Geometry): string
  • Returns a positive integer hash (as a string) for a given esri.Graphic

    Parameters

    • object: Graphic | Geometry

      an esri.geometry.Geometry or esri.Graphic containing a geometry

    Returns string

intersects

  • intersects(geometry1: Geometry, geometry2: Geometry): Promise<boolean>
  • Determines whether or not the geometries intersect.

    Parameters

    • geometry1: Geometry

      The geometry that is tested for the intersects relationship to the other geometry.

    • geometry2: Geometry

      The geometry being intersected.

    Returns Promise<boolean>

    A promise for whether or not the geometries intersect.

isValidGeometry

  • isValidGeometry(geometry: Geometry): boolean
  • Returns true if a given geometry is valid, false otherwise.

    Parameters

    • geometry: Geometry

      The geometry to test.

    Returns boolean

needsProjection

  • Determines if there requires a projection to go between a given Spatial Reference and the current application instance.

    Parameters

    • geometry: Geometry

      The geometry we would like to determine if it needs to be projected

    • app: ViewerApplication

      An instance of the application (used to get the current map spatial reference).

    Returns boolean

pointsAreEqual

  • pointsAreEqual(a: Point, b: Point): boolean
  • Compares two point geometries for equality. Returns true if both Point structures contain the same X, Y values and spatial reference; otherwise, false.

    Parameters

    • a: Point
    • b: Point

    Returns boolean

project

  • project(projectParameters: ProjectParameters, callback: function, errback: function, app: Application): void

projectGeometry

  • projectGeometry(geometry: Geometry, outSR: SpatialReference, callback: function, errback: function, app: Application): void
  • Projects a geometry from one coordinate system to another (well-known) coordinate system, firing a failure callback on error.

    Parameters

    • geometry: Geometry

      The geometry to project.

    • outSR: SpatialReference

      The spatial reference of the target coordinate system.

    • callback: function
        • (projected: Geometry): void
        • Parameters

          • projected: Geometry

          Returns void

    • errback: function

      The error callback function.

        • (error: Error): void
        • Parameters

          • error: Error

          Returns void

    • app: Application

      An instance of the application (used to get the url to the geometry service).

    Returns void

projectGeometryWithTransform

  • projectGeometryWithTransform(geometry: Geometry, outSR: SpatialReference, transformationWkid: number, callback: function, errback: function, app: Application): void
  • Projects a geometry from one coordinate system to another (well-known) coordinate system with a transformation, firing a failure callback on error.

    Parameters

    • geometry: Geometry

      The geometry to project.

    • outSR: SpatialReference

      The spatial reference of the target coordinate system.

    • transformationWkid: number

      The WKID for the transformation to be applied.

    • callback: function
        • (projected: Geometry): void
        • Parameters

          • projected: Geometry

          Returns void

    • errback: function

      The error callback function.

        • (error: Error): void
        • Parameters

          • error: Error

          Returns void

    • app: Application

      An instance of the application (used to get the url to the geometry service).

    Returns void

registerDatumTransforms

  • Registers the datum transform to be used when projecting geometries between the specified spatial references.

    Parameters

    • datumTransforms: DatumTransform[]

      An array of datum transforms to add to the registry

    Returns void

registerDefaultDatumTransforms

  • registerDefaultDatumTransforms(): void
  • Registers default datum transforms. This includes RD New (28992), British National Grid (27700), and Czech S-JTSK(102067).

    Returns void

simplifyPolygon

  • simplifyPolygon(polygon: Polygon, callback: function, errback: function, app: Application): void
  • Simplify a polygon.

    Parameters

    • polygon: Polygon

      A single esri.geometry.Polygon.

    • callback: function

      A function to be called with a simplified polygon once completed.

        • (poly: Polygon): void
        • Parameters

          • poly: Polygon

          Returns void

    • errback: function

      The error callback function.

        • (error?: Error): void
        • Parameters

          • Optional error: Error

          Returns void

    • app: Application

      An instance of the application (used to get the url to the geometry service).

    Returns void

simplifyPolygons

  • simplifyPolygons(polygons: Polygon[], callback: function, errback: function, app: Application): void
  • Simplify the polygons.

    Parameters

    • polygons: Polygon[]

      An array of esri.geometry.Polygons.

    • callback: function

      A function to be called with the set of simplified polygons once completed.

        • (): any
        • Returns any

    • errback: function

      The error callback function.

        • (error: Error): void
        • Parameters

          • error: Error

          Returns void

    • app: Application

      An instance of the application (used to get the url to the geometry service).

    Returns void

toRing

  • toRing(env: Extent): number[][]
  • Converts an envelope to a ring.

    Parameters

    • env: Extent

    Returns number[][]

unionGeometries

  • unionGeometries(geometries: Geometry[], app?: Application): Promise<Geometry>
  • Unions an array of given geometries. All inputs must be of the same type of geometries and share one spatial reference.

    Parameters

    • geometries: Geometry[]

      The array of geometries to union

    • Optional app: Application

      Optional. The 'app' object is optional. It needs to be specified for this function to work in IE9 and IE10. (See GVH-16461 and GVH-16256)

    Returns Promise<Geometry>