Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added OSGEO4W path setups and OS agnostic URL joins #251

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions django/src/rdwatch/server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@

_ENVIRON_PREFIX = 'RDWATCH'

if os.name == 'nt':
OSGEO4W = r"C:\OSGeo4W"
assert os.path.isdir(OSGEO4W), "Directory does not exist: " + OSGEO4W
os.environ['OSGEO4W_ROOT'] = OSGEO4W
os.environ['GDAL_DATA'] = OSGEO4W + r"\share\gdal"
os.environ['PATH'] = OSGEO4W + r"\bin;" + os.environ['PATH']


# With the default "late_binding=False", and "environ_name" is
# specified or "environ=False", even Values from non-included
Expand Down
3 changes: 2 additions & 1 deletion django/src/rdwatch/utils/stac_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from os import path
from typing import Literal, TypedDict
from urllib.request import Request, urlopen
import urllib.parse

from django.conf import settings

Expand Down Expand Up @@ -78,7 +79,7 @@ def stac_search(
) -> Results:
# Use SMART program server instead of public server
# (https://earth-search.aws.element84.com/v0/search)
url = path.join(settings.SMART_STAC_URL, 'search')
url = urllib.parse.urljoin(settings.SMART_STAC_URL, 'search')
params = SearchParams()
params['bbox'] = bbox
if timebuffer is not None:
Expand Down
3 changes: 2 additions & 1 deletion django/src/rdwatch/utils/worldview/stac_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from os import path
from typing import Literal, TypedDict
from urllib.request import Request, urlopen
import urllib.parse

from django.conf import settings

Expand Down Expand Up @@ -74,7 +75,7 @@ def worldview_search(
timebuffer: timedelta | None = None,
page: int = 1,
) -> Results:
url = path.join(settings.SMART_STAC_URL, 'search')
url = urllib.parse.urljoin(settings.SMART_STAC_URL, 'search')
params = SearchParams()
params['bbox'] = bbox
if timebuffer is not None:
Expand Down
3 changes: 2 additions & 1 deletion django/src/rdwatch/utils/worldview_processed/stac_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from os import path
from typing import Literal, TypedDict
from urllib.request import Request, urlopen
import urllib.parse

from django.conf import settings

Expand Down Expand Up @@ -67,7 +68,7 @@ def worldview_search(
timebuffer: timedelta | None = None,
page: int = 1,
) -> Results:
url = path.join(settings.SMART_STAC_URL, 'search')
url = urllib.parse.urljoin(settings.SMART_STAC_URL, 'search')
params = SearchParams()
params['bbox'] = bbox
if timebuffer is not None:
Expand Down
Loading