Skip to content

Commit

Permalink
fix: curl hitchmap
Browse files Browse the repository at this point in the history
  • Loading branch information
tillwenke committed Jan 9, 2025
1 parent e42cda8 commit 3f96d04
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions heatchmap/gpmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@
from .utils.utils_models import fit_gpr_silent


HERE = os.path.dirname(os.path.abspath(__file__))

Check failure on line 27 in heatchmap/gpmap.py

View workflow job for this annotation

GitHub Actions / build

Ruff (I001)

heatchmap/gpmap.py:2:1: I001 Import block is un-sorted or un-formatted

Check failure on line 27 in heatchmap/gpmap.py

View workflow job for this annotation

GitHub Actions / build

Ruff (I001)

heatchmap/gpmap.py:2:1: I001 Import block is un-sorted or un-formatted


class GPMap(MapBasedModel):
def __init__(self, region="world", resolution=10, version="prod"):
self.points_path = "dump.sqlite"
self.points_path = f"{HERE}/cache/hitchmap/dump.sqlite"
hitchmap_url = 'https://hitchmap.com/dump.sqlite'
response = requests.get(hitchmap_url)
response.raise_for_status() # Check for HTTP request errors
with open(self.points_path, "wb") as file:
file.write(response.content)

if os.path.exists("models/kernel.pkl"):
self.gpr_path = "models/kernel.pkl"
Expand Down Expand Up @@ -59,11 +67,11 @@ def __init__(self, region="world", resolution=10, version="prod"):

self.recalc_radius = 800000 # TODO: determine from model largest influence radius

here = os.path.dirname(os.path.abspath(__file__))
self.shapely_countries = f"{here}/cache/countries/ne_110m_admin_0_countries.shp"

self.shapely_countries = f"{HERE}/cache/countries/ne_110m_admin_0_countries.shp"

if not os.path.exists(self.shapely_countries):
output_dir = f"{here}/cache/countries"
output_dir = f"{HERE}/cache/countries"
os.makedirs(output_dir, exist_ok=True)

# URL for the 110m countries shapefile from Natural Earth
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import setuptools

VERSION = "0.1.9"
VERSION = "0.1.10"

NAME = "heatchmap"

Expand Down

0 comments on commit 3f96d04

Please sign in to comment.