-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from osmItalia/garmin
Add support for Garmin
- Loading branch information
Showing
12 changed files
with
154 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
MKGMAP_URL ?= https://www.mkgmap.org.uk/download/mkgmap-r4917.tar.gz | ||
MKGMAP_DIR = $(WORK_DIR)/mkgmap | ||
MKGMAP = $(MKGMAP_DIR)/mkgmap.jar | ||
MKGMAP_XMX = 8G | ||
MKGMAP_PRIORITY = 10 | ||
SPLITTER_URL ?= https://www.mkgmap.org.uk/download/splitter-r653.jar | ||
SPLITTER = $(MKGMAP_DIR)/splitter.jar | ||
SEA_URL = https://www.thkukuk.de/osm/data/sea-latest.zip | ||
SEA_DIR = $(MKGMAP_DIR)/sea | ||
SEA = $(SEA_DIR)/.dirstamp | ||
BOUNDS_URL = https://www.thkukuk.de/osm/data/bounds-latest.zip | ||
BOUNDS_DIR = $(MKGMAP_DIR)/bounds | ||
BOUNDS = $(BOUNDS_DIR)/.dirstamp | ||
|
||
REPO_URL = https://github.com/lucadelu/ital.img.git | ||
REPO_DIR = $(MKGMAP_DIR)/ital.img | ||
REPO = $(REPO_DIR)/.git/HEAD | ||
STYLES = styles/.directory | ||
STYLES_DIR = $(REPO_DIR)/$(dir $(STYLES)) | ||
|
||
NATION = $(notdir $(patsubst %/,%,$COUNTRY)) | ||
|
||
.PHONY: setup_garmin setup_garmin_data garmin_regioni | ||
|
||
$(MKGMAP): | ||
$(dir_guard) | ||
curl -s "$(MKGMAP_URL)" | bsdtar --strip-components 1 -xf- -C "$(MKGMAP_DIR)" | ||
|
||
$(SPLITTER): $(MKGMAP) | ||
curl -s "$(SPLITTER_URL)" -o "$@" | ||
|
||
$(SEA): | ||
$(dir_guard) | ||
curl -s "$(SEA_URL)" | bsdtar --strip-components 1 -xf- -C "$(SEA_DIR)" | ||
touch $@ | ||
|
||
$(BOUNDS): | ||
$(dir_guard) | ||
curl -s "$(BOUNDS_URL)" | bsdtar -xf- -C "$(BOUNDS_DIR)" | ||
touch $@ | ||
|
||
$(REPO): | ||
cd $(dir $(REPO_DIR)) && git clone -n --depth=1 --filter=tree:0 $(REPO_URL) $(notdir $(REPO_DIR)) | ||
|
||
$(STYLES): $(REPO) | ||
cd $(REPO_DIR) && git sparse-checkout set --no-cone $(dir $(STYLES)) | ||
cd $(REPO_DIR) && git checkout | ||
|
||
setup_garmin_data: $(SEA) $(BOUNDS) | ||
setup_garmin: $(MKGMAP) $(SPLITTER) $(STYLES) | ||
setup: setup_garmin | ||
|
||
PBF_FILES_REGIONI = $(wildcard $(PBF_DIR)/regioni/*.osm.pbf) | ||
garmin_regioni: $(subst /pbf/,/garmin/,$(PBF_FILES_REGIONI:.osm.pbf=.tar.gz)) | ||
all: garmin_regioni | ||
|
||
.NOTPARALLEL: | ||
$(OUTPUT)/garmin/%.tar.gz: $(PBF_DIR)/%.osm.pbf | ||
$(dir_guard) | ||
./scripts/garmin.sh "$<" "$@" "$(MKGMAP)" "-Xmx$(MKGMAP_XMX) --draw-priority=$(MKGMAP_PRIORITY)" "$(SPLITTER)" "-Xmx$(MKGMAP_XMX)" "$(STYLES_DIR)" "$(SEA_DIR)" "$(BOUNDS_DIR)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash -eux | ||
# | ||
# Based on https://github.com/lucadelu/ital.img by Luca Delucchi | ||
|
||
INPUT="$1" | ||
OUTPUT="$2" | ||
MKGMAP="$3" | ||
MKGMAP_OPTS="$4" | ||
SPLITTER="$5" | ||
SPLITTER_OPTS="$6" | ||
STYLES_DIR="$7" | ||
SEA_DIR="$8" | ||
BOUNDS_DIR="$9" | ||
|
||
area_id="$(basename $OUTPUT .tar)" | ||
area_name="${area_id#*_}" | ||
temp_dir="$OUTPUT".temp/ | ||
|
||
function clean() { | ||
rm -rf "${temp_dir}" | ||
} | ||
trap clean EXIT INT TERM | ||
|
||
java -jar "$SPLITTER" \ | ||
--max-areas=4096 --max-nodes=3000000 --wanted-admin-level=8 \ | ||
--output-dir="$temp_dir" "$INPUT" | ||
java -jar "$MKGMAP" \ | ||
--style-file="$STYLES_DIR/general" \ | ||
--latin1 \ | ||
--country-name=Italia \ | ||
--country-abbr="IT" \ | ||
--region-name="$area_name" \ | ||
--area-name="$area_name" \ | ||
--family-name="Mappe regionali ital.img" \ | ||
--description="$area_name" \ | ||
--precomp-sea="$SEA_DIR" \ | ||
--generate-sea \ | ||
--bounds="$BOUNDS_DIR" \ | ||
--max-jobs \ | ||
--route \ | ||
--drive-on=detect,right \ | ||
--process-destination \ | ||
--process-exits \ | ||
--location-autofill=is_in,nearest \ | ||
--index \ | ||
--split-name-index \ | ||
--housenumbers \ | ||
--add-pois-to-areas \ | ||
--link-pois-to-ways \ | ||
--preserve-element-order \ | ||
--verbose \ | ||
--name-tag-list=name,name:it,loc_name,reg_name,nat_name \ | ||
--reduce-point-density=3.2 \ | ||
--make-opposite-cycleways \ | ||
--gmapsupp \ | ||
--output-dir="$temp_dir"/ \ | ||
"$temp_dir"/*.osm.pbf | ||
tar -czf "$OUTPUT" "$temp_dir"/gmapsupp.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
-- webapp municipalities index | ||
select json_group_array( | ||
json_object( | ||
'name', name, | ||
'reg_name', reg_name, | ||
'prov_name', pro_name, | ||
'com_istat_code', com_istat_code, | ||
'prov_istat_code', pro_istat_code, | ||
'reg_istat_code', reg_istat_code | ||
'name', com.name, | ||
'prov_name', pro.name, | ||
'reg_name', reg.name, | ||
'com_istat_code', com.com_istat_code, | ||
'prov_istat_code', com.pro_istat_code, | ||
'reg_istat_code', com.reg_istat_code | ||
) | ||
) | ||
from boundaries | ||
where admin_level = 8 | ||
from boundaries as com | ||
join boundaries as pro | ||
on com.pro_istat_code = pro.ref_istat | ||
join boundaries as reg | ||
on com.reg_istat_code = reg.ref_istat | ||
where com.admin_level = 8 and | ||
pro.admin_level = 6 and | ||
reg.admin_level = 4 | ||
group by true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.