Skip to content

Commit

Permalink
fix: Use new imagery.yaml file for sources instead of hardcoding them…
Browse files Browse the repository at this point in the history
… all
  • Loading branch information
rsavoye committed Aug 29, 2023
1 parent b913024 commit 3c4ec96
Showing 1 changed file with 15 additions and 50 deletions.
65 changes: 15 additions & 50 deletions osm_fieldwork/basemapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
import concurrent.futures
import threading
from osm_fieldwork.sqlite import DataFile, MapTile
from osm_fieldwork.xlsforms import xlsforms_path
from osm_fieldwork.yamlfile import YamlFile


log = logging.getLogger(__name__)

Expand Down Expand Up @@ -137,58 +140,20 @@ def __init__(self,
# sources for imagery
self.source = source
self.sources = dict()

# Bing hybrid imagery
url = "http://ecn.t0.tiles.virtualearth.net/tiles/h%s.jpg?g=129&mkt=en&stl=H"
source = {
"name": "Bing Maps Hybrid",
"url": url,
"suffix": "jpg",
"source": "bing",
}
self.sources["bing"] = source

# ERSI imagery
url = "http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/%s"
source = {
"name": "ESRI World Imagery",
"url": url,
"suffix": "jpg",
"source": "esri",
}
self.sources["esri"] = source
self.xy = xy

# USGS Topographical map
url = "https://basemap.nationalmap.gov/ArcGIS/rest/services/USGSTopo/MapServer/tile/%s"
source = {
"name": "USGS Topographic Map",
"url": url,
"suffix": "jpg",
"source": "topo",
}
self.sources["topo"] = source

# Google Hybrid
# url = "https://mt0.google.com/vt?lyrs=s&x={x}&s=&y={y}&z={z}"
url = "https://mt0.google.com/vt?lyrs=s&%s"
source = {
"name": "Google Imagery",
"url": url,
"suffix": "jpg",
"source": "google",
}
self.sources["google"] = source

# OpenArialMap
url = "https://tiles.openaerialmap.org/63962d0d9f665400075759be/0/63962d0d9f665400075759bf/{z}/{x}/{y}"
source = {
"name": "Open Aerial Map",
"url": url,
"suffix": "png",
"source": "oam",
}
self.sources["oam"] = source
path = xlsforms_path.replace("xlsforms", "imagery.yaml")
self.yaml = YamlFile(path)

for entry in self.yaml.yaml['sources']:
for k, v in entry.items():
src = dict()
for item in v:
src['source'] = k
for k1, v1 in item.items():
# print(f"\tFIXME2: {k1} - {v1}")
src[k1] = v1
self.sources[k] = src

def customTMS(self,
url: str,
Expand Down

0 comments on commit 3c4ec96

Please sign in to comment.