Skip to content

Commit 48441b1

Browse files
Merge pull request #122 from CodeForAfrica/feature/mapit
Implementing Mapit
2 parents 66a41d6 + d96f96b commit 48441b1

File tree

11 files changed

+240
-197
lines changed

11 files changed

+240
-197
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM codeforafrica/hurumap:0.1.1
1+
FROM hurumap_web:latest
22

33
# Set env variables used in this Dockerfile
44
# HURUmap App and Django settings

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ services:
3131
- PGUSER=hurumap
3232
- PGPASSWORD=hurumap
3333
- PYTHONDONTWRITEBYTECODE="True"
34+
- USE_MAPIT=True
3435
# - DJANGO_DEBUG=False # For testing deploys

elimu_yangu/settings.py

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
from django.utils.translation import ugettext_lazy as _
33
from collections import OrderedDict
4+
from distutils.util import strtobool
45

56
from hurumap.settings import * # noqa
67

@@ -77,13 +78,42 @@
7778
}
7879

7980
HURUMAP['comparative_levels'] = ["district", "region", "country"]
80-
HURUMAP['geometry_data'] = {
81-
'2009': {
82-
'country': 'geo/country.topojson',
83-
'region': 'geo/region.topojson',
84-
'district': 'geo/district.topojson'
85-
}
81+
82+
use_mapit = os.environ.get('USE_MAPIT', False)
83+
HURUMAP['USE_MAPIT'] = strtobool(use_mapit)
84+
if HURUMAP['USE_MAPIT'] == "True":
85+
# use mapit settings
86+
HURUMAP['geometry_data'] = {}
87+
HURUMAP['mapit'] = {
88+
'url': 'https://mapit.hurumap.org',
89+
'country_code': 'TZ',
90+
'generations': {
91+
'2009': '1',
92+
'2012': '1',
93+
None: '1', # this should be based on the default_geo_version wazimap setting
94+
},
95+
'code_type': 'TZA',
96+
'level_simplify': {
97+
'country': 0,
98+
'region': 0,
99+
'district': 0,
100+
'ward': 0
101+
},
102+
'map_country': {
103+
'centre': [-6.1523563, 35.6754813],
104+
'zoom': 6
105+
}
86106
}
107+
else:
108+
# use normal geojson
109+
HURUMAP['mapit'] = {}
110+
HURUMAP['geometry_data'] = {
111+
'2009': {
112+
'country': 'geo/country.topojson',
113+
'region': 'geo/region.topojson',
114+
'district': 'geo/district.topojson',
115+
}
116+
}
87117

88118
HURUMAP['ga_tracking_id'] = 'UA-91133100-8'
89119
# HURUMAP['ga_tracking_ids'] = ['UA-44795600-8','UA-91133100-4']

elimu_yangu/static/js/profile_map.js

Lines changed: 0 additions & 160 deletions
This file was deleted.

elimu_yangu/templates/homepage_country.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@
124124
<script src="{% static 'js/vendor/leaflet.label.js' %}"></script>
125125
<script src="{% static 'js/maps_static.js' %}"></script>
126126
<script src="{% static 'js/profile_map.js' %}"></script>
127+
{% if HURUMAP.USE_MAPIT %}
128+
<script src="{% static 'js/map_mapit.js' %}"></script>
129+
<script src="{% static 'js/profile_map_mapit.js' %}"></script>
130+
{% endif %}
127131
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
128132
<script src="{% static 'js/vendor/jquery.min.js' %}"></script>
129133
<script src="{% static 'js/vendor/popper.min.js' %}"></script>

hurumap_ke/settings.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from collections import OrderedDict
3+
from distutils.util import strtobool
34

45
from hurumap.settings import * # noqa
56

@@ -45,12 +46,39 @@
4546
}
4647
}
4748
HURUMAP['comparative_levels'] = ['country']
48-
HURUMAP['geometry_data'] = {
49+
50+
use_mapit = os.environ.get('USE_MAPIT', False)
51+
HURUMAP['USE_MAPIT'] = strtobool(use_mapit)
52+
if HURUMAP['USE_MAPIT'] == "True":
53+
# use mapit settings
54+
HURUMAP['geometry_data'] = {}
55+
HURUMAP['mapit'] = {
56+
'url': 'https://mapit.hurumap.org',
57+
'country_code': 'KE',
58+
'generations': {
59+
'2009': '1',
60+
None: '1', # this should be based on the default_geo_version wazimap setting
61+
},
62+
'code_type': 'KEN',
63+
'level_simplify': {
64+
'country': 0,
65+
'county': 0
66+
},
67+
'map_country': {
68+
'centre': [0.3051933453207569, 37.908818734483155],
69+
'zoom': 6
70+
}
71+
}
72+
else:
73+
# use normal geojson
74+
HURUMAP['mapit'] = {}
75+
HURUMAP['geometry_data'] = {
4976
'2009': {
5077
'country': 'geo/country.topojson',
5178
'county': 'geo/county.topojson'
79+
}
5280
}
53-
}
81+
5482

5583
HURUMAP['ga_tracking_id'] = 'UA-44795600-8'
5684

hurumap_tz/settings.py

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
from collections import OrderedDict
3+
from distutils.util import strtobool
34

45
from hurumap.settings import * # noqa
56

@@ -55,14 +56,44 @@
5556
}
5657

5758
HURUMAP['comparative_levels'] = ["region", "country"]
58-
HURUMAP['geometry_data'] = {
59-
'2009': {
60-
'country': 'geo/country.topojson',
61-
'region': 'geo/region.topojson',
62-
'district': 'geo/district.topojson',
63-
'ward': 'geo/ward.topojson'
64-
}
59+
60+
use_mapit = os.environ.get('USE_MAPIT', False)
61+
HURUMAP['USE_MAPIT'] = strtobool(use_mapit)
62+
63+
if HURUMAP['USE_MAPIT'] == "True":
64+
# use mapit settings
65+
HURUMAP['geometry_data'] = {}
66+
HURUMAP['mapit'] = {
67+
'url': 'https://mapit.hurumap.org',
68+
'country_code': 'TZ',
69+
'generations': {
70+
'2009': '1',
71+
'2012': '1',
72+
None: '1', # this should be based on the default_geo_version wazimap setting
73+
},
74+
'code_type': 'TZA',
75+
'level_simplify': {
76+
'country': 0,
77+
'region': 0,
78+
'district': 0,
79+
'ward': 0
80+
},
81+
'map_country': {
82+
'centre': [-6.1523563, 35.6754813],
83+
'zoom': 6
84+
}
6585
}
86+
else:
87+
# use normal geojson
88+
HURUMAP['mapit'] = {}
89+
HURUMAP['geometry_data'] = {
90+
'2009': {
91+
'country': 'geo/country.topojson',
92+
'region': 'geo/region.topojson',
93+
'district': 'geo/district.topojson',
94+
'ward': 'geo/ward.topojson'
95+
}
96+
}
6697

6798
HURUMAP['ga_tracking_id'] = 'UA-91133100-4'
6899

0 commit comments

Comments
 (0)