Skip to content

Commit

Permalink
update(nldi.py): Add CRS information--"EPSG:4236"--to GeoDataFame obj…
Browse files Browse the repository at this point in the history
…ects (#142)
  • Loading branch information
jlarsen-usgs authored Jun 30, 2024
1 parent 3ae36b3 commit 71920bc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dataretrieval/nldi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

NLDI_API_BASE_URL = 'https://labs.waterdata.usgs.gov/api/nldi/linked-data'
_AVAILABLE_DATA_SOURCES = None
_CRS = "EPSG:4326"


def _query_nldi(url, query_params, error_message):
Expand Down Expand Up @@ -101,7 +102,7 @@ def get_flowlines(
feature_collection = _query_nldi(url, query_params, err_msg)
if as_json:
return feature_collection
gdf = gpd.GeoDataFrame.from_features(feature_collection)
gdf = gpd.GeoDataFrame.from_features(feature_collection, crs=_CRS)
return gdf


Expand Down Expand Up @@ -154,7 +155,7 @@ def get_basin(
feature_collection = _query_nldi(url, query_params, err_msg)
if as_json:
return feature_collection
gdf = gpd.GeoDataFrame.from_features(feature_collection)
gdf = gpd.GeoDataFrame.from_features(feature_collection, crs=_CRS)
return gdf


Expand Down Expand Up @@ -291,7 +292,7 @@ def get_features(
feature_collection = _query_nldi(url, query_params, err_msg)
if as_json:
return feature_collection
gdf = gpd.GeoDataFrame.from_features(feature_collection)
gdf = gpd.GeoDataFrame.from_features(feature_collection, crs=_CRS)
return gdf


Expand Down Expand Up @@ -322,7 +323,7 @@ def get_features_by_data_source(data_source: str) -> gpd.GeoDataFrame:
url = f'{NLDI_API_BASE_URL}/{data_source}'
err_msg = f"Error getting features for data source '{data_source}'"
feature_collection = _query_nldi(url, {}, err_msg)
gdf = gpd.GeoDataFrame.from_features(feature_collection)
gdf = gpd.GeoDataFrame.from_features(feature_collection, crs=_CRS)
return gdf


Expand Down

0 comments on commit 71920bc

Please sign in to comment.