Package-level declarations
Types
Properties
Functions
Gives the heading from one point to another point.
Calculate the approximate center coordinates of a circle based on the start and end coordinates of a segment and the arc midpoint.
Calculate the approximate center coordinates of a circle based on a segment.
calculateHeadingOffset calculates the angle between two headings e.g. the user heading and the heading of a road.
Calculate the radius of a circle based on the chord length, arc midpoint and chord midpoint
calculateSmallestAngleBetweenLines calculates the smallest angle between two lines.
Return a triangle Polygon e.g. for use as a "field of view".
processFeatureCollection goes through the feature collection from a tile and adds it to the feature collection for the grid, deduplicating by OSM is as it goes.
Compute the Haversine distance between the two coordinates.
Calculate distance of a point (pLat,pLon) to a line defined by two other points (lat1,lon1) and (lat2,lon2). This is only valid for lines that are 'near' each other as we're using straight lines and not following the curve of the earth.
Given a Feature Collection that contains a LineString it will return a Feature Collection that contains the "exploded" LineString which are the individual segments of the LineString.
Given a Feature Collection that contains a Polygon it will return a Feature Collection that contains the "exploded" Polygon which are the individual segments of the Polygon as LineStrings.
Calculate the center coordinates of a circle based on the arc midpoint, chord bearing and radius.
findShortestDistance gets the shortest distance between two points, or between one point and an intersection. The points have to already be associated with a nearest Way and temporary start and end locations are added as connected nodes in the graph.
This represent the original iOS AHEAD_BEHIND direction type which they described like this:
Given a BoundingBox returns the coordinates for the corners.
Given a LineString object returns the bounding box for it.
Given a MultiLineString object returns the bounding box for it.
Given a MultiPoint object return the bounding box for it.
Given a MultiPolygon object returns the bounding box for it.
Given a Point object returns the bounding box for it.
Given a Polygon object returns the bounding box.
Gives the coordinates for the center of a bounding box.
This is based on the original iOS COMBINED direction type which they described like this:
Return a destination coordinate based on a starting point, bearing and distance.
Given a Feature and a location this will calculate the nearest distance to it
Given a Feature Collection and location this will calculate the nearest distance to each Feature, and return a Feature Collection that contains the distance_to data for each Feature.
Given a road Feature and a set of intersectionRelativeDirections this will return a feature collection with an entry for the road each time it appears in the intersection. Normally this would be a single Feature (one road leaving the intersection) but if the road loops around and back into the roundabout then there can be two entries - see intersectionsLoopBackTest for an example e.g. https://geojson.io/#map=18/37.339112/-122.038756
This represent the original iOS INDIVIDUAL direction type which they described like this:
Get the road names/ref/road type that make up the intersection. Intersection objects only contain "osm_ids" so we need to hook the osm_ids up with the information from the roads feature collection
Given an intersection Road names FeatureCollection, a nearest Intersection FeatureCollection and an intersectionRelativeDirections FeatureCollection. This will return a feature collection of the roads that make up the intersection tagged with their relative directions. 0 = Behind, 1 = Behind Left, 2 = Left, 3 = Ahead Left, 4 = Ahead, 5 = Ahead Right, 6 = Right, 7 = Behind Right
This represent the original iOS LEFT_RIGHT direction type which they described like this:
Gets map coordinates from X and Y GPS coordinates. This is the same calculation as above but returns normalised x and y values scaled between 0 and 1.0. These are what are required by the map-compose library to set markers/positions.
Parses out the super category Features contained in the Points of Interest (POI) Feature Collection.
Given a BoundingBox returns a closed Polygon.
Calculates a coordinate on a LineString at a target distance from the first coordinate of the LineString.
A wrapper around: getCombinedDirectionPolygons, getIndividualDirectionPolygons, getAheadBehindDirectionPolygons, getLeftRightDirectionPolygons
Given an intersection Feature and a road Feature will return the bearing of the road to the intersection
Given a super category string returns a mutable list of things in the super category. Categories taken from original Soundscape.
Given a radius and location it calculates the set of tiles (VectorTiles) that cover a circular region around the specified location.
Determines the ground resolution (in meters per pixel) at a specified latitude and level of detail.
isDuplicateByOsmId returns true if the OSM id for the feature has already been entered into the existingSet. It returns false if it's the first time, or there's no OSM id.
Check if two LineStrings intersect.
Given an array of Segments and some user geometry with the location and Field of View distance it which represent the FoV triangles it will generate a FeatureCollection of triangles.
Checks if a point is on the right side of a line segment or not.
Determine if a coordinate is contained within a polygon.
Given a FeatureCollection checks for duplicate OSM IDs and removes them.
Given a Feature Collection and location this will calculate the nearest distance to each Feature, and return a sorted Feature Collection by the distance_to foreign member for each Feature.
Calculates the Bounding Box coordinates for a Slippy Tile with a given zoom level.
Given a Feature Collection that contains a LineString it will return a Feature Collection of Points that trace along the LineString at given distance intervals. This is useful for faking the locations of a user walking down a road but isn't super accurate if you enter big distance intervals and the LineString has lots of curves or bends.