diff --git a/assets/l.control.geosearch.js b/assets/l.control.geosearch.js deleted file mode 100644 index 28ca9f9..0000000 --- a/assets/l.control.geosearch.js +++ /dev/null @@ -1,204 +0,0 @@ -/* - * L.Control.GeoSearch - search for an address and zoom to its location - * https://github.com/smeijer/leaflet.control.geosearch - */ - -L.GeoSearch = {}; -L.GeoSearch.Provider = {}; - -L.GeoSearch.Result = function (x, y, label) { - this.X = x; - this.Y = y; - this.Label = label; -}; - -L.Control.GeoSearch = L.Control.extend({ - options: { - position: 'topleft' - }, - - initialize: function (options) { - this._config = {}; - L.Util.extend(this.options, options); - this.setConfig(options); - }, - - setConfig: function (options) { - this._config = { - 'provider': options.provider, - 'searchLabel': options.searchLabel || 'Enter address', - 'notFoundMessage' : options.notFoundMessage || 'Sorry, that address could not be found.', - 'zoomLevel': options.zoomLevel || 17, - 'showMarker': typeof options.showMarker !== 'undefined' ? options.showMarker : true - }; - }, - - resetLink: function(extraClass) { - var link = this._container.querySelector('a'); - link.className = 'leaflet-bar-part leaflet-bar-part-single' + ' ' + extraClass; - }, - - onAdd: function (map) { - - // create the container - this._container = L.DomUtil.create('div', 'leaflet-bar leaflet-control leaflet-control-geosearch'); - - // create the link - this will contain one of the icons - var link = L.DomUtil.create('a', '', this._container); - link.href = '#'; - link.title = this._config.searchLabel; - - // set the link's icon to magnifying glass - this.resetLink('glass'); - - var displayNoneClass = 'displayNone'; - - // create the form that will contain the input - var form = L.DomUtil.create('form', displayNoneClass, this._container); - - // create the input, and set its placeholder ("Enter address") text - var input = L.DomUtil.create('input', null, form); - input.placeholder = 'Enter address'; - - // create the error message div - var message = L.DomUtil.create('div', 'leaflet-bar message displayNone', this._container); - - L.DomEvent - .on(link, 'click', L.DomEvent.stopPropagation) - .on(link, 'click', L.DomEvent.preventDefault) - .on(link, 'click', function() { - - if (L.DomUtil.hasClass(form, displayNoneClass)) { - L.DomUtil.removeClass(form, 'displayNone'); // unhide form - input.focus(); - } else { - L.DomUtil.addClass(form, 'displayNone'); // hide form - } - - }) - .on(link, 'dblclick', L.DomEvent.stopPropagation); - - L.DomEvent - .on(input, 'keypress', this.onKeyPress, this) - .on(input, 'keyup', this.onKeyUp, this) - .on(input, 'input', this.onInput, this); - - return this._container; - }, - - geosearch: function (qry) { - try { - var provider = this._config.provider; - - if(typeof provider.GetLocations == 'function') { - var results = provider.GetLocations(qry, this._map, function(err, results) { - if (err) { - return this._printError(err); - } - - this._processResults(results); - }.bind(this)); - } - else { - var url = provider.GetServiceUrl(qry); - - $.getJSON(url, function (data) { - try { - var results = provider.ParseJSON(data); - this._processResults(results); - } - catch (error) { - this._printError(error); - } - }.bind(this)); - } - } - catch (error) { - this._printError(error); - } - }, - - _processResults: function(results) { - if (results.length === 0) - throw this._config.notFoundMessage; - - this.cancelSearch(); - this._showLocation(results[0]); - }, - - _showLocation: function (location) { - if (this._config.showMarker) { - if (typeof this._positionMarker === 'undefined') - this._positionMarker = L.marker([location.Y, location.X]).addTo(this._map); - else - this._positionMarker.setLatLng([location.Y, location.X]); - } - - // this._map.setView([location.Y, location.X], this._config.zoomLevel, false); - }, - - _isShowingError: false, - - _printError: function(error) { - var message = this._container.querySelector('.message'); - message.innerHTML = error; - L.DomUtil.removeClass(message, 'displayNone'); - - // show alert icon - this.resetLink('alert'); - - this._isShowingError = true; - }, - - cancelSearch: function() { - var form = this._container.querySelector('form'); - L.DomUtil.addClass(form, 'displayNone'); // hide form - - var input = form.querySelector('input'); - input.value = ''; // clear form - - // show glass icon - this.resetLink('glass'); - - var message = this._container.querySelector('.message'); - L.DomUtil.addClass(message, 'displayNone'); // hide message - }, - - startSearch: function() { - // show spinner icon - this.resetLink('spinner'); - - var input = this._container.querySelector('input'); - this.geosearch(input.value); - }, - - onInput: function() { - if (this._isShowingError) { - // show glass icon - this.resetLink('glass'); - - var message = this._container.querySelector('.message'); - L.DomUtil.addClass(message, 'displayNone'); // hide message - - this._isShowingError = false; - } - }, - - onKeyPress: function (e) { - var enterKey = 13; - - if (e.keyCode === enterKey) { - L.DomEvent.preventDefault(e); // prevent default form submission - - this.startSearch(); - } - }, - - onKeyUp: function (e) { - var escapeKey = 27; - - if (e.keyCode === escapeKey) { - this.cancelSearch(); - } - } -}); diff --git a/assets/l.geosearch.css b/assets/l.geosearch.css deleted file mode 100644 index 5e62199..0000000 --- a/assets/l.geosearch.css +++ /dev/null @@ -1,65 +0,0 @@ -.displayNone { - display: none; -} - -.leaflet-control-geosearch { - position: relative; -} - -.leaflet-control-geosearch a { - -webkit-border-radius: 4px; - border-radius: 4px; - border-bottom: none; -} - -.leaflet-control-geosearch a.glass { - background-image: url(../images/geosearch.png); - background-size: 100% 100%; -} - -.leaflet-control-geosearch a.spinner { - background-image: url(../images/spinner.gif); - background-position: 50% 50%; -} - -.leaflet-control-geosearch a.alert { - background-image: url(../images/alert.png); - background-size: 64% 64%; -} - -.leaflet-control-geosearch a:hover { - border-bottom: none; -} - -.leaflet-control-geosearch form { - position: absolute; - top: 0; - left: 22px; - box-shadow: 0 1px 7px rgba(0, 0, 0, 0.65); - -webkit-border-radius: 4px; - border-radius: 0px 4px 4px 0px; - z-index: -1; - background: #FFF; - height: 26px; - padding: 0 6px 0 6px; -} - -.leaflet-control-geosearch form input { - width: 200px; - border: none; - outline: none; - margin: 0; - padding: 0; - font-size: 12px; - margin-top: 5px; -} - -.leaflet-control-geosearch .message { - position: absolute; - top: 26px; - left: 0px; - width: 226px; - color: #FFF; - background: rgb(40, 40, 40); - padding: 4px 0 4px 8px; -} diff --git a/assets/l.geosearch.provider.openstreetmap.js b/assets/l.geosearch.provider.openstreetmap.js deleted file mode 100644 index a60a9b6..0000000 --- a/assets/l.geosearch.provider.openstreetmap.js +++ /dev/null @@ -1,70 +0,0 @@ -/** - * L.Control.GeoSearch - search for an address and zoom to it's location - * L.GeoSearch.Provider.OpenStreetMap uses openstreetmap geocoding service - * https://github.com/smeijer/leaflet.control.geosearch - */ - -L.GeoSearch.Provider.Nominatim = L.Class.extend({ - options: { - - }, - - initialize: function(options) { - options = L.Util.setOptions(this, options); - }, - - GetLocations: function(query, map, callback) { - callback = callback || function() {}; - - var url = this.GetServiceUrl(query); - - $.getJSON(url, function (data) { - var results; - - try { - results = this.ParseJSON(data); - } catch (err) { - return callback(err); - } - - if (data.length > 0) { - var bbox = data[0].boundingbox, - viewport = [ - [bbox[0], bbox[2]], - [bbox[1], bbox[3]] - ]; - - map.fitBounds(viewport, { - maxZoom: 15 - }); - } - - return callback(null, results); - }.bind(this)); - }, - - GetServiceUrl: function (qry) { - var parameters = L.Util.extend({ - q: qry, - format: 'json' - }, this.options); - - return 'http://nominatim.openstreetmap.org/search' - + L.Util.getParamString(parameters); - }, - - ParseJSON: function (data) { - if (data.length == 0) - return []; - - var results = []; - for (var i = 0; i < data.length; i++) - results.push(new L.GeoSearch.Result( - data[i].lon, - data[i].lat, - data[i].display_name - )); - - return results; - } -}); diff --git a/assets/leaflet-hash.js b/assets/leaflet-hash.js deleted file mode 100644 index 70a1007..0000000 --- a/assets/leaflet-hash.js +++ /dev/null @@ -1,162 +0,0 @@ -(function(window) { - var HAS_HASHCHANGE = (function() { - var doc_mode = window.documentMode; - return ('onhashchange' in window) && - (doc_mode === undefined || doc_mode > 7); - })(); - - L.Hash = function(map) { - this.onHashChange = L.Util.bind(this.onHashChange, this); - - if (map) { - this.init(map); - } - }; - - L.Hash.parseHash = function(hash) { - if(hash.indexOf('#') === 0) { - hash = hash.substr(1); - } - var args = hash.split("/"); - if (args.length == 3) { - var zoom = parseInt(args[0], 10), - lat = parseFloat(args[1]), - lon = parseFloat(args[2]); - if (isNaN(zoom) || isNaN(lat) || isNaN(lon)) { - return false; - } else { - return { - center: new L.LatLng(lat, lon), - zoom: zoom - }; - } - } else { - return false; - } - }; - - L.Hash.formatHash = function(map) { - var center = map.getCenter(), - zoom = map.getZoom(), - precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)); - - return "#" + [zoom, - center.lat.toFixed(precision), - center.lng.toFixed(precision) - ].join("/"); - }, - - L.Hash.prototype = { - map: null, - lastHash: null, - - parseHash: L.Hash.parseHash, - formatHash: L.Hash.formatHash, - - init: function(map) { - this.map = map; - - // reset the hash - this.lastHash = null; - this.onHashChange(); - - if (!this.isListening) { - this.startListening(); - } - }, - - removeFrom: function(map) { - if (this.changeTimeout) { - clearTimeout(this.changeTimeout); - } - - if (this.isListening) { - this.stopListening(); - } - - this.map = null; - }, - - onMapMove: function() { - // bail if we're moving the map (updating from a hash), - // or if the map is not yet loaded - - if (this.movingMap || !this.map._loaded) { - return false; - } - - var hash = this.formatHash(this.map); - if (this.lastHash != hash) { - location.replace(hash); - this.lastHash = hash; - } - }, - - movingMap: false, - update: function() { - var hash = location.hash; - if (hash === this.lastHash) { - return; - } - var parsed = this.parseHash(hash); - if (parsed) { - this.movingMap = true; - - this.map.setView(parsed.center, parsed.zoom); - - this.movingMap = false; - } else { - this.onMapMove(this.map); - } - }, - - // defer hash change updates every 100ms - changeDefer: 100, - changeTimeout: null, - onHashChange: function() { - // throttle calls to update() so that they only happen every - // `changeDefer` ms - if (!this.changeTimeout) { - var that = this; - this.changeTimeout = setTimeout(function() { - that.update(); - that.changeTimeout = null; - }, this.changeDefer); - } - }, - - isListening: false, - hashChangeInterval: null, - startListening: function() { - this.map.on("moveend", this.onMapMove, this); - - if (HAS_HASHCHANGE) { - L.DomEvent.addListener(window, "hashchange", this.onHashChange); - } else { - clearInterval(this.hashChangeInterval); - this.hashChangeInterval = setInterval(this.onHashChange, 50); - } - this.isListening = true; - }, - - stopListening: function() { - this.map.off("moveend", this.onMapMove, this); - - if (HAS_HASHCHANGE) { - L.DomEvent.removeListener(window, "hashchange", this.onHashChange); - } else { - clearInterval(this.hashChangeInterval); - } - this.isListening = false; - } - }; - L.hash = function(map) { - return new L.Hash(map); - }; - L.Map.prototype.addHash = function() { - this._hash = L.hash(this); - }; - L.Map.prototype.removeHash = function() { - this._hash.removeFrom(); - }; -})(window); diff --git a/assets/style.css b/assets/style.css deleted file mode 100644 index 3916c89..0000000 --- a/assets/style.css +++ /dev/null @@ -1,37 +0,0 @@ -html, body, #map { - height: 100%; - padding: 0; - margin: 0; -} - -#layer_selector { - position: absolute; - top: 20px; - right: 20px; - padding: 0; -} - -#layer_selector ul { - padding: 0; margin: 0; - list-style-type: none; -} - -#layer_selector li { - border-bottom: 1px solid #999; - padding: 15px 30px; - font-family: "Helvetica", Arial; - font-size: 13px; - color: #888; - cursor: auto; - background-color: #ccc; -} - -#layer_selector li:hover { - cursor: pointer; -} - -#layer_selector li.selected { - color: black; - font-style: bold; - background-color: white; -} diff --git a/assets/tutorial.mp4 b/assets/tutorial.mp4 deleted file mode 100644 index 1646b62..0000000 Binary files a/assets/tutorial.mp4 and /dev/null differ diff --git a/assets/tutorial.ogv b/assets/tutorial.ogv deleted file mode 100644 index 9231093..0000000 Binary files a/assets/tutorial.ogv and /dev/null differ