kopia lustrzana https://github.com/openstreetmap-polska/aed-mapa
Porównaj commity
3 Commity
01b1c700e5
...
5a1831a1e7
Autor | SHA1 | Data |
---|---|---|
tomasz t | 5a1831a1e7 | |
tomasz t | 2da4460ac8 | |
tomasz t | 6eb870747d |
|
@ -42,6 +42,7 @@ jobs:
|
|||
--exclude 'requirements.txt' --exclude 'LICENSE' --exclude 'README.md' --exclude '*.ods' --exclude '*.csv' \
|
||||
--quiet /home/${{ secrets.SSH_USER }}/aed-mapa-dev/ /home/${{ secrets.SSH_USER }}/temp_deploy_dev/
|
||||
sed -i "s/<< oauth_consumer_key >>/$OAUTH_CONSUMER_KEY/;s/<< oauth_secret >>/$OAUTH_SECRET/;s|<< url >>|$OSM_API_URL|" /home/${{ secrets.SSH_USER }}/temp_deploy_dev/src/osm-integration.js
|
||||
sed -i "s|https://aed.openstreetmap.org.pl/|https://aed.openstreetmap.org.pl/dev/|g" /home/${{ secrets.SSH_USER }}/temp_deploy_dev/src/map_style.json
|
||||
rsync --update --recursive --delete \
|
||||
--exclude '*.py' --exclude '*.geojson' --exclude '.git*' --exclude 'aed_poland_metadata.json' \
|
||||
--exclude 'requirements.txt' --exclude 'LICENSE' --exclude 'README.md' --exclude '*.ods' --exclude '*.csv' \
|
||||
|
|
|
@ -9,7 +9,6 @@ from datetime import datetime, timezone
|
|||
from pathlib import Path
|
||||
|
||||
import pyexcel_ods3
|
||||
import gspread
|
||||
|
||||
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||
logger = logging.getLogger(__file__)
|
||||
|
@ -219,46 +218,6 @@ def main_overpass(
|
|||
save_json(file_path=json_metadata_file_path, data=json_metadata)
|
||||
|
||||
|
||||
def main_google_sheets(output_dir: Path, config_files_dir: Path) -> None:
|
||||
sa_credentials_json_path = (
|
||||
config_files_dir.joinpath("sa-credentials.json").resolve().as_posix()
|
||||
)
|
||||
config_path = config_files_dir.joinpath("gsheetsurl").resolve().as_posix()
|
||||
|
||||
custom_layer_file_path = output_dir.joinpath("custom_layer.geojson")
|
||||
geojson = deepcopy(geojson_template)
|
||||
|
||||
try:
|
||||
with open(config_path, "r").read() as gsheets_url:
|
||||
logger.info("Reading Google Sheets credentials.")
|
||||
gc = gspread.service_account(filename=sa_credentials_json_path)
|
||||
logger.info("Opening Google Sheets url.")
|
||||
gsheet = gc.open_by_url(gsheets_url)
|
||||
data = gsheet.worksheet("dane_raw").get_all_records()
|
||||
logger.info(
|
||||
f"Reading rows from Google Sheets. Rows to process: {len(data)}."
|
||||
)
|
||||
counter = 0
|
||||
for row in data:
|
||||
if (
|
||||
all([row["latitude"], row["longitude"]])
|
||||
and row.get("import", "UNKNOWN") == "FALSE"
|
||||
):
|
||||
geojson["features"].append(
|
||||
geojson_point_feature(
|
||||
lat=row["latitude"],
|
||||
lon=row["longitude"],
|
||||
properties={"type": row.get("typ")},
|
||||
)
|
||||
)
|
||||
counter += 1
|
||||
logger.info(f"{counter} features to export.")
|
||||
if len(geojson["features"]) > 0:
|
||||
save_json(file_path=custom_layer_file_path.as_posix(), data=geojson)
|
||||
except FileNotFoundError:
|
||||
logger.error(f"Config file not found. [config_path={config_path}]")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
this_files_dir = Path(__file__).parent.resolve()
|
||||
|
@ -275,4 +234,3 @@ if __name__ == "__main__":
|
|||
prefixes=prefix_to_add,
|
||||
col_name_map=tag_name_mapping,
|
||||
)
|
||||
main_google_sheets(output_dir=arg1, config_files_dir=arg2)
|
||||
|
|
|
@ -571,7 +571,6 @@
|
|||
}
|
||||
</script>
|
||||
<script src="./src/other-ui-stuff.js"></script>
|
||||
<script src="./src/style/layers.js"></script>
|
||||
<script src="./src/map.js"></script>
|
||||
<script src="./src/osm-integration.js"></script>
|
||||
<script src="./src/pwa-EventListeners.js" type="module"></script>
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
requests
|
||||
pyexcel-ods3==0.6.0
|
||||
gspread==5.1.1
|
||||
|
|
|
@ -14,7 +14,7 @@ const map = new maplibregl.Map({
|
|||
"maxPitch": 0,
|
||||
"dragRotate": false,
|
||||
"preserveDrawingBuffer": true,
|
||||
"style": layers
|
||||
"style": "./src/map_style.json"
|
||||
});
|
||||
|
||||
//map.scrollZoom.setWheelZoomRate(1 / 100);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
let layers = {
|
||||
{
|
||||
"version": 8,
|
||||
"metadata": {
|
||||
"maputnik:renderer": "mbgljs"
|
||||
|
@ -21,14 +21,14 @@ let layers = {
|
|||
},
|
||||
"aed-locations": {
|
||||
"type": "geojson",
|
||||
"data": "../../aed_poland.geojson",
|
||||
"data": "https://aed.openstreetmap.org.pl/aed_poland.geojson",
|
||||
"cluster": true,
|
||||
"clusterRadius": 32,
|
||||
"maxzoom": 12,
|
||||
"maxzoom": 12
|
||||
}
|
||||
},
|
||||
"glyphs": "https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",
|
||||
"sprite": "https://aed.openstreetmap.org.pl/dev/src/sprites/aed-style",
|
||||
"sprite": "https://aed.openstreetmap.org.pl/src/sprites/aed-style",
|
||||
"layers": [{
|
||||
"id": "background",
|
||||
"type": "raster",
|
||||
|
@ -75,5 +75,5 @@ let layers = {
|
|||
}
|
||||
}
|
||||
],
|
||||
"id": "53fam6b4c"
|
||||
};
|
||||
"id": "aed_map_style"
|
||||
}
|
Ładowanie…
Reference in New Issue