Constructors

Properties

espgWorker: EpsgLookup

Methods

  • Add a projection definition.

    Parameters

    • code: string | number

      the projection code to add.

    • proj4formula: string

      the formula for the projection.

    Returns void

  • Check whether or not a spatialReference is supported by proj4 library. Attempt to load from epsg source if not.

    Parameters

    • spatialReference: string | number | SpatialReference

      to be checked to see if it's supported by proj4. Can be ESRI SR object, WKID integer, EPSG string or WKT.

    Returns Promise<boolean>

    true if proj was defined or was able to download definition. false if out of luck

  • Utility for checking a set of spatial references, rejects if one cannot be used

    Parameters

    • spatialReferences: any[]

      set of Spatial references to be checked. Can be ESRI SR object, WKID integer, EPSG string or WKT.

    Returns Promise<void>

    resolves after all references succeed the check. rejects if any test fails.

  • Fetch a projection string from an EPSG service

    Parameters

    • code: string | number

      an EPSG projection code to look up

    Returns Promise<string>

    resolves with proj4 projection string, or rejects if not found

  • Convert a projection to an string that is compatible with proj4. If it is an SpatialReference or an integer it will be converted.

    Parameters

    • proj: string | number | SpatialReference

      an SpatialReference, integer or string. Strings will be unchanged and unchecked, ints and SpatialReference objects will be converted.

    Returns string

    A proj4 friendly projection, in the form EPSG:#### or a WKT

  • Reproject an Extent object on the client. Does not require network traffic, but may not handle conversion between projection types as well. Internally it tests 8 points along each edge and takes the max extent of the result. To project an extent without warping, convert to a polygon and do a standard geometry projection (result will not be guaranteed to retain Extent characteristics)

    Parameters

    • destProj: SrDef

      the spatial reference of the result (as SpatialReference, integer WKID or an EPSG string)

    • extent: Extent

      to reproject

    Returns Promise<Extent>

    resolves with the reprojected extent

  • Reproject a GeoJSON object in place. Note the .crs of the object will not be updated or corrected. Valid formats for the spatial reference parameters are: RAMP SpatialReference, WKID number, WKT string, or EPSG:#### string

    Parameters

    • geoJson: any
    • OptionalinputSR: string | number | SpatialReference

      spatial reference of the GeoJSON. If missing it will attempt to use any crs data in the GeoJSON, defaulting to Lat Long.

    • OptionaloutputSR: string | number | SpatialReference

      spatial reference to project to. If missing, will use Lat Long.

    Returns Promise<any>

    resolves with projected geoJson

  • Project a geometry using local calculations (proj4)

    Parameters

    • destProj: SrDef

      the spatial reference of the result (as SpatialReference, integer WKID or an EPSG string)

    • geometry: BaseGeometry

      a RAMP API Geometry object

    Returns Promise<BaseGeometry>

    resolve in a RAMP API Geometry object with co-ordinates in the destination projection

  • Provide an alternate lookup function to find proj4 projection strings based off EPSG codes. Be aware this setting is page-wide, and will impact any instance of RAMP running. Function signature should be f(code: string | number): Promise<string>. The function should be able to parse codes that are

    • just the integer part of an EPSG code (e.g. 1234)
    • a string in EPSG format (e.g. 'EPSG:1234')
    • a string in URN format (e.g. 'urn:ogc:def:crs:EPSG::1234')

    Parameters

    Returns void