1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00

map-vector->vector-map

This commit is contained in:
George Hunt 2019-05-04 23:04:32 -07:00
parent 582385d47f
commit b9f466c0f6
12 changed files with 49 additions and 49 deletions

View file

@ -15,8 +15,8 @@
- name: Installing vector map test page - name: Installing vector map test page
include_role: include_role:
name: map-vector name: vector-map
when: map_vector_install when: vector_map_install
tags: base, map tags: base, map
- name: Installing captive portal - name: Installing captive portal

View file

@ -1,6 +1,6 @@
map_vector_install: True vector_map_install: True
map_vector_enabled: True vector_map_enabled: True
map_vector_path: '{{ content_base }}/www/map-vector' vector_map_path: '{{ content_base }}/www/vector-map'
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml # All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing! # If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!

View file

@ -7,7 +7,7 @@ var regionGeojson = {};
var regionList = []; var regionList = [];
var regionInstalled = []; var regionInstalled = [];
var commonAssetsDir = '/common/assets/'; var commonAssetsDir = '/common/assets/';
var mapAssetsDir = '/map-vector/maplist/assets/'; var mapAssetsDir = '/vector-map/maplist/assets/';
var iiab_config_dir = '/etc/iiab/'; var iiab_config_dir = '/etc/iiab/';
var onChangeFunc = "setSize"; var onChangeFunc = "setSize";
var osmCatalog = {}; var osmCatalog = {};
@ -27,7 +27,7 @@ function readOsmIdx(){
//consoleLog ("in readOsmIdx"); //consoleLog ("in readOsmIdx");
var resp = $.ajax({ var resp = $.ajax({
type: 'GET', type: 'GET',
url: consoleJsonDir + 'map-vector-idx.json', url: consoleJsonDir + 'vector-map-idx.json',
dataType: 'json' dataType: 'json'
}) })
.done(function( data ) { .done(function( data ) {

View file

@ -1,4 +1,4 @@
<head> <head>
<meta http-equiv="refresh" content="0; URL=/map-vector/maplist/" /> <meta http-equiv="refresh" content="0; URL=/vector-map/maplist/" />
</head> </head>

View file

@ -1,6 +1,6 @@
- name: Make sure the map-vector directory exists - name: Make sure the vector-map directory exists
file: file:
path: '{{ map_vector_path }}/maplist/assets' path: '{{ vector_map_path }}/maplist/assets'
state: directory state: directory
owner: '{{ apache_user }}' owner: '{{ apache_user }}'
group: '{{ apache_user }}' group: '{{ apache_user }}'
@ -9,30 +9,30 @@
- name: Fetch the catalog for osm maps - name: Fetch the catalog for osm maps
get_url: get_url:
url: "{{ iiab_osm_url }}/assets/regions.json" url: "{{ iiab_osm_url }}/assets/regions.json"
dest: '{{ map_vector_path }}/maplist/assets/' dest: '{{ vector_map_path }}/maplist/assets/'
- name: Create a link to osm catalog in /common/assets - name: Create a link to osm catalog in /common/assets
file: file:
src: "{{ map_vector_path }}/maplist/assets/regions.json" src: "{{ vector_map_path }}/maplist/assets/regions.json"
dest: "{{ doc_root }}/common/assets/regions.json" dest: "{{ doc_root }}/common/assets/regions.json"
state: link state: link
- name: Fetch the javascript bundle with openlayers for test page - name: Fetch the javascript bundle with openlayers for test page
get_url: get_url:
url: "{{ iiab_osm_url }}/../main.js" url: "{{ iiab_osm_url }}/../main.js"
dest: '{{ map_vector_path }}/maplist/' dest: '{{ vector_map_path }}/maplist/'
- name: Fetch the index.html for test page - name: Fetch the index.html for test page
template: template:
src: "index.html" src: "index.html"
dest: '{{ map_vector_path }}/maplist/index.html' dest: '{{ vector_map_path }}/maplist/index.html'
# Bboxes (bounding boxes) are currently square. But geofabrik has non-rectangular bboxes. # Bboxes (bounding boxes) are currently square. But geofabrik has non-rectangular bboxes.
# So bring the bounding box definition from cloud (bboxes.geojson is big) # So bring the bounding box definition from cloud (bboxes.geojson is big)
- name: Fetch the bounding box description for osm maps - name: Fetch the bounding box description for osm maps
get_url: get_url:
url: "{{ iiab_osm_url }}/assets/bboxes.geojson" url: "{{ iiab_osm_url }}/assets/bboxes.geojson"
dest: '{{ map_vector_path }}/maplist/assets/' dest: '{{ vector_map_path }}/maplist/assets/'
- name: Install python-geojson package, that helps with geojson - name: Install python-geojson package, that helps with geojson
package: package:
@ -45,40 +45,40 @@
dest: /usr/bin/iiab-update-osm dest: /usr/bin/iiab-update-osm
mode: "0755" mode: "0755"
- name: Run the script that does map-vector housekeeping - name: Run the script that does vector-map housekeeping
shell: /usr/bin/iiab-update-osm shell: /usr/bin/iiab-update-osm
- name: Copy the Countries geojson to assets - name: Copy the Countries geojson to assets
copy: copy:
src: countries.json src: countries.json
dest: '{{ map_vector_path }}/maplist/assets' dest: '{{ vector_map_path }}/maplist/assets'
# It is too complicated to use a single file for both iiab and admin-console # It is too complicated to use a single file for both iiab and admin-console
- name: Copy the duplicated javascript to assets - name: Copy the duplicated javascript to assets
copy: copy:
src: osm_functions.js src: osm_functions.js
dest: '{{ map_vector_path }}/maplist/assets' dest: '{{ vector_map_path }}/maplist/assets'
- name: Install /etc/{{ apache_config_dir }}/osm-vect.conf from template - name: Install /etc/{{ apache_config_dir }}/osm-vect.conf from template
template: template:
src: map-vector.conf src: vector-map.conf
dest: "/etc/{{ apache_config_dir }}/map-vector.conf" dest: "/etc/{{ apache_config_dir }}/vector-map.conf"
- name: Create symlink map-vector.conf from sites-enabled to sites-available (debuntu, not nec for redhat) - name: Create symlink vector-map.conf from sites-enabled to sites-available (debuntu, not nec for redhat)
file: file:
src: /etc/apache2/sites-available/map-vector.conf src: /etc/apache2/sites-available/vector-map.conf
path: /etc/apache2/sites-enabled/map-vector.conf path: /etc/apache2/sites-enabled/vector-map.conf
state: link state: link
when: map_vector_enabled and is_debuntu when: vector_map_enabled and is_debuntu
- name: Remove symlink /etc/apache2/sites-enabled/map-vector.conf (debuntu) - name: Remove symlink /etc/apache2/sites-enabled/vector-map.conf (debuntu)
file: file:
path: /etc/apache2/sites-enabled/map-vector.conf path: /etc/apache2/sites-enabled/vector-map.conf
state: absent state: absent
when: not map_vector_enabled and is_debuntu when: not vector_map_enabled and is_debuntu
- name: Copy the redirect to the test page -- delete this if more than one map - name: Copy the redirect to the test page -- delete this if more than one map
copy: copy:
src: test-index.redirect src: test-index.redirect
dest: "{{ map_vector_path }}/index.html" dest: "{{ vector_map_path }}/index.html"

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
# Scan the map-vector directory, update the map-vector-idx.json, add menu-defs # Scan the vector-map directory, update the vector-map-idx.json, add menu-defs
from geojson import Feature, Point, FeatureCollection, Polygon from geojson import Feature, Point, FeatureCollection, Polygon
import geojson import geojson
@ -25,9 +25,9 @@ else:
doc_root = get_iiab_env('WWWROOT') doc_root = get_iiab_env('WWWROOT')
menuDefs = doc_root + "/js-menu/menu-files/menu-defs/" menuDefs = doc_root + "/js-menu/menu-files/menu-defs/"
map_vector_idx_dir = doc_root + "/common/assets" vector_map_idx_dir = doc_root + "/common/assets"
#map_doc_root = '{{ map_vector_path }}' #map_doc_root = '{{ vector_map_path }}'
map_doc_root = '/library/www/map-vector' map_doc_root = '/library/www/vector-map'
# map_catalog will be global, assumed always available # map_catalog will be global, assumed always available
map_catalog = {} map_catalog = {}
map_menu_def_list = [] map_menu_def_list = []
@ -43,7 +43,7 @@ def main():
installed_maps = get_installed_regions() installed_maps = get_installed_regions()
print(installed_maps) print(installed_maps)
write_map_vector_idx(installed_maps) write_vector_map_idx(installed_maps)
# For installed regions, check that a menu def exists, and it's on home page # For installed regions, check that a menu def exists, and it's on home page
for fname in installed_maps: for fname in installed_maps:
@ -106,7 +106,7 @@ def get_installed_regions():
installed.append('maplist') installed.append('maplist')
return installed return installed
def write_map_vector_idx(installed_maps): def write_vector_map_idx(installed_maps):
map_dict ={} map_dict ={}
idx_dict = {} idx_dict = {}
for fname in installed_maps: for fname in installed_maps:
@ -125,7 +125,7 @@ def write_map_vector_idx(installed_maps):
idx_dict[item]['region'] = region idx_dict[item]['region'] = region
idx_dict[item]['language'] = map_dict['perma_ref'][:2] idx_dict[item]['language'] = map_dict['perma_ref'][:2]
with open(map_vector_idx_dir + '/osm_version_idx.json','w') as idx: with open(vector_map_idx_dir + '/osm_version_idx.json','w') as idx:
idx.write(json.dumps(idx_dict,indent=2)) idx.write(json.dumps(idx_dict,indent=2))
def create_menu_def(region,default_name,intended_use='map'): def create_menu_def(region,default_name,intended_use='map'):

View file

@ -46,12 +46,12 @@
return (bytes / Math.pow(1024, e)).toFixed(2) + " " + s[e]; return (bytes / Math.pow(1024, e)).toFixed(2) + " " + s[e];
} }
</script> </script>
<script src="/map-vector/maplist/assets/osm_functions.js"></script> <script src="/vector-map/maplist/assets/osm_functions.js"></script>
<script> <script>
window.$ = window.$ = jQuery; window.$ = window.$ = jQuery;
$.when(readOsmCatalog()).done(function() { $.when(readOsmCatalog()).done(function() {
renderRegionList(false); renderRegionList(false);
}); });
</script> </script>
<script type="text/javascript" src="/map-vector/maplist/main.js"></script></body> <script type="text/javascript" src="/vector-map/maplist/main.js"></script></body>
</html> </html>

View file

@ -1,7 +1,7 @@
# For downloadable regional vector tilesets # For downloadable regional vector tilesets
Alias /maps {{ map_vector_path }} Alias /maps {{ vector_map_path }}
Alias /map-vector {{ map_vector_path }} Alias /vector-map {{ vector_map_path }}
<Directory {{ map_vector_path }}> <Directory {{ vector_map_path }}>
Options Indexes FollowSymLinks Options Indexes FollowSymLinks
AllowOverride All AllowOverride All
Require all granted Require all granted

View file

@ -352,9 +352,9 @@ mongodb_enabled: False
mongodb_port: 27018 mongodb_port: 27018
# Regional OSM vector maps use much less disk space than bitmap/raster versions # Regional OSM vector maps use much less disk space than bitmap/raster versions
map_vector_install: True vector_map_install: True
map_vector_enabled: True vector_map_enabled: True
map_vector_path: '{{ content_base }}/www/map-vector' vector_map_path: '{{ content_base }}/www/vector-map'
# roles/sugarizer/meta/main.yml auto-invokes 2 above prereqs: mongodb & nodejs # roles/sugarizer/meta/main.yml auto-invokes 2 above prereqs: mongodb & nodejs
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879 # Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879

View file

@ -230,8 +230,8 @@ moodle_enabled: True
# If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER # If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER
# Regional OSM vector maps use much less disk space than bitmap/raster versions # Regional OSM vector maps use much less disk space than bitmap/raster versions
map_vector_install: True vector_map_install: True
map_vector_enabled: True vector_map_enabled: True
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879 # Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957 # Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957

View file

@ -230,8 +230,8 @@ moodle_enabled: False
# If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER # If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER
# Regional OSM vector maps use much less disk space than bitmap/raster versions # Regional OSM vector maps use much less disk space than bitmap/raster versions
map_vector_install: True vector_map_install: True
map_vector_enabled: True vector_map_enabled: True
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879 # Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957 # Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957

View file

@ -230,8 +230,8 @@ moodle_enabled: False
# If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER # If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER
# Regional OSM vector maps use much less disk space than bitmap/raster versions # Regional OSM vector maps use much less disk space than bitmap/raster versions
map_vector_install: True vector_map_install: True
map_vector_enabled: True vector_map_enabled: True
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879 # Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957 # Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957