This file documents efforts toward establishing a public API for Rapid.
Rapid supports several URL parameters. When constructing a URL to a standalone instance
of Rapid (e.g. https://mapwith.ai/rapid
), the following parameters are available
in the hash portion of the URL:
background
- The value of theid
property of the source in Rapid's imagery list, or a custom tile URL. A custom URL is specified in the formatcustom:<url>
, where the URL can contain the standard tile URL placeholders{x}
,{y}
and{z}
/{zoom}
,{ty}
for flipped TMS-style Y coordinates, and{switch:a,b,c}
for DNS multiplexing.
Example:background=custom:https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png
comment
- Prefills the changeset comment. Pass a url encoded string.
Example:comment=CAR%20crisis%2C%20refugee%20areas%20in%20Cameroon
datasets
- A comma-separated list of dataset IDs to enable
Example:datasets=fbRoads,msBuildings,e75b56f13b404d7d8b47ef8be1c619ec
disable_features
- Disables features in the list.
Example:disable_features=water,service_roads,points,paths,boundaries
Available features:points
,traffic_roads
,service_roads
,paths
,buildings
,building_parts
,indoor
,landuse
,boundaries
,water
,rail
,pistes
,aerialways
,power
,past_future
,others
gpx
- A custom URL for loading a gpx track. Specifying agpx
parameter will automatically enable the gpx layer for display.
Example:gpx=https://tasks.hotosm.org/project/592/task/16.gpx
hashtags
- Prefills the changeset hashtags. Pass a url encoded list of event hashtags separated by commas, semicolons, or spaces. Leading '#' symbols are optional and will be added automatically. (Note that hashtag-like strings are automatically detected in thecomment
).
Example:hashtags=%23hotosm-task-592,%23MissingMaps
id
- The character 'n', 'w', or 'r', followed by the OSM ID of a node, way or relation, respectively. Selects the specified entity, and, unless amap
parameter is also provided, centers the map on it.
Example:id=n1207480649
locale
- A code specifying the localization to use, affecting the language, layout, and keyboard shortcuts. Multiple codes may be specified in order of preference. The first valid code will be the locale, while the rest will be used as fallbacks if certain text hasn't been translated. The default locale preferences are set by the browser.
Example:locale=ja
,locale=pt-BR
,locale=nl,fr,de
Available values: Any of the supported locales.map
- A slash-separatedzoom/latitude/longitude
.
Example:map=20.00/38.90085/-77.02271
maproulette
- Enable the MapRoulette task layer, optionally with comma-separated list of challenge IDs to filter.
Example:maproulette=true
-or-maproulette=<challengeIDs>
offset
- Background imagery alignment offset in meters, formatted aseast,north
.
Example:offset=-10,5
photo_overlay
- The street-level photo overlay layers to enable.
Example:photo_overlay=streetside,mapillary,kartaview
Available values:streetside
(Microsoft Bing),mapillary
,mapillary-signs
,mapillary-detections
,kartaview
photo_dates
- The range of capture dates by which to filter street-level photos. Dates are given in YYYY-MM-DD format and separated by_
. One-sided ranges are supported.
Example:photo_dates=2019-01-01_2020-12-31
,photo_dates=2019-01-01_
,photo_dates=_2020-12-31
photo_username
- The Mapillary or KartaView username by which to filter street-level photos. Multiple comma-separated usernames are supported.
Example:photo_user=quincylvania
,photo_user=quincylvania,chrisbeddow
photo
- The layer and ID of the photo to show.
Example:photo=mapillary/1157313301398079
Available prefixes:streetside
,mapillary
,kartaview
detection
- The layer and ID of the detection to show.
Example:mapillary-signs/481941836449560
Available prefixes:mapillary-detections
,mapillary-signs
presets
- A comma-separated list of preset IDs. These will be the only presets the user may select.
Example:presets=building,highway/residential,highway/unclassified
rtl=true
- Force Rapid into right-to-left mode (useful for testing).source
- Prefills the changeset source. Pass a url encoded string.
Example:source=Bing%3BMapillary
validationDisable
- The issues identified by these types/subtypes will be disabled (i.e. Issues will not be shown at all). Each parameter value should contain a urlencoded, comma-separated list of type/subtype match rules. An asterisk*
may be used as a wildcard.
Example:validationDisable=crossing_ways/highway*,crossing_ways/tunnel*
validationWarning
- The issues identified by these types/subtypes will be treated as warnings (i.e. Issues will be surfaced to the user but not block changeset upload). Each parameter value should contain a urlencoded, comma-separated list of type/subtype match rules. An asterisk*
may be used as a wildcard.
Example:validationWarning=crossing_ways/highway*,crossing_ways/tunnel*
validationError
- The issues identified by these types/subtypes will be treated as errors (i.e. Issues will be surfaced to the user but will block changeset upload). Each parameter value should contain a urlencoded, comma-separated list of type/subtype match rules. An asterisk*
may be used as a wildcard.
Example:validationError=crossing_ways/highway*,crossing_ways/tunnel*
walkthrough=true
- Start the walkthrough automatically
Rapid may be used to edit maps in a non-OpenStreetMap environment. This requires certain parts of the Rapid code to be replaced at runtime by custom code or data.
Rapid is written in a modular style and bundled with rollup.js, which makes hot code replacement tricky. (ES6 module exports are immutable live bindings). Because of this, the parts of Rapid which are designed for customization are exported as live bound objects that can be overridden at runtime before initializing the Rapid context.
Rapid's background imagery database is stored in the Rapid.fileFetcher.cache().imagery
array and can be
overridden or modified prior to creating the Rapid context.
Note that the "None" and "Custom" options will always be shown in the list.
To remove all imagery from Rapid:
Rapid.fileFetcher.cache().imagery = [];
To replace all imagery with a single source:
Rapid.fileFetcher.cache().imagery = [{
"id": "ExampleImagery",
"name": "My Imagery",
"type": "tms",
"template": "http://{switch:a,b,c}.tiles.example.com/{z}/{x}/{y}.png"
}];
Each imagery source should have the following properties:
id
- Unique identifier for this source (also used as a url parameter)name
- Display name for the sourcetype
- Source type, currently onlytms
is supportedtemplate
- Url template, valid replacement tokens include:{z}
,{x}
,{y}
- for Z/X/Y scheme{-y}
or{ty}
- for flipped Y{u}
- for quadtile scheme{switch:a,b,c}
- for parts of the url that can be cycled for connection parallelization
Optional properties:
description
- A longer source description which, if included, will be displayed in a popup when viewing the background imagery listoverlay
- Iftrue
, this is an overlay layer (a transparent layer rendered above base imagery layer). Defaults tofalse
zoomExtent
- Allowable min and max zoom levels, defaults to[0, 22]
polygon
- Array of coordinate rings within which imagery is valid. If omitted, imagery is assumed to be valid worldwideterms_url
- Url to link to when displaying the imagery termsterms_html
- Html content to display in the imagery termsterms_text
- Text content to display in the imagery termsbest
- If set totrue
, this imagery is considered "better than Bing" and may be chosen by default when Rapid starts. Will display with a star in the background imagery list. Defaults tofalse
For more details about the Rapid.fileFetcher.cache().imagery
structure, see
update_imagery.js
.