You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
9.8 KiB

  1. ## Base URL
  2. The base URL of the static maps API is:
  3. ```
  4. https://atlas.p3k.io/map/img
  5. ```
  6. You can run your own instance of this for better performance.
  7. ## Parameters
  8. Parameters can be included in either the query string or in the POST body.
  9. * `zoom` - optional - Set the zoom level for the map. If not specified, a zoom level will be chosen that contains all markers on the map.
  10. * `maxzoom` - optional - When a zoom level is chosen automatically, this sets an upper limit on the zoom level that will be chosen. Useful if you know your basemaps don't have imagery past a certain zoom level.
  11. * `width` - default 300 - Width in pixels of the final image
  12. * `height` - default 300 - Height in pixels of the final image
  13. * `basemap` - default "streets" - Select the basemap
  14. * `streets` - Default [Esri street basemap](http://www.arcgis.com/home/webmap/viewer.html?webmap=7990d7ea55204450b8110d57e20c99ab)
  15. * `satellite` - Esri's [satellite basemap](http://www.arcgis.com/home/webmap/viewer.html?webmap=d802f08316e84c6592ef681c50178f17&center=-71.055499,42.364247&level=15)
  16. * `hybrid` - Satellite basemap with labels
  17. * `topo` - Esri [topographic map](http://www.arcgis.com/home/webmap/viewer.html?webmap=a72b0766aea04b48bf7a0e8c27ccc007)
  18. * `gray` - Esri gray canvas with labels
  19. * `gray-background` - Esri [gray canvas](http://www.arcgis.com/home/webmap/viewer.html?webmap=8b3d38c0819547faa83f7b7aca80bd76) without labels
  20. * `oceans` - Esri [ocean basemap](http://www.arcgis.com/home/webmap/viewer.html?webmap=5ae9e138a17842688b0b79283a4353f6&center=-122.255816,36.573652&level=8)
  21. * `national-geographic` - [National Geographic basemap](http://www.arcgis.com/home/webmap/viewer.html?webmap=d94dcdbe78e141c2b2d3a91d5ca8b9c9)
  22. * `osm` - [Open Street Map](http://www.openstreetmap.org/)
  23. * `stamen-toner` - [Stamen Toner](http://maps.stamen.com/toner/) black and white map with labels
  24. * `stamen-toner-background` - [Stamen Toner](http://maps.stamen.com/toner-background/) map without labels
  25. * `stamen-toner-lite` - [Stamen Toner Light](http://maps.stamen.com/toner-lite/) with labels
  26. * `stamen-terrain` - [Stamen Terrain](http://maps.stamen.com/terrain/) with labels
  27. * `stamen-terrain-background` - [Stamen Terrain](http://maps.stamen.com/terrain-background/) without labels
  28. * `stamen-watercolor` - [Stamen Watercolor](http://maps.stamen.com/watercolor/)
  29. * `tileurl` - To use other map tiles, you can provide the tile URL pattern. Make sure to include the literal strings `{x}` `{y}` `{z}` in the URL which will be replaced with the appropriate tile number when generating the map
  30. * `attribution` - default `none` - `none | esri | mapbox` - If you add attribution on the image in some other way, you can set this to "none", otherwise you can include the default esri or mapbox attributions
  31. * `latitude` - optional - Latitude to center the map at. Not needed if using the location parameter, or if specifying one or more markers.
  32. * `longitude` - optional - Longitude to center the map at.
  33. * `location` - optional - Free-form text that will be geocoded to center the map. Not needed if specifying a location with the latitude and longitude parameters, or if a marker is specified.
  34. * `marker[]` - Specify one or more markers to overlay on the map. Parameters are specified as: `key:value;`. See below for the full list of parameters.
  35. * `path[]` - Specify one or more paths to draw on the map. See below for the full list of parameters to draw a path.
  36. * `token` - To use external icons or tile URLs, provide an API key in the request. See below for documentation on configuring this.
  37. ## Markers
  38. * `location` - Free-form text that will be geocoded to place the pin
  39. * `lat` - If a `location` is not provided, you can specify the location with the `lat` and `lng` parameters.
  40. * `lng` - See above
  41. * `icon` - Icon to use for the marker. Must choose one of the icons provided in this library, or specify a full URL to a png image. If an invalid icon is specified, the marker will not be rendered.
  42. ### Built-In Marker Images
  43. * ![dot-large-blue](map-images/dot-large-blue.png) `dot-large-blue`
  44. * ![dot-large-gray](map-images/dot-large-gray.png) `dot-large-gray`
  45. * ![dot-large-green](map-images/dot-large-green.png) `dot-large-green`
  46. * ![dot-large-orange](map-images/dot-large-orange.png) `dot-large-orange`
  47. * ![dot-large-pink](map-images/dot-large-pink.png) `dot-large-pink`
  48. * ![dot-large-purple](map-images/dot-large-purple.png) `dot-large-purple`
  49. * ![dot-large-red](map-images/dot-large-red.png) `dot-large-red`
  50. * ![dot-large-yellow](map-images/dot-large-yellow.png) `dot-large-yellow`
  51. * ![dot-small-blue](map-images/dot-small-blue.png) `dot-small-blue`
  52. * ![dot-small-gray](map-images/dot-small-gray.png) `dot-small-gray`
  53. * ![dot-small-green](map-images/dot-small-green.png) `dot-small-green`
  54. * ![dot-small-orange](map-images/dot-small-orange.png) `dot-small-orange`
  55. * ![dot-small-pink](map-images/dot-small-pink.png) `dot-small-pink`
  56. * ![dot-small-purple](map-images/dot-small-purple.png) `dot-small-purple`
  57. * ![dot-small-red](map-images/dot-small-red.png) `dot-small-red`
  58. * ![dot-small-yellow](map-images/dot-small-yellow.png) `dot-small-yellow`
  59. * ![fb](map-images/fb.png) `fb`
  60. * ![google](map-images/google.png) `google`
  61. * ![large-blue-blank](map-images/large-blue-blank.png) `large-blue-blank`
  62. * ![large-blue-cutout](map-images/large-blue-cutout.png) `large-blue-cutout`
  63. * ![large-gray-blank](map-images/large-gray-blank.png) `large-gray-blank`
  64. * ![large-gray-cutout](map-images/large-gray-cutout.png) `large-gray-cutout`
  65. * ![large-gray-user](map-images/large-gray-user.png) `large-gray-user`
  66. * ![large-green-blank](map-images/large-green-blank.png) `large-green-blank`
  67. * ![large-green-cutout](map-images/large-green-cutout.png) `large-green-cutout`
  68. * ![large-orange-blank](map-images/large-orange-blank.png) `large-orange-blank`
  69. * ![large-orange-cutout](map-images/large-orange-cutout.png) `large-orange-cutout`
  70. * ![large-pink-blank](map-images/large-pink-blank.png) `large-pink-blank`
  71. * ![large-pink-cutout](map-images/large-pink-cutout.png) `large-pink-cutout`
  72. * ![large-purple-blank](map-images/large-purple-blank.png) `large-purple-blank`
  73. * ![large-purple-cutout](map-images/large-purple-cutout.png) `large-purple-cutout`
  74. * ![large-red-blank](map-images/large-red-blank.png) `large-red-blank`
  75. * ![large-red-cutout](map-images/large-red-cutout.png) `large-red-cutout`
  76. * ![large-yellow-blank](map-images/large-yellow-blank.png) `large-yellow-blank`
  77. * ![large-yellow-cutout](map-images/large-yellow-cutout.png) `large-yellow-cutout`
  78. * ![large-yellow-message](map-images/large-yellow-message.png) `large-yellow-message`
  79. * ![large-yellow-user](map-images/large-yellow-user.png) `large-yellow-user`
  80. * ![small-blue-blank](map-images/small-blue-blank.png) `small-blue-blank`
  81. * ![small-blue-cutout](map-images/small-blue-cutout.png) `small-blue-cutout`
  82. * ![small-gray-blank](map-images/small-gray-blank.png) `small-gray-blank`
  83. * ![small-gray-cutout](map-images/small-gray-cutout.png) `small-gray-cutout`
  84. * ![small-gray-message](map-images/small-gray-message.png) `small-gray-message`
  85. * ![small-gray-user](map-images/small-gray-user.png) `small-gray-user`
  86. * ![small-green-blank](map-images/small-green-blank.png) `small-green-blank`
  87. * ![small-green-cutout](map-images/small-green-cutout.png) `small-green-cutout`
  88. * ![small-green-user](map-images/small-green-user.png) `small-green-user`
  89. * ![small-orange-blank](map-images/small-orange-blank.png) `small-orange-blank`
  90. * ![small-orange-cutout](map-images/small-orange-cutout.png) `small-orange-cutout`
  91. * ![small-pink-blank](map-images/small-pink-blank.png) `small-pink-blank`
  92. * ![small-pink-cutout](map-images/small-pink-cutout.png) `small-pink-cutout`
  93. * ![small-pink-user](map-images/small-pink-user.png) `small-pink-user`
  94. * ![small-purple-blank](map-images/small-purple-blank.png) `small-purple-blank`
  95. * ![small-purple-cutout](map-images/small-purple-cutout.png) `small-purple-cutout`
  96. * ![small-red-blank](map-images/small-red-blank.png) `small-red-blank`
  97. * ![small-red-cutout](map-images/small-red-cutout.png) `small-red-cutout`
  98. * ![small-yellow-blank](map-images/small-yellow-blank.png) `small-yellow-blank`
  99. * ![small-yellow-cutout](map-images/small-yellow-cutout.png) `small-yellow-cutout`
  100. * ![small-yellow-user](map-images/small-yellow-user.png) `small-yellow-user`
  101. ## Authentication
  102. To be able to use externally-referenced icons or tile URLs, you will need to configure API keys and provide a token in the request. This locks down the ability to fetch external resources to only trusted users of the system.
  103. Create a file `data/apikeys.txt` and generate a random string with a tool of your choosing, and with one API key per line. Any value passed in the parameter `token` that matches the text in a line in this file will enable the request to use the restricted features that reference external URLs.
  104. ## Paths
  105. A path is specified as a list of longitude and latitudes, as well as optional properties to specify the weight and color of the path.
  106. The coordinates of the path are the first value of the property, specified as a list of coordinates similar to GeoJSON.
  107. ### Examples
  108. Simple path with default color and weight.
  109. ```
  110. path[]=[-122.651082,45.508543],[-122.653617,45.506468],[-122.654183,45.506756]
  111. ```
  112. Specifying the color and weight of the path.
  113. ```
  114. path[]=[-122.651082,45.508543],[-122.653617,45.506468],[-122.654183,45.506756];weight:6;color:0033ff
  115. ```
  116. ## Examples
  117. ### Simple map centered at a location
  118. ```
  119. https://atlas.p3k.io/map/img?basemap=gray&width=400&height=240&zoom=14&latitude=45.5165&longitude=-122.6764
  120. ```
  121. <img src="/map/img?basemap=gray&width=400&height=240&zoom=14&latitude=45.5165&longitude=-122.6764">
  122. ### Map with a marker centered at an address
  123. ```
  124. https://atlas.p3k.io/map/img?marker[]=location:920%20SW%203rd%20Ave,%20Portland,%20OR;icon:small-blue-cutout&basemap=gray&width=400&height=240&zoom=14
  125. ```
  126. <img src="/map/img?marker[]=location:920%20SW%203rd%20Ave,%20Portland,%20OR;icon:small-blue-cutout&basemap=gray&width=400&height=240&zoom=14">