Data Sources¶
These modules contain the per-provider helpers used internally by GeoTaggedData.
You can also call them directly for lower-level control.
Mapillary (street views)¶
urbanworm.sources.mapillary
¶
Mapillary street-view source. Thin re-export of :func:urbanworm.dataset.getSV.
Functions¶
getSV(location, loc_id=None, distance=50, key=None, source='mapillary', pano=False, reoriented=False, multi_num=1, interval=1, fov=80, heading=None, pitch=5, height=500, width=700, year=None, season=None, time_of_day=None, target_polygon=None, fov_margin=0.1, fov_min=30.0, fov_max=120.0, building_height=9.0, output_df=True, silent=False)
¶
getSV
Retrieve the closest street view image(s) near a coordinate.
Supports multiple sources; the image is reoriented to face the target
coordinate when reoriented=True (Mapillary) or always (Google).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
list | tuple
|
coordinates (longitude/x and latitude/y) |
required |
loc_id
|
int | str
|
The id of the location. |
None
|
distance
|
int
|
The max distance in meters between the centroid and the street view. |
50
|
key
|
str
|
API access token for the chosen source.
Mapillary — pass token or set env var |
None
|
source
|
str
|
Street view data source. One of |
'mapillary'
|
pano
|
bool
|
Whether to search for panoramic images only. Mapillary only — ignored for Google. (Default is False) |
False
|
reoriented
|
bool
|
Whether to reorient and crop street view images to face the target. Mapillary only — Google always faces the target. (Default is False) |
False
|
multi_num
|
int
|
The number of multiple SVIs. Mapillary only — Google always returns 1. (Default is 1) |
1
|
interval
|
int
|
The interval in meters between each SVI. Mapillary only. (Default is 1) |
1
|
fov
|
int | float | str
|
Field of view in degrees for the perspective image
(default 80). Pass |
80
|
heading
|
int
|
Camera heading in degrees. If None, computed from the bearing to the target location. |
None
|
pitch
|
int
|
Camera pitch angle. (Default is 5) |
5
|
height
|
int
|
Height in pixels of the returned image. (Default is 500) |
500
|
width
|
int
|
Width in pixels of the returned image. (Default is 700) |
700
|
year
|
list[str]
|
Year of data (start year, end year). Mapillary only — ignored for Google with a warning. |
None
|
season
|
str
|
Season of data. Mapillary only — ignored for Google with a warning. |
None
|
time_of_day
|
str
|
Time of data. Mapillary only — ignored for Google with a warning. |
None
|
target_polygon
|
Polygon
|
Building footprint
used by |
None
|
fov_margin
|
float
|
Fractional padding added to the auto-computed FOV (0.10 = +10%). Default 0.10. Mapillary only. |
0.1
|
fov_min
|
float
|
Lower clamp for |
30.0
|
fov_max
|
float
|
Upper clamp for |
120.0
|
building_height
|
float
|
Assumed building height in meters used by
|
9.0
|
output_df
|
bool
|
Whether to also return a DataFrame of metadata. (Default is True) |
True
|
silent
|
bool
|
Whether to silence warnings. (Default is False) |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
DataFrame | list | None
|
list[str]: A list of images in base64 format. |
|
DataFrame |
DataFrame | list | None
|
A dataframe containing metadata about the street view images.
|
Source code in urbanworm/dataset.py
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 | |
Flickr (photos)¶
urbanworm.sources.flickr
¶
Flickr photo source. Thin re-export of :func:urbanworm.dataset.getPhoto.
Functions¶
getPhoto(location, loc_id=None, distance=50, key=None, query=None, geo_context=None, tag=None, max_return=1, year=None, season=None, time_of_day=None, exclude_from_location=None, output_df=True)
¶
getPhoto
Fetch public Flickr photos with geotags near a location (or within a Flickr place).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
list | tuple
|
(lon, lat) required. Coordinates of location (longitude, latitude) for searching for geotagged photos |
required |
loc_id
|
int | str
|
The id of the location. |
None
|
distance
|
int
|
Search radius in meters (converted to km; Flickr radius max is 32 km). |
50
|
key
|
str
|
Flickr API key. If None, reads env var FLICKR_API_KEY. |
None
|
query
|
str | list[str]
|
Query parameters to pass to Flickr API (free text search). |
None
|
geo_context
|
int
|
Specify whether a geotagged photo was taken indoors or outdoors. 0: Not defined; 1: Indoors; 2: Outdoors. (Default is None) |
None
|
tag
|
str | list[str]
|
Tag string or list of tags (comma-separated). Acts as a "limiting agent" for geo queries. |
None
|
max_return
|
int
|
Number of photos to return (after filters). |
1
|
year
|
str | tuple
|
[Y] or (Y,) or (Y1, Y2) inclusive. Filters by taken date range. |
None
|
season
|
str
|
One of {"spring","summer","fall","autumn","winter"} (post-filter by taken month). |
None
|
time_of_day
|
str
|
One of {"morning","afternoon","evening","night"} (post-filter by taken hour). |
None
|
exclude_from_location
|
int
|
drop retrieved photos within a distance (in meter) from the given location. (Default is None) |
None
|
output_df
|
bool
|
If True, return a pandas.DataFrame; otherwise return dict (if max_return==1) or list[dict]. |
True
|
Returns:
| Type | Description |
|---|---|
|
dict | list[dict] | pandas.DataFrame |
Source code in urbanworm/dataset.py
1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 | |
Freesound (audio)¶
urbanworm.sources.freesound
¶
Freesound audio source. Thin re-export of :func:urbanworm.dataset.getSound.
Functions¶
getSound(location, loc_id=None, distance=50, source='freesound', key=None, catalog=None, query=None, tag=None, max_return=1, year=None, season=None, time_of_day=None, duration=300, exclude_from_location=None, slice_duration=None, slice_max_num=None, probe_durations=True, output_df=True)
¶
Dispatch to the per-source helpers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
one of {"freesound", "aporee"}. Default "freesound". |
'freesound'
|
catalog
|
str | DataFrame
|
required when source="aporee" — see :func: |
None
|
probe_durations
|
bool
|
Aporee-only. See :func: |
True
|
All other arguments are forwarded; key is only used by Freesound,
catalog and probe_durations only by Aporee.
Source code in urbanworm/dataset.py
Radio Aporee (audio)¶
urbanworm.sources.aporee
¶
Radio Aporee audio source.
Re-exports the helpers that live in :mod:urbanworm.dataset:
- :func:
getSoundAporee— filter a catalog by spatial proximity - :func:
fetch_aporee_catalog— fetch the catalog from Internet Archive - :func:
enrich_aporee_catalog— probe URLs forduration_s
Functions¶
enrich_aporee_catalog(catalog, out_path=None, min_duration=None, skip_existing=True, timeout=60.0)
¶
Add a duration_s column to an Aporee catalog by probing each URL.
Aporee URLs don't carry duration metadata, so this helper downloads each
file once, reads its length with pydub (or mutagen as a fallback), and
annotates the catalog. Optionally drops rows shorter than
min_duration.
Use this once after building / updating your catalog so that subsequent
:func:getSoundAporee calls with slice_duration can compute clip
windows without paying the per-row probe cost every time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catalog
|
str | DataFrame
|
CSV path or in-memory DataFrame.
Must have a |
required |
out_path
|
str
|
If provided, writes the enriched DataFrame back to this CSV path. |
None
|
min_duration
|
float
|
Drop rows shorter than this many
seconds (after probing). |
None
|
skip_existing
|
bool
|
If |
True
|
timeout
|
float
|
Per-URL request timeout (seconds). |
60.0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
The enriched |
Source code in urbanworm/dataset.py
2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 | |
fetch_aporee_catalog(bbox=None, year=None, hour=None, season=None, southern=False, rows=0, verify_urls=False, out_path=None, enrich_durations=False, min_duration=None, timeout=60.0, page_size=500)
¶
Fetch the Aporee sound-map catalog from Internet Archive.
All Aporee field recordings are mirrored on archive.org under the
radio-aporee-maps collection. This helper queries IA's Scrape API
with optional server-side bbox / year filters and applies
hour / season filters client-side, then returns a DataFrame in
the schema :func:getSoundAporee expects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox
|
tuple[float, float, float, float] | list | None
|
|
None
|
year
|
int | tuple[int, int] | list | None
|
Single year ( |
None
|
hour
|
int | tuple[int, int] | list | None
|
UTC hour or inclusive range ( |
None
|
season
|
str | list[str] | None
|
One of |
None
|
southern
|
bool
|
Force southern-hemisphere season interpretation. |
False
|
rows
|
int
|
Maximum number of records to fetch. |
0
|
verify_urls
|
bool
|
If True, query IA's metadata API for each
identifier to find the exact mp3 filename. Slow but accurate.
Default False uses the |
False
|
out_path
|
str
|
If provided, write the resulting DataFrame to this CSV path. |
None
|
enrich_durations
|
bool
|
If True, also probe each fetched URL for
its duration via :func: |
False
|
min_duration
|
float
|
When |
None
|
timeout
|
float
|
Per-request HTTP timeout (seconds). |
60.0
|
page_size
|
int
|
Records per Scrape-API page (min 100). |
500
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
DataFrame
|
``identifier, id, latitude, longitude, url, capture_time, created, |
DataFrame
|
year, month, hour, season, title, name, description, tags, licence, |
DataFrame
|
duration_s |
DataFrame
|
|
Source code in urbanworm/dataset.py
2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 | |
getSoundAporee(location, loc_id=None, distance=50, catalog=None, query=None, tag=None, max_return=1, year=None, season=None, time_of_day=None, duration=None, exclude_from_location=None, slice_duration=None, slice_max_num=None, probe_durations=True, output_df=True)
¶
Filter a Radio Aporee catalog (CSV or DataFrame) by spatial proximity.
Aporee (radio aporee ::: maps) does not expose a public geo-query API the
way Freesound does, so this helper takes a pre-built catalog of geotagged
Aporee URLs and filters it with the same semantics as
:func:_getSoundFreesound. The resulting DataFrame uses the same column
names so the downstream GeoTaggedData / download_to_dir pipeline
needs no changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
list | tuple
|
(lon, lat) of the query point. |
required |
loc_id
|
int | str
|
Identifier for the query location. |
None
|
distance
|
int
|
Search radius in meters. |
50
|
catalog
|
str | DataFrame
|
Path to a CSV file or an in-memory
DataFrame. Required columns: |
None
|
query
|
str | list[str]
|
Substring(s) matched against
|
None
|
tag
|
str | list[str]
|
Substring(s) matched against |
None
|
max_return
|
int
|
Number of nearest sounds to return. |
1
|
year, season, time_of_day
|
Same semantics as :func: |
required | |
duration
|
int | list[int] | tuple[int]
|
Filter on |
None
|
exclude_from_location
|
int
|
Drop rows inside this radius (m) around the query point — useful for "what's nearby but not at this exact spot". |
None
|
slice_duration
|
int
|
Pre-compute clip windows on top of
the chosen recording's |
None
|
slice_max_num
|
int
|
Cap on number of clips per recording. |
None
|
probe_durations
|
bool
|
If True (default) and |
True
|
output_df
|
bool
|
If True (default) return a |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame | dict | list | None
|
|
DataFrame | dict | list | None
|
filtered catalog is empty. |
Source code in urbanworm/dataset.py
1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 | |