1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 19:22:24 +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
include_role:
name: map-vector
when: map_vector_install
name: vector-map
when: vector_map_install
tags: base, map
- name: Installing captive portal

View file

@ -1,6 +1,6 @@
map_vector_install: True
map_vector_enabled: True
map_vector_path: '{{ content_base }}/www/map-vector'
vector_map_install: True
vector_map_enabled: True
vector_map_path: '{{ content_base }}/www/vector-map'
# 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!

View file

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

View file

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

View file

@ -1,6 +1,6 @@
- name: Make sure the map-vector directory exists
- name: Make sure the vector-map directory exists
file:
path: '{{ map_vector_path }}/maplist/assets'
path: '{{ vector_map_path }}/maplist/assets'
state: directory
owner: '{{ apache_user }}'
group: '{{ apache_user }}'
@ -9,30 +9,30 @@
- name: Fetch the catalog for osm maps
get_url:
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
file:
src: "{{ map_vector_path }}/maplist/assets/regions.json"
src: "{{ vector_map_path }}/maplist/assets/regions.json"
dest: "{{ doc_root }}/common/assets/regions.json"
state: link
- name: Fetch the javascript bundle with openlayers for test page
get_url:
url: "{{ iiab_osm_url }}/../main.js"
dest: '{{ map_vector_path }}/maplist/'
dest: '{{ vector_map_path }}/maplist/'
- name: Fetch the index.html for test page
template:
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.
# So bring the bounding box definition from cloud (bboxes.geojson is big)
- name: Fetch the bounding box description for osm maps
get_url:
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
package:
@ -45,40 +45,40 @@
dest: /usr/bin/iiab-update-osm
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
- name: Copy the Countries geojson to assets
copy:
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
- name: Copy the duplicated javascript to assets
copy:
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
template:
src: map-vector.conf
dest: "/etc/{{ apache_config_dir }}/map-vector.conf"
src: vector-map.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:
src: /etc/apache2/sites-available/map-vector.conf
path: /etc/apache2/sites-enabled/map-vector.conf
src: /etc/apache2/sites-available/vector-map.conf
path: /etc/apache2/sites-enabled/vector-map.conf
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:
path: /etc/apache2/sites-enabled/map-vector.conf
path: /etc/apache2/sites-enabled/vector-map.conf
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
copy:
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
# 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
import geojson
@ -25,9 +25,9 @@ else:
doc_root = get_iiab_env('WWWROOT')
menuDefs = doc_root + "/js-menu/menu-files/menu-defs/"
map_vector_idx_dir = doc_root + "/common/assets"
#map_doc_root = '{{ map_vector_path }}'
map_doc_root = '/library/www/map-vector'
vector_map_idx_dir = doc_root + "/common/assets"
#map_doc_root = '{{ vector_map_path }}'
map_doc_root = '/library/www/vector-map'
# map_catalog will be global, assumed always available
map_catalog = {}
map_menu_def_list = []
@ -43,7 +43,7 @@ def main():
installed_maps = get_installed_regions()
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 fname in installed_maps:
@ -106,7 +106,7 @@ def get_installed_regions():
installed.append('maplist')
return installed
def write_map_vector_idx(installed_maps):
def write_vector_map_idx(installed_maps):
map_dict ={}
idx_dict = {}
for fname in installed_maps:
@ -125,7 +125,7 @@ def write_map_vector_idx(installed_maps):
idx_dict[item]['region'] = region
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))
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];
}
</script>
<script src="/map-vector/maplist/assets/osm_functions.js"></script>
<script src="/vector-map/maplist/assets/osm_functions.js"></script>
<script>
window.$ = window.$ = jQuery;
$.when(readOsmCatalog()).done(function() {
renderRegionList(false);
});
</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>

View file

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

View file

@ -352,9 +352,9 @@ mongodb_enabled: False
mongodb_port: 27018
# Regional OSM vector maps use much less disk space than bitmap/raster versions
map_vector_install: True
map_vector_enabled: True
map_vector_path: '{{ content_base }}/www/map-vector'
vector_map_install: True
vector_map_enabled: True
vector_map_path: '{{ content_base }}/www/vector-map'
# roles/sugarizer/meta/main.yml auto-invokes 2 above prereqs: mongodb & nodejs
# 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
# Regional OSM vector maps use much less disk space than bitmap/raster versions
map_vector_install: True
map_vector_enabled: True
vector_map_install: True
vector_map_enabled: True
# 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

View file

@ -230,8 +230,8 @@ moodle_enabled: False
# 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
map_vector_install: True
map_vector_enabled: True
vector_map_install: True
vector_map_enabled: True
# 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

View file

@ -230,8 +230,8 @@ moodle_enabled: False
# 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
map_vector_install: True
map_vector_enabled: True
vector_map_install: True
vector_map_enabled: True
# 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