Moore Spatial

GIS and Related Pursuits

By

Stupid Simple Map

Stupid Simple Map (SSMap) might be the easiest way ever to add a map to your website. You just have to add the <script> tags where you want the map to show up. There’s no making divs, no finding tile URLs, etc.

SSMap loads the Leaflet JavaScript and CSS if needed then adds a map right after the <script> tag in your HTML document.

For example, if you place

<script src='http://moorespatial.com/code/ssmap/ssmap-min.js'></script>

in your HTML document, you would see something like this:

Default SSMap map

Default SSMap map

Odds are you’d like to have some control over your map, and you do that by setting a query string to the ssmap.js file. For example:

<script src='http://moorespatial.com/code/ssmap/ssmap-min.js?lat=-90&lon=45&z=8&mark=true&tiles=map&w=50%'></script>

would give you:

SSMap with arguments

SSMap with arguments

The marker appears at the center of the map any time the coordinates are not (0,0).

 

Options

Each of these options are set in the query string. All options are optional, and I tried to provide sane defaults.

Option Default Values Notes
lat 0 Latitude (decimal degrees) -90 to 90
lon 0 Longitude (decimal degrees) -180 to 180
div random ID string Map div ID. The div also get class ssmap
h 500px Valid CSS height Height of the map div (including units)
w 500px Valid CSS Width Width of the map div (including units)
z 1 1-18 Initial zoom level
tiles sat map (street map) or sat (satelite) Which tiles to use
mark t t (true) or f (false) Place a marker at the map centerpoint if coordinates are not set to 0,0?

 

Notes For Advanced Users

For advanced usage, you’ll want to use Leaflet directly. It’s not hard, and you can customize just about anything.

You can use the JavaScript directly off of my site by linking to http://moorespatial.com/code/ssmap/ssmap-min.js or you can download it and host it on your own site.

You can download the uncompressed version on Github or here.

This script won’t work with SSL. I don’t have SSL configured on this host, and the script itself loads the Leaflet libraries via http (https isn’t available).