Skip to content

Commit ac46c21

Browse files
committed
add local docs for static maps
1 parent e77d8b0 commit ac46c21

File tree

8 files changed

+241
-13
lines changed

8 files changed

+241
-13
lines changed

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
"saltybeagle/savant3": "dev-master",
99
"p3k/slim-savant": ">=0.1.0",
1010
"slim/slim": "^2.6",
11-
"p3k/timezone": "*"
12-
},
13-
"require-dev": {
11+
"p3k/timezone": "*",
12+
"michelf/php-markdown": "^1.9"
1413
},
1514
"autoload": {
1615
"psr-4": {

composer.lock

Lines changed: 58 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controllers/main.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
return Savant\render('index');
66
});
77

8+
$app->get('/static-maps', function() use($app) {
9+
return Savant\render('static-maps');
10+
});
11+
812
$app->get('/map', function() use($app) {
913
return Savant\render('map');
1014
});

data/static-maps.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
## Base URL
2+
3+
The base URL of the static maps API is:
4+
5+
```
6+
https://atlas.p3k.io/map/img
7+
```
8+
9+
You can run your own instance of this for better performance.
10+
11+
12+
## Parameters
13+
14+
Parameters can be included in either the query string or in the POST body.
15+
16+
* `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.
17+
* `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.
18+
* `width` - default 300 - Width in pixels of the final image
19+
* `height` - default 300 - Height in pixels of the final image
20+
* `basemap` - default "streets" - Select the basemap
21+
* `streets` - Default [Esri street basemap](http://www.arcgis.com/home/webmap/viewer.html?webmap=7990d7ea55204450b8110d57e20c99ab)
22+
* `satellite` - Esri's [satellite basemap](http://www.arcgis.com/home/webmap/viewer.html?webmap=d802f08316e84c6592ef681c50178f17&center=-71.055499,42.364247&level=15)
23+
* `hybrid` - Satellite basemap with labels
24+
* `topo` - Esri [topographic map](http://www.arcgis.com/home/webmap/viewer.html?webmap=a72b0766aea04b48bf7a0e8c27ccc007)
25+
* `gray` - Esri gray canvas with labels
26+
* `gray-background` - Esri [gray canvas](http://www.arcgis.com/home/webmap/viewer.html?webmap=8b3d38c0819547faa83f7b7aca80bd76) without labels
27+
* `oceans` - Esri [ocean basemap](http://www.arcgis.com/home/webmap/viewer.html?webmap=5ae9e138a17842688b0b79283a4353f6&center=-122.255816,36.573652&level=8)
28+
* `national-geographic` - [National Geographic basemap](http://www.arcgis.com/home/webmap/viewer.html?webmap=d94dcdbe78e141c2b2d3a91d5ca8b9c9)
29+
* `osm` - [Open Street Map](http://www.openstreetmap.org/)
30+
* `stamen-toner` - [Stamen Toner](http://maps.stamen.com/toner/) black and white map with labels
31+
* `stamen-toner-background` - [Stamen Toner](http://maps.stamen.com/toner-background/) map without labels
32+
* `stamen-toner-lite` - [Stamen Toner Light](http://maps.stamen.com/toner-lite/) with labels
33+
* `stamen-terrain` - [Stamen Terrain](http://maps.stamen.com/terrain/) with labels
34+
* `stamen-terrain-background` - [Stamen Terrain](http://maps.stamen.com/terrain-background/) without labels
35+
* `stamen-watercolor` - [Stamen Watercolor](http://maps.stamen.com/watercolor/)
36+
* `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
37+
* `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
38+
* `latitude` - optional - Latitude to center the map at. Not needed if using the location parameter, or if specifying one or more markers.
39+
* `longitude` - optional - Longitude to center the map at.
40+
* `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.
41+
* `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.
42+
* `path[]` - Specify one or more paths to draw on the map. See below for the full list of parameters to draw a path.
43+
44+
## Markers
45+
46+
* `location` - Free-form text that will be geocoded to place the pin
47+
* `lat` - If a `location` is not provided, you can specify the location with the `lat` and `lng` parameters.
48+
* `lng` - See above
49+
* `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.
50+
51+
52+
### Built-In Marker Images
53+
54+
* ![dot-large-blue](map-images/dot-large-blue.png) `dot-large-blue`
55+
* ![dot-large-gray](map-images/dot-large-gray.png) `dot-large-gray`
56+
* ![dot-large-green](map-images/dot-large-green.png) `dot-large-green`
57+
* ![dot-large-orange](map-images/dot-large-orange.png) `dot-large-orange`
58+
* ![dot-large-pink](map-images/dot-large-pink.png) `dot-large-pink`
59+
* ![dot-large-purple](map-images/dot-large-purple.png) `dot-large-purple`
60+
* ![dot-large-red](map-images/dot-large-red.png) `dot-large-red`
61+
* ![dot-large-yellow](map-images/dot-large-yellow.png) `dot-large-yellow`
62+
* ![dot-small-blue](map-images/dot-small-blue.png) `dot-small-blue`
63+
* ![dot-small-gray](map-images/dot-small-gray.png) `dot-small-gray`
64+
* ![dot-small-green](map-images/dot-small-green.png) `dot-small-green`
65+
* ![dot-small-orange](map-images/dot-small-orange.png) `dot-small-orange`
66+
* ![dot-small-pink](map-images/dot-small-pink.png) `dot-small-pink`
67+
* ![dot-small-purple](map-images/dot-small-purple.png) `dot-small-purple`
68+
* ![dot-small-red](map-images/dot-small-red.png) `dot-small-red`
69+
* ![dot-small-yellow](map-images/dot-small-yellow.png) `dot-small-yellow`
70+
* ![fb](map-images/fb.png) `fb`
71+
* ![google](map-images/google.png) `google`
72+
* ![large-blue-blank](map-images/large-blue-blank.png) `large-blue-blank`
73+
* ![large-blue-cutout](map-images/large-blue-cutout.png) `large-blue-cutout`
74+
* ![large-gray-blank](map-images/large-gray-blank.png) `large-gray-blank`
75+
* ![large-gray-cutout](map-images/large-gray-cutout.png) `large-gray-cutout`
76+
* ![large-gray-user](map-images/large-gray-user.png) `large-gray-user`
77+
* ![large-green-blank](map-images/large-green-blank.png) `large-green-blank`
78+
* ![large-green-cutout](map-images/large-green-cutout.png) `large-green-cutout`
79+
* ![large-orange-blank](map-images/large-orange-blank.png) `large-orange-blank`
80+
* ![large-orange-cutout](map-images/large-orange-cutout.png) `large-orange-cutout`
81+
* ![large-pink-blank](map-images/large-pink-blank.png) `large-pink-blank`
82+
* ![large-pink-cutout](map-images/large-pink-cutout.png) `large-pink-cutout`
83+
* ![large-purple-blank](map-images/large-purple-blank.png) `large-purple-blank`
84+
* ![large-purple-cutout](map-images/large-purple-cutout.png) `large-purple-cutout`
85+
* ![large-red-blank](map-images/large-red-blank.png) `large-red-blank`
86+
* ![large-red-cutout](map-images/large-red-cutout.png) `large-red-cutout`
87+
* ![large-yellow-blank](map-images/large-yellow-blank.png) `large-yellow-blank`
88+
* ![large-yellow-cutout](map-images/large-yellow-cutout.png) `large-yellow-cutout`
89+
* ![large-yellow-message](map-images/large-yellow-message.png) `large-yellow-message`
90+
* ![large-yellow-user](map-images/large-yellow-user.png) `large-yellow-user`
91+
* ![small-blue-blank](map-images/small-blue-blank.png) `small-blue-blank`
92+
* ![small-blue-cutout](map-images/small-blue-cutout.png) `small-blue-cutout`
93+
* ![small-gray-blank](map-images/small-gray-blank.png) `small-gray-blank`
94+
* ![small-gray-cutout](map-images/small-gray-cutout.png) `small-gray-cutout`
95+
* ![small-gray-message](map-images/small-gray-message.png) `small-gray-message`
96+
* ![small-gray-user](map-images/small-gray-user.png) `small-gray-user`
97+
* ![small-green-blank](map-images/small-green-blank.png) `small-green-blank`
98+
* ![small-green-cutout](map-images/small-green-cutout.png) `small-green-cutout`
99+
* ![small-green-user](map-images/small-green-user.png) `small-green-user`
100+
* ![small-orange-blank](map-images/small-orange-blank.png) `small-orange-blank`
101+
* ![small-orange-cutout](map-images/small-orange-cutout.png) `small-orange-cutout`
102+
* ![small-pink-blank](map-images/small-pink-blank.png) `small-pink-blank`
103+
* ![small-pink-cutout](map-images/small-pink-cutout.png) `small-pink-cutout`
104+
* ![small-pink-user](map-images/small-pink-user.png) `small-pink-user`
105+
* ![small-purple-blank](map-images/small-purple-blank.png) `small-purple-blank`
106+
* ![small-purple-cutout](map-images/small-purple-cutout.png) `small-purple-cutout`
107+
* ![small-red-blank](map-images/small-red-blank.png) `small-red-blank`
108+
* ![small-red-cutout](map-images/small-red-cutout.png) `small-red-cutout`
109+
* ![small-yellow-blank](map-images/small-yellow-blank.png) `small-yellow-blank`
110+
* ![small-yellow-cutout](map-images/small-yellow-cutout.png) `small-yellow-cutout`
111+
* ![small-yellow-user](map-images/small-yellow-user.png) `small-yellow-user`
112+
113+
## Paths
114+
115+
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.
116+
117+
The coordinates of the path are the first value of the property, specified as a list of coordinates similar to GeoJSON.
118+
119+
### Examples
120+
121+
Simple path with default color and weight.
122+
123+
```
124+
path[]=[-122.651082,45.508543],[-122.653617,45.506468],[-122.654183,45.506756]
125+
```
126+
127+
Specifying the color and weight of the path.
128+
129+
```
130+
path[]=[-122.651082,45.508543],[-122.653617,45.506468],[-122.654183,45.506756];weight:6;color:0033ff
131+
```
132+
133+
134+
## Examples
135+
136+
### Simple map centered at a location
137+
138+
```
139+
https://atlas.p3k.io/map/img?basemap=gray&width=400&height=240&zoom=14&latitude=45.5165&longitude=-122.6764
140+
```
141+
142+
<img src="/map/img?basemap=gray&width=400&height=240&zoom=14&latitude=45.5165&longitude=-122.6764">
143+
144+
### Map with a marker centered at an address
145+
146+
```
147+
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
148+
```
149+
150+
<img src="/map/img?marker[]=location:920%20SW%203rd%20Ave,%20Portland,%20OR;icon:small-blue-cutout&basemap=gray&width=400&height=240&zoom=14">

public/assets/styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ a:hover {
4242
h2 i.fa {
4343
font-size: 42px;
4444
}
45+
46+
.docs li {
47+
line-height: 1.2em;
48+
margin-top: 0.4em;
49+
}

views/index.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
<header>
2+
<h1>Atlas</h1>
3+
<p>Atlas is a set of APIs for looking up information about locations.</p>
4+
</header>
5+
16
<div class="page">
27

38
<h2><i class="fa fa-clock-o"></i> Timezone</h2>
@@ -39,6 +44,6 @@
3944
<p><a href="/map/img?marker[]=lat:45.5165;lng:-122.6764;icon:small-blue-cutout&amp;basemap=gray&amp;width=600&amp;height=240&amp;zoom=14">/map/img?marker[]=lat:45.5165;lng:-122.6764;icon:small-blue-cutout&amp;basemap=gray&amp;width=600&amp;height=240&amp;zoom=14</a></p>
4045
<img src="/assets/sample-map.png" width="600"/>
4146
42-
<p>See <a href="https://github.com/aaronpk/Static-Maps-API-PHP/">Static-Maps-API</a> for full API docs</p>
47+
<p><a href="/static-maps">Full API docs</a></p>
4348
4449
</div>

views/layout.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
</head>
1111
<body>
1212

13-
<header>
14-
<h1>Atlas</h1>
15-
<p>Atlas is a set of APIs for looking up information about locations.</p>
16-
</header>
17-
1813
<?= $this->fetch($this->page . '.php') ?>
1914

2015
<footer>

views/static-maps.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<header>
2+
<h1>Atlas Static Maps</h1>
3+
<p>Atlas Static Maps is an API for generating map images with markers or other overlays</p>
4+
</header>
5+
6+
7+
<div class="page docs">
8+
9+
<?php
10+
$markdown = file_get_contents(__DIR__.'/../data/static-maps.md');
11+
$html = Michelf\Markdown::defaultTransform($markdown);
12+
13+
echo $html;
14+
?>
15+
16+
</div>

0 commit comments

Comments
 (0)