aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-12-03 00:53:46 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-12-03 00:53:46 +0000
commite576e8a4581061c906de7514b5dc814857d53c31 (patch)
tree4fda7331f381339a7c6fc7735c50c1b927bad8d5
parent31c7018ca59477b6e9653902b4d8806120a223c3 (diff)
parent0a0124ee79fae4a96d1d3fb6d0f054d0f17226cd (diff)
downloadhealth-map-e576e8a4581061c906de7514b5dc814857d53c31.tar
health-map-e576e8a4581061c906de7514b5dc814857d53c31.tar.gz
Merge remote-tracking branch 'filbertkm/master' into styles
Conflicts: resources/map.js
-rw-r--r--README.md40
-rw-r--r--index.html4
-rwxr-xr-xresources/libs/locate/L.Control.Locate.css36
-rwxr-xr-xresources/libs/locate/L.Control.Locate.ie.css10
-rwxr-xr-xresources/libs/locate/L.Control.Locate.js171
-rwxr-xr-xresources/libs/locate/LICENSE9
-rwxr-xr-xresources/libs/locate/images/locate.pngbin0 -> 274 bytes
-rwxr-xr-xresources/libs/locate/images/locate.svg137
-rwxr-xr-xresources/libs/locate/images/locate_active.pngbin0 -> 610 bytes
-rw-r--r--resources/map.js5
10 files changed, 410 insertions, 2 deletions
diff --git a/README.md b/README.md
index 902e2a8..1a101dd 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,43 @@
+HealthMap
+=========
+
+# Summary
+
+[Health Map](http://jups.pegasus.uberspace.de/healthmap/) shows health care institutions like hospitals, clinics and doctors. Patients, health care workers, journalists or emergency response teams can find out which health care institutions have given property via filtering boolean attributes like wheelchairs/emergency. While displaying the institutions on a map people also see where to find them. It targets the problem [Granular Health Map](http://www.rhok.org/problems/granular-health-map).
+
+![See all health care institutions](http://jups.pegasus.uberspace.de/dropbox/all-health-care.jpg)
+
+![Filter to see only wheelchair-friendly health care institutions with emergency service](http://jups.pegasus.uberspace.de/dropbox/wheelchair-emergency.jpg)
+
+# What we accomplished during the RHoK December 2012
+
+Creating a JavaScript only application which fetches the [Overpass API](http://overpass-api.de/) (Open Street Map) for health care institutions. The app renders them on a map using [Leaflet](http://leafletjs.com/) which offers mobile friendly maps with layers and controls.
+
+# Traction
+
+For patients, HealthMap offers the ability to find the right health care institution. The see where to find one with accessability for wheelchairs, which offer a dentistry and in the future more fine-grained, custom attributes.
+
+Health care workers, health insurances, journalists and politians can explore the structure of the healt care system und understand it better.
+
+Emergency response teams can use a specialized map that works offline (thanks to Open Streat Map) and on mobile devices (thanks to leaflet) too. If an editor with predefined forms is also porvided, it is much easier for them to quickly edit the map.
+
+# Installation
+
+The map doesn't need a server. Just open index.html in a web browser or visit http://jups.pegasus.uberspace.de/healthmap/
+
+# Next steps aka TODO
+
+Set up a database where people who want to map can store extended, more fine-grained attributes for hospitals. The problem is that the Open Street Map only supports a whitelist of tags. In the long run we want to merge the new attributes (based on the problem owners needs) into the Open Street Map. This will remove the responsibility from our infrastructure.
+
+# Community help:
+
+Help convince Open Street Map community to incorporate addional attributes.
+
+Create preset forms for Open Street Map editors to make editing easier for health care mappers.
+
+
+# Dev Notes
+
Tags
* http://wiki.openstreetmap.org/wiki/Humanitarian_OSM_Tags/Humanitarian_Data_Model#Health_Facility
diff --git a/index.html b/index.html
index cd5d881..a43e773 100644
--- a/index.html
+++ b/index.html
@@ -9,9 +9,13 @@
<link rel="stylesheet" href="resources/leaflet/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="resources/leaflet/leaflet.ie.css" /><![endif]-->
+ <link rel="stylesheet" href="resources/libs/locate/L.Control.Locate.css" />
+ <!--[if lte IE 8]><link rel="stylesheet" href="resources/libs/locate/L.Control.Locate.ie.css" /><![endif]-->
+
<link rel="stylesheet" href="resources/map.css" />
<script src="resources/leaflet/leaflet-src.js"></script>
+ <script src="resources/libs/locate/L.Control.Locate.js"></script>
<script src="resources/op2geojson.js"></script>
</head>
<body>
diff --git a/resources/libs/locate/L.Control.Locate.css b/resources/libs/locate/L.Control.Locate.css
new file mode 100755
index 0000000..945732a
--- /dev/null
+++ b/resources/libs/locate/L.Control.Locate.css
@@ -0,0 +1,36 @@
+.leaflet-control-locate {
+ height: 30px;
+}
+
+.leaflet-control-locate > div {
+ -moz-border-radius: 7px;
+ -webkit-border-radius: 7px;
+ border-radius: 7px;
+}
+.leaflet-control-locate > div {
+ padding: 5px;
+ background: rgba(0, 0, 0, 0.25);
+}
+.leaflet-control-locate a {
+ background-color: rgba(255, 255, 255, 0.75);
+}
+.leaflet-control-locate a{
+ background-image: url(images/locate.png);
+ background-position: 50% 50%;
+ background-repeat: no-repeat;
+ display: block;
+}
+.leaflet-control-locate a {
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ width: 19px;
+ height: 19px;
+}
+.leaflet-control-locate a:hover {
+ background-color: #fff;
+}
+
+.leaflet-control-locate.active a {
+ background-image: url(images/locate_active.png);
+} \ No newline at end of file
diff --git a/resources/libs/locate/L.Control.Locate.ie.css b/resources/libs/locate/L.Control.Locate.ie.css
new file mode 100755
index 0000000..fdbe9d0
--- /dev/null
+++ b/resources/libs/locate/L.Control.Locate.ie.css
@@ -0,0 +1,10 @@
+
+.leaflet-control-locate > div {
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#3F000000',EndColorStr='#3F000000');
+}
+.leaflet-control-locate a {
+ background-color: #eee;
+}
+.leaflet-control-locate a:hover {
+ background-color: #fff;
+}
diff --git a/resources/libs/locate/L.Control.Locate.js b/resources/libs/locate/L.Control.Locate.js
new file mode 100755
index 0000000..b2ed522
--- /dev/null
+++ b/resources/libs/locate/L.Control.Locate.js
@@ -0,0 +1,171 @@
+L.Control.Locate = L.Control.extend({
+ options: {
+ position: 'topleft',
+ drawCircle: true,
+ follow: false, // follow with zoom and pan the user's location
+ // range circle
+ circleStyle: {
+ color: '#136AEC',
+ fillColor: '#136AEC',
+ fillOpacity: 0.15,
+ weight: 2,
+ opacity: 0.5
+ },
+ // inner marker
+ markerStyle: {
+ color: '#136AEC',
+ fillColor: '#2A93EE',
+ fillOpacity: 0.7,
+ weight: 2,
+ opacity: 0.9,
+ radius: 4
+ },
+ debug: false
+ },
+
+ onAdd: function (map) {
+ var className = 'leaflet-control-locate',
+ classNames = className + " leaflet-control",
+ container = L.DomUtil.create('div', className);
+
+ var self = this;
+ var _map = map;
+ this._layer = new L.LayerGroup();
+ this._layer.addTo(_map);
+ this._event = undefined;
+ this._locateOptions = {
+ 'setView': false,
+ 'watch': true
+ };
+ this._locateOnNextLocationFound = true;
+ this._atLocation = false;
+ this._active = false;
+
+ var wrapper = L.DomUtil.create('div', className + "-wrap", container);
+ var link = L.DomUtil.create('a', className, wrapper);
+ link.href = '#';
+ link.title = 'Show me where I am';
+
+ var _log = function(data) {
+ if (self.options.debug) {
+ console.log(data);
+ }
+ };
+
+ L.DomEvent
+ .on(link, 'click', L.DomEvent.stopPropagation)
+ .on(link, 'click', L.DomEvent.preventDefault)
+ .on(link, 'click', function() {
+ _log('at location: ' + self._atLocation);
+ if (self._atLocation && self._active) {
+ removeVisualization();
+ } else {
+ self._active = true;
+ self._locateOnNextLocationFound = true;
+ if (!self._event) {
+ map.locate(self._locateOptions);
+ } else {
+ visualizeLocation();
+ }
+ }
+ })
+ .on(link, 'dblclick', L.DomEvent.stopPropagation);
+
+ var onLocationFound = function (e) {
+ _log('onLocationFound');
+
+ if (self._event &&
+ (self._event.latlng.lat != e.latlng.lat ||
+ self._event.latlng.lon != e.latlng.lon)) {
+ _log('location has changed');
+ self._atLocation = false;
+ }
+
+ self._event = e;
+
+ if (!self._active) {
+ return;
+ }
+
+ if (self.options.follow) {
+ self._locateOnNextLocationFound = true;
+ }
+
+ visualizeLocation();
+ };
+
+ var visualizeLocation = function() {
+ _log('visualizeLocation,' + 'setView:' + self._locateOnNextLocationFound);
+
+ var radius = self._event.accuracy / 2;
+
+ if (self._locateOnNextLocationFound) {
+ self._map.fitBounds(self._event.bounds);
+ self._atLocation = true;
+ self._locateOnNextLocationFound = false;
+ }
+
+ self._layer.clearLayers();
+
+ // curcle with the radius of the location's accuracy
+ if (self.options.drawCircle) {
+ L.circle(self._event.latlng, radius, self.options.circleStyle)
+ .addTo(self._layer);
+ }
+
+ // small inner marker
+ L.circleMarker(self._event.latlng, self.options.markerStyle)
+ .bindPopup("You are within " + radius.toFixed(0) + " meters from this point")
+ .addTo(self._layer);
+
+ if (!self._container)
+ return;
+ self._container.className = classNames + " active";
+ };
+
+ var removeVisualization = function() {
+ self._container.className = classNames;
+ self._active = false;
+
+ self._layer.clearLayers();
+ };
+
+ var onLocationError = function (err) {
+ _log('onLocationError');
+
+ // ignore timeout error if the location is watched
+ if (err.code==3 && this.options.locateOptions.watch) {
+ return;
+ }
+
+ map.stopLocate();
+ removeVisualization();
+ alert(err.message);
+ };
+
+ map.on('movestart', function() {
+ self._atLocation = false;
+ });
+
+ // event hooks
+ map.on('locationfound', onLocationFound, self);
+ map.on('locationerror', onLocationError, self);
+
+ if (this.options.autoLocate) {
+ map.locate(self._locateOptions);
+ }
+
+ return container;
+ }
+});
+
+L.Map.addInitHook(function () {
+ if (this.options.locateControl) {
+ this.locateControl = L.control.locate();
+ this.addControl(this.locateControl);
+ }
+});
+
+L.control.locate = function (options) {
+ return new L.Control.Locate(options);
+};
diff --git a/resources/libs/locate/LICENSE b/resources/libs/locate/LICENSE
new file mode 100755
index 0000000..e0d82f6
--- /dev/null
+++ b/resources/libs/locate/LICENSE
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) 2012 Dominik Moritz
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/resources/libs/locate/images/locate.png b/resources/libs/locate/images/locate.png
new file mode 100755
index 0000000..9505daa
--- /dev/null
+++ b/resources/libs/locate/images/locate.png
Binary files differ
diff --git a/resources/libs/locate/images/locate.svg b/resources/libs/locate/images/locate.svg
new file mode 100755
index 0000000..40ad2be
--- /dev/null
+++ b/resources/libs/locate/images/locate.svg
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="12"
+ height="12"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.2 r9819"
+ inkscape:export-filename="/Users/dominik/Developer/JavaScript/Leaflet.locatecontrol/src/images/locate_active.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ sodipodi:docname="locate.svg">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3817">
+ <stop
+ style="stop-color:#00b1ff;stop-opacity:1;"
+ offset="0"
+ id="stop3819" />
+ <stop
+ style="stop-color:#7cf7ff;stop-opacity:1;"
+ offset="1"
+ id="stop3821" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3817"
+ id="linearGradient3823"
+ x1="6"
+ y1="8"
+ x2="6"
+ y2="4"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="15.839192"
+ inkscape:cx="1.6755728"
+ inkscape:cy="7.2132946"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:window-width="1280"
+ inkscape:window-height="709"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2985"
+ empspacing="5"
+ visible="true"
+ enabled="true"
+ snapvisiblegridlinesonly="true" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-1040.3622)">
+ <path
+ sodipodi:type="arc"
+ style="fill:url(#linearGradient3823);fill-opacity:1;stroke:none"
+ id="path3815"
+ sodipodi:cx="6"
+ sodipodi:cy="6"
+ sodipodi:rx="2"
+ sodipodi:ry="2"
+ d="M 8,6 A 2,2 0 1 1 4,6 2,2 0 1 1 8,6 z"
+ transform="matrix(2.5,0,0,2.5,-9,1031.3622)" />
+ <path
+ sodipodi:type="arc"
+ style="fill:none;stroke:#000000;stroke-width:1.79999995;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="path3786"
+ sodipodi:cx="6"
+ sodipodi:cy="6"
+ sodipodi:rx="6"
+ sodipodi:ry="6"
+ d="M 12,6 A 6,6 0 1 1 0,6 6,6 0 1 1 12,6 z"
+ transform="matrix(0.83333333,0,0,0.83333333,1,1041.3622)" />
+ <rect
+ style="fill:#000000;fill-opacity:1;stroke:none"
+ id="rect3788"
+ width="3"
+ height="2"
+ x="1"
+ y="1045.3622" />
+ <rect
+ y="1045.3622"
+ x="8"
+ height="2"
+ width="3"
+ id="rect3790"
+ style="fill:#000000;fill-opacity:1;stroke:none" />
+ <rect
+ style="fill:#000000;fill-opacity:1;stroke:none"
+ id="rect3792"
+ width="2"
+ height="3.0000174"
+ x="5"
+ y="1041.3622" />
+ <rect
+ y="1048.3622"
+ x="5"
+ height="2.9999826"
+ width="2"
+ id="rect3794"
+ style="fill:#000000;fill-opacity:1;stroke:none" />
+ </g>
+</svg>
diff --git a/resources/libs/locate/images/locate_active.png b/resources/libs/locate/images/locate_active.png
new file mode 100755
index 0000000..f1a239f
--- /dev/null
+++ b/resources/libs/locate/images/locate_active.png
Binary files differ
diff --git a/resources/map.js b/resources/map.js
index ac9a506..9cc9471 100644
--- a/resources/map.js
+++ b/resources/map.js
@@ -35,6 +35,8 @@ $(document).ready(function() {
});
GlobalMap = map;
+ L.control.locate().addTo(map);
+
function createQueryData(bbox) {
// TODO: Use POST instead of GET, for neatness
return "data=[out:json];(" +
@@ -134,11 +136,10 @@ $(document).ready(function() {
if (isHierarchical.exec(key)) {
key = key.split(':')[1];
}
- if (!_.contains(self.hospitalAttributes, key) && isBoolean(val)) {
+ if ((!_.contains(self.hospitalAttributes, key)) && isBoolean(val)) {
self.hospitalAttributes.push(key);
}
});
- self.hospitalAttributes;
}
function onLocationFound(e) {