The namespace for all UF/Geospatiale utility functions, typically for static methods.
Regular operations use Turf.performant, which is a custom fork of Turf.js. It has the same syntax, but features 60-120x the performance (average over union, difference, intersect).
See GeoJSON converters (i.e. convertMaptalksToTurf, convertTurfToMaptalks) for information on its usage. For frontend GIS editing, please review Naissance HGIS.
- Source:
Classes
Methods
(static) cleanRings(arg0_geojson_feature) → {Object|null}
Cleans rings within a GeoJSON FeatureCollection/MultiPolygon/Polygon to ensure Turf.js validity.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_geojson_feature |
Object
|
Returns:
- Type:
-
Object|null
(static) computeTPSCoefficients(arg0_mesh_points) → {Object}
Computes the Thin Plate Spline (TPS) coefficients for a given set of mesh points.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_mesh_points |
Array.<Object>
|
An array of points containing x, y (target) and src_x, src_y (source). |
(static) convertEventToWorld(arg0_e, arg1_canvas_rect, arg2_factor, arg3_buffer_offset) → {Object}
Converts a browser mouse event into world/canvas coordinate space.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_e |
MouseEvent
|
The mouse event object. |
arg1_canvas_rect |
DOMRect
|
The bounding client rectangle of the canvas. |
arg2_factor |
number
|
The current scale/zoom factor. |
arg3_buffer_offset |
number
|
The offset buffer applied to the coordinates. |
(static) convertLeafletSymbolToMaptalks(arg0_symbol) → {Object}
Converts a Leaflet symbol to Maptalks.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_symbol |
Object
|
Returns:
- Type:
-
Object
(static) convertMaptalksToTurf(arg0_geometry) → {Object|turf.Feature|null}
Converts a maptalks.Geometry into a turf.Geometry.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_geometry |
maptalks.Geometry
|
Returns:
- Type:
-
Object|turf.Feature|null
(static) convertTurfToMaptalks(arg0_geometry) → {maptalks.Geometry|maptalks.GeometryCollection}
Converts a turf.Geometry into a maptalks.Geometry
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_geometry |
turf.Geometry
|
Returns:
- Type:
-
maptalks.Geometry|maptalks.GeometryCollection
(static) delaunayTriangulate(arg0_points, arg1_image_centre) → {Array.<number>}
Performs Delaunay triangulation on a set of 2D points.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_points |
Array.<Object>
|
Array of objects with x and y properties. |
arg1_image_centre |
number
|
The coordinate to be treated as the centre for the super-triangle calculation. |
(static) drawMeshOverlay(arg0_ctx, arg1_mesh_points, arg2_mesh_triangles, arg3_factor, arg4_base_point_radius, arg5_selected_point_index)
Draws the mesh wireframe and control points onto a canvas context.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_ctx |
CanvasRenderingContext2D
|
The target canvas context. |
arg1_mesh_points |
Array.<Object>
|
Array of points representing the vertices. |
arg2_mesh_triangles |
Array.<number>
|
Flat array of vertex indices for triangles. |
arg3_factor |
number
|
Scale factor for line width and radius. |
arg4_base_point_radius |
number
|
The base radius for rendering control points. |
arg5_selected_point_index |
number
|
null
|
The index of the currently selected point, if any. |
(static) drawTriangle(arg0_ctx, arg1_image, arg2_image_display_size, arg3_src_point, arg4_src_point, arg5_src_point, arg6_dest_point, arg7_dest_point, arg8_dest_point)
Draws a textured triangle onto the canvas by mapping source points to destination points using an affine transform.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_ctx |
CanvasRenderingContext2D
|
The target canvas context. |
arg1_image |
HTMLImageElement
|
The source image to sample from. |
arg2_image_display_size |
number
|
The display size of the image coordinates. |
arg3_src_point |
Object
|
First source point {x, y}. |
arg4_src_point |
Object
|
Second source point {x, y}. |
arg5_src_point |
Object
|
Third source point {x, y}. |
arg6_dest_point |
Object
|
First destination point {x, y}. |
arg7_dest_point |
Object
|
Second destination point {x, y}. |
arg8_dest_point |
Object
|
Third destination point {x, y}. |
(static) getBarycentric(arg0_point, arg1_point, arg2_point, arg3_point) → {Object}
Calculates the barycentric coordinates of a point relative to a triangle.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_point |
Object
|
The point to test {x, y}. |
arg1_point |
Object
|
First triangle vertex. |
arg2_point |
Object
|
Second triangle vertex. |
arg3_point |
Object
|
Third triangle vertex. |
(static) getCircumcircle(arg0_point, arg1_point, arg2_point) → {Object}
Calculates the circumcircle of a triangle defined by three points.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_point |
Object
|
First point. |
arg1_point |
Object
|
Second point. |
arg2_point |
Object
|
Third point. |
(static) getCoordsType(arg0_format) → {String}
Returns the coords/geometry format the variable represents.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_format |
*
|
The coords/geometry format to input. |
Returns:
- Type:
-
String
- Either 'geojson_coords'/'geojson_geometry'/'leaflet_coords'/'leaflet_geometry'/'maptalks_coords'/'maptalks_geometry'/'naissance_coords'/'naissance_geometry'/'turf_coords'/'turf_geometry'.
(static) getEquirectangularCoordsPixel(arg0_lng, arg1_lat, arg2_optionsopt) → {Array.<number, number>|Object}
Fetches the x, y coordinate pair for a given pixel given latitude and longitude coordinates for WGS84 Equirectangular.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arg0_lng |
number
|
||||||||||||||||||||||
arg1_lat |
number
|
||||||||||||||||||||||
arg2_options |
Object
|
<optional> |
|
(static) getEquirectangularNearestPixelWith(arg0_lng, arg1_lat, arg2_optionsopt)
Checks the nearest equirectangular pixel from a raster image that fulfills a boolean condition.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arg0_lng |
number
|
||||||||||||||
arg1_lat |
number
|
||||||||||||||
arg2_options |
Object
|
<optional> |
|
(static) getEquirectangularPixelCoords(arg0_x, arg1_y, arg2_widthopt, arg3_heightopt) → {Array.<number>}
Returns a [lat, lng] array for a given pixel coordinate.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
arg0_x |
number
|
|||
arg1_y |
number
|
|||
arg2_width |
number
|
<optional> |
4320 | |
arg3_height |
number
|
<optional> |
2160 |
Returns:
- Type:
-
Array.<number>
(static) getGoogleMapsCityCoords(arg0_city_name, arg1_optionsopt) → {Array.<number>}
Geolocates a city on Google Maps if possible.
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
arg0_city_name |
string
|
||||||||||
arg1_options |
Object
|
<optional> |
|
Returns:
- Type:
-
Array.<number>
(static) getLeafletGeometryType(arg0_geometry) → {string}
Returns a Leaflet geometry type. Either 'polygon'/'line'/'point'.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_geometry |
Object
|
Returns:
- Type:
-
string
(static) getMaptalksConstantStops(arg0_base_sizeopt, arg1_base_zoomopt) → {Array.<Array.<number>>}
Returns stops fixed to map-space (i.e. for rendering borders) rather than to screen-space. Used inside of { stops: number[][] } symbols for certain Maptalks geometries.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
arg0_base_size |
number
|
<optional> |
1 | |
arg1_base_zoom |
number
|
<optional> |
0 |
(static) getNominatimSearch(arg0_search_query) → {Promise.<Array.<Object>>|undefined}
Performs a Nominatim search and returns the results in JSON form.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_search_query |
string
|
(static) getOSMCityCoords(arg0_city_name) → {Array.<number>}
Geolocates a city using OSM if possible.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_city_name |
string
|
Returns:
- Type:
-
Array.<number>
(static) getPointIndexAt(arg0_x, arg1_y, arg2_mesh_points, arg3_factor, arg4_hitbox_radius) → {number|null}
Identifies the index of a mesh point within a specific hitbox radius.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_x |
number
|
X coordinate to check. |
arg1_y |
number
|
Y coordinate to check. |
arg2_mesh_points |
Array.<Object>
|
Array of mesh points. |
arg3_factor |
number
|
Scale factor to adjust the hitbox. |
arg4_hitbox_radius |
number
|
The base radius for the selection hitbox. |
Returns:
- Type:
-
number|null
The index of the point if found, otherwise null.
(static) getPoleOfInaccessibility(arg0_feature, arg1_precisionopt) → {Array.<number>|null}
Finds the pole of inaccessibility for a GeoJSON feature. Depends on npm polylabel.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
arg0_feature |
Object
|
|||
arg1_precision |
number
|
<optional> |
0.0001 |
(static) getTPSPosition(arg0_src_x, arg1_src_y, arg2_mesh_points, arg3_coeffs_x, arg4_coeffs_y) → {Object}
Calculates the warped position of a source point using TPS coefficients.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_src_x |
number
|
The source x coordinate. |
arg1_src_y |
number
|
The source y coordinate. |
arg2_mesh_points |
Array.<Object>
|
The original mesh points. |
arg3_coeffs_x |
Array.<number>
|
Solved TPS coefficients for the X dimension. |
arg4_coeffs_y |
Array.<number>
|
Solved TPS coefficients for the Y dimension. |
(static) getTransformMatrix(arg0_src_point, arg1_src_point, arg2_src_point, arg3_dest_point, arg4_dest_point, arg5_dest_point) → {Object|null}
Computes the 2D affine transform matrix to map one triangle to another.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_src_point |
Object
|
First source point. |
arg1_src_point |
Object
|
Second source point. |
arg2_src_point |
Object
|
Third source point. |
arg3_dest_point |
Object
|
First destination point. |
arg4_dest_point |
Object
|
Second destination point. |
arg5_dest_point |
Object
|
Third destination point. |
Returns:
- Type:
-
Object|null
The matrix components {a, b, c, d, e, f} or null if the triangle is degenerate.
(static) hashGeometry(arg0_geometry, arg1_optionsopt) → {string}
Hashes a geometry to detect duplicates and ensure uniqueness.
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arg0_geometry |
Geometry
|
||||||||||||
arg1_options |
Object
|
<optional> |
|
Returns:
- Type:
-
string
(static) haversineDistance(arg0_coords, arg1_coords) → {number}
Calculates the haversine distance in km between two [lng, lat] coords.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_coords |
Array.<number>
|
|
arg1_coords |
Array.<number>
|
Returns:
- Type:
-
number
(static) isGeoJSONCoords(arg0_coords) → {boolean}
Whether the coords type being tested are loosely GeoJSON compatible.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_coords |
*
|
Returns:
- Type:
-
boolean
(static) parseCoords(arg0_coords) → {Array.<Array.<number>>}
Parses a coords string into [lng, lat] coords.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_coords |
string
|
(static) renderTPSGrid(arg0_ctx, arg1_image, arg2_image_display_size, arg3_grid_resolution, arg4_mesh_points, arg5_coeffs_x, arg6_coeffs_y)
Renders an image using a Thin Plate Spline grid warp.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_ctx |
CanvasRenderingContext2D
|
The target canvas context. |
arg1_image |
HTMLImageElement
|
The image to warp. |
arg2_image_display_size |
number
|
The logical size of the source image. |
arg3_grid_resolution |
number
|
The number of grid segments per axis. |
arg4_mesh_points |
Array.<Object>
|
The control points for the warp. |
arg5_coeffs_x |
Array.<number>
|
TPS coefficients for the X dimension. |
arg6_coeffs_y |
Array.<number>
|
TPS coefficients for the Y dimension. |
(static) solveGaussianElimination(arg0_matrix, arg1_target) → {Array.<number>}
Solves a linear system of equations using Gaussian elimination with partial pivoting.
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_matrix |
Array.<Array.<number>>
|
The coefficient matrix. |
arg1_target |
Array.<number>
|
The right-hand side vector. |
(static) sortGeometries(arg0_geometries)
Sorts Maptalks geometries in order from bottom-top (Polygon, LineString, Point)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_geometries |
Array.<maptalks.Geometry>
|
(static) splitFeature(arg0_feature, arg1_divisor_layer) → {Array.<Feature>}
Splits a feature into multiple sections based on a divisor layer.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
arg0_feature |
Feature
|
|
arg1_divisor_layer |
FeatureCollection
|
Returns:
- Type:
-
Array.<Feature>