Skip to content

Commit

Permalink
feat: accept integers as shapefile attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
anesson-cs committed Jul 30, 2024
1 parent 97b7b6f commit 346cc4e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/notebooks/api_user_guide/4_search.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@
")\n",
"```\n",
"\n",
"The location query (`continent=\"Europe\"`) is passed as a dictionary to the `locations` parameter. It accepts [regular expressions](https://en.wikipedia.org/wiki/Regular_expression) which can come in handy when the query field has an underlying structure (e.g. see [this tutorial](../tutos/tuto_search_location_tile.ipynb) dedicated to search for products by tile(s)).\n",
"The location query (`continent=\"Europe\"`) is passed as a dictionary to the `locations` parameter. It accepts [regular expressions](https://en.wikipedia.org/wiki/Regular_expression) which can come in handy when the query field has an underlying structure (e.g. see [this tutorial](../tutos/tuto_search_location_tile.ipynb) dedicated to search for products by tile(s)). As the `locations` parameter must be a string or a regex, please consider using a string even for names which are numbers like in the following example (`location_entity=\"1234\"`).\n",
"\n",
"The locations configuration is stored in the `locations_config` attribute of the `EODataAcessGateway` once instantiated. `eodag` provides a default location which is a [Natural Earth Countries](https://www.naturalearthdata.com/downloads/110m-cultural-vectors/110m-admin-0-countries/) shapefile whose *ADM0_A3_US* field can be used to query specific countries by a short code such as *FRA* for *France* or *JPN* for *Japan*."
]
Expand Down
2 changes: 1 addition & 1 deletion eodag/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ def get_geometry_from_various(
attr = locations_dict[arg]["attr"]
with shapefile.Reader(locations_dict[arg]["path"]) as shp:
for shaperec in shp.shapeRecords():
if re.search(pattern, shaperec.record[attr]):
if re.search(pattern, str(shaperec.record[attr])):
found = True
new_geom = shape(shaperec.shape)
# get geoms union
Expand Down

0 comments on commit 346cc4e

Please sign in to comment.