Moore Spatial

GIS and Related Pursuits

Stupid Simple Tools

These projects are meant to be so simple, so easy to use that they obliterate the bar preventing people from using GIS.

These tools aren’t going to satisfy the needs of power users. These aren’t the tools for you if you need customization.

These are the tools you need if you just need something quick and dirty to get the job done. These are the tools you point your non-GIS friends at when they say “I want to this myself”.

These tools are Stupid Simple and they’re here to help.

 

Stupid Simple Map

Stupid Simple Map reduces the task of adding a map to your website into a single <script> tag. No including map libraries. No finding tile set URLs. Just a single <script> tag.

Usage:

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

SSMap with arguments

SSMap with arguments

Stupid Simple Tile Maker

The Stupid Simple Tile Maker is a PHP script that lets you use a single large image as a source of tiles for you map. It is smart enough to use ImageMagick, GraphicsMagick or GD. It caches the tiles and can use non-square source images.

Usage:

Use tile.php followed by the relative path to your map image in your tile layer URL. Eg.

// Leaflet Tile Layer
L.tileLayer('../tile.php/maps/black_and_white.png/{z}/{x}/{y}.png', {
  attribution: 'Map From <a href="http://github.com/stuporglue/sstiles">Stupid-Simple Tiles</a>',
  maxZoom: 18
}).addTo(map);

Stupid Simple Geocoder

The Stupid Simple Geocoder is a PHP class that uses the GeoNames free geocoder to create GeoJSON appropriate feature objects. It can be used to convert place-name strings or arrays of place-name strings into features to construct GeoJSON. The GeoNames geocoder is for city level and higher geocoding.

Usage:

require_once('ssgeocoder.php');
$ssgeocoder = new ssgeocoder();

// Fetch an array of features
$places = Array('Ironwood, MI, USA','Sacramento, MG, Brazil','Provo','Lostlandneverfoundcity');
$features = $ssgeocoder->geocode($places);

// Geocode a single place
$singlePlace = 'Vienna, Austria';
$feature = $ssgeocoder->geocode($singlePlace);

// Combine the single feature with the others
$features[$singlePlace] = $feature;

// Put the features into a GeoJSON array and convert to JSON
// Note that the $features array is actually a hash, and we just want the values
// piece of that since json_encode will make it an object if we include
// the keys
$geojson = Array(
    'type' => 'FeatureCollection',
    'features' => array_values($features)
);

$jsonString = json_encode($geojson);

print $jsonString;

Leave a Reply

Your email address will not be published. Required fields are marked *