Hi there π, I'm Christoph, a geospatial engineer and data scientist. I'm interested in all things πΊοΈ Geospatial, π§βπ¬ Data Science, βοΈ Machine Learning and π Python.
If you want to support my work:
πΌοΈ Create beautiful maps from OpenStreetMap data in a streamlit webapp
License: MIT License
I tried to start the prettymapp app on streamlit using https://prettymapp.streamlit.app/ and get this error:
Error running app. If this keeps happening, please contact support.
Both on Brave and in Firefox
And could this script add names on the buildings, waters...?
Extend prettymapp docs for standalone Python package
Hi there. The website (https://prettymapp.streamlit.app/) is down.
Hi! The prettymapp & prettymaps are great projects that plot impressive maps π₯°
Now I need to make a map plot using prettymapp, and I prefer to download the osm file in advance, because the network is not good and I prefer making all the resources local, also, the osm file I want to plot is very big (~80 MB). I wonder if prettymapp can add an interface to pass in the osm file path and parse it offline? Or, may I know the walkaround in current situation? Thank you!
Issue Description:
Hello.
I have discovered a performance degradation in the .loc function of pandas version 2.0.3 when .loc handling big DataFrame with non-unique indexes. When using pandas more than 4 indexes, .loc drastically increases to X1000 times. And I notice that requirements.txt
, shows that it depends on pandas version 2.0.3. I am not sure whether this performance problem in pandas will affect this repository. I found some discussions on GitHub related to this issue, including #54550 and #54746.
I also found that prettymapp/osm.py
used the influenced api. There may be more files used the influenced api.
Suggestion
I would recommend considering an upgrade to a different version of pandas >= 2.1 or exploring other solutions to optimize the performance of .loc
.
Any other workarounds or solutions would be greatly appreciated.
Thank you!
Looks like it's MIT licensed on PyPi: https://pypi.org/project/prettymapp/
Could the GitHub repo be updated with the license?
Mp$ide-sept
Oh no.
Error running app. If this keeps happening, please contact support.
Recreating the requirements from my pc I get:
attrs==21.4.0
certifi==2022.6.15
charset-normalizer==2.1.0
click==8.1.3
click-plugins==1.1.1
cligj==0.7.2
cycler==0.11.0
Fiona==1.8.21
fonttools==4.34.4
geopandas==0.11.1
idna==3.3
kiwisolver==1.4.4
matplotlib==3.5.2
munch==2.5.0
networkx==2.8.5
numpy==1.23.1
osmnx==1.2.1
packaging==21.3
pandas==1.4.3
Pillow==9.2.0
prettymapp==0.0.1
pyparsing==3.0.9
pyproj==3.3.1
python-dateutil==2.8.2
pytz==2022.1
requests==2.28.1
Rtree==1.0.0
Shapely==1.8.2
six==1.16.0
urllib3==1.26.11
Please let me know if it is correct.
Best regards
Hey there!
Sorry for bothering you, just wanted to let you know that PrettyMap (https://chrieke-prettymapp-streamlit-prettymappapp-1k0qxh.streamlitapp.com/) has gone over its resource limits and we cannot use it anymore. Could you please check this for me? I really like you App by the way, thanks for giving it to everyone!
Error on home page
Hey there π Just wanted to let you know that your app on Streamlit Cloud deployed from this repo has gone over its resource limits. Access to the app is temporarily limited. Visit the app to see more details and possible solutions.
I get this streamlit message when trying to open the app, precedently I could open the app but it seemed to have a problem with the geocoder as described in the previous issue
Here's a log from a short prettymapp
script, where it takes more than 25 minutes to turn the 430k OSM elements into 15k geometries:
$ python test.py
2023-08-22 12:49:24 Retrieved response from cache file "cache/53357fd0e0ac99711e0cc9ad382774d108ad5f1c.json"
2023-08-22 12:49:24 Geocoded "Portland, ME, USA" to (43.6592687, -70.2572642)
get_aoi: 0.03806114196777344s
2023-08-22 12:49:24 Projected GeoDataFrame to +proj=utm +zone=19 +ellps=WGS84 +datum=WGS84 +units=m +no_defs +type=crs
2023-08-22 12:49:24 Projected GeoDataFrame to epsg:4326
2023-08-22 12:49:24 Requesting data within polygon from API in 1 request(s)
2023-08-22 12:49:25 Retrieved response from cache file "cache/fcafbd21a00421565ded846c08f8d131196d0635.json"
2023-08-22 12:49:25 Got all geometries data within polygon from API in 1 request(s)
2023-08-22 12:49:25 Converting 430154 elements in JSON responses to geometries
2023-08-22 13:15:43 14956 geometries created in the dict
2023-08-22 13:15:43 74 untagged geometries removed
2023-08-22 13:15:45 Created r-tree spatial index for 14882 geometries
2023-08-22 13:15:45 Identified 3537 geometries inside polygon
2023-08-22 13:15:45 11345 geometries removed by the polygon filter
2023-08-22 13:15:45 11811 geometries removed by the tag filter
2023-08-22 13:15:46 3030 geometries in the final GeoDataFrame
done
/Users/llimllib/.local/share/asdf/installs/python/3.10.12/lib/python3.10/site-packages/geopandas/tools/clip.py:67: FutureWarning: In a future version, `df.iloc[:, i] = newvals` will attempt to set the values inplace instead of always setting a new array. To retain the old behavior, use either `df[df.columns[i]] = newvals` or, if columns are non-unique, `df.isetitem(i, newvals)`
clipped.loc[
get_osm_geometries: 1581.8291890621185s
plot: 0.26825881004333496s
plot: 2.8084590435028076s
Here's the full script (I manually edited prettymapp/osm.py
to enable console logging - not sure how to do it otherwise):
from prettymapp.geo import get_aoi
from prettymapp.osm import get_osm_geometries
from prettymapp.plotting import Plot
from prettymapp.settings import STYLES
import time
t1 = time.time()
aoi = get_aoi(address="Portland, ME, USA", radius=1100, rectangular=False)
t2 = time.time()
print(f"get_aoi: {t2-t1}s")
df = get_osm_geometries(aoi=aoi)
t3 = time.time()
print(f"get_osm_geometries: {t3-t2}s")
fig = Plot(df=df, aoi_bounds=aoi.bounds, draw_settings=STYLES["Peach"]).plot_all()
t4 = time.time()
print(f"plot: {t4-t3}s")
fig.savefig("map.jpg")
t5 = time.time()
print(f"plot: {t5-t4}s")
Is there any way that could be sped up, or is it just a necessary cost?
edit: I ran the code under a profiler, and I didn't notice elarlier that all of the time is spent in osmnx
, which spends it all in shapely
:
In [8]: s.print_stats(15)
Tue Aug 22 14:45:31 2023 profile.log
8894101 function calls (8720818 primitive calls) in 1557.185 seconds
Ordered by: cumulative time
List reduced from 7775 to 15 due to restriction <15>
ncalls tottime percall cumtime percall filename:lineno(function)
1125/1 0.004 0.000 1557.186 1557.186 {built-in method builtins.exec}
1 0.000 0.000 1557.186 1557.186 test.py:1(<module>)
1 0.059 0.059 1553.203 1553.203 prettymapp/prettymapp/osm.py:13(get_osm_geometries)
1 0.028 0.028 1552.342 1552.342 site-packages/osmnx/geometries.py:236(geometries_from_polygon)
1 0.175 0.175 1551.998 1551.998 site-packages/osmnx/geometries.py:330(_create_gdf)
9 0.000 0.000 1548.878 172.098 site-packages/osmnx/geometries.py:690(_parse_relation_to_multipolygon)
9 0.012 0.001 1548.587 172.065 site-packages/osmnx/geometries.py:839(_subtract_inner_polygons_from_outer_polygons)
3243 0.015 0.000 1381.099 0.426 site-packages/shapely/geometry/base.py:689(difference)
5854 1380.992 0.236 1381.002 0.236 site-packages/shapely/topology.py:66(__call__)
9612 165.742 0.017 165.756 0.017 site-packages/shapely/predicates.py:11(__call__)
3244 0.010 0.000 165.423 0.051 site-packages/shapely/geometry/base.py:815(within)
It would be fantastic to be able to export styles and be able to re-import them when coming back to the web application to further work on them.
Would be great to link out or show a preview of a prettymapps gallery from social media etc.
can you add the possibility to export image in SVG or other file type?
When I enter an address and submit, it runs for a few seconds and nothing happens
Hi,
thank you for this fantastic app/package! I just stumbled across a minor issue with the Peach style not showing a waterway in blue while the other styles do so (does not happen with every waterway). I had a quick look and it might have to do with the different zorders in this specific style. Is there a reason for that?
One cannot tell if they're kilometers, meters, feet or miles.
Hello there, I'm getting an error on the streamlit app when submitting a new location for generation. Sharing the error code below.
requests.exceptions.ConnectionError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 542, in _run_script
exec(code, module.dict)
File "/mount/src/prettymapp/streamlit-prettymapp/app.py", line 167, in
aoi = get_aoi(address=address, radius=radius, rectangular=rectangular)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/mount/src/prettymapp/prettymapp/geo.py", line 47, in get_aoi
lat, lon = geocode(address)
^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/osmnx/geocoder.py", line 45, in geocode
response_json = _nominatim._nominatim_request(params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/osmnx/_nominatim.py", line 106, in _nominatim_request
response = requests.get(
^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
raise ConnectionError(e, request=request)
Not able to access to the app.
It shows 'Oh no.
Error running app. If this keeps happening, please contact support.'
Any thoughts? I tried using different browsers but did not help.
A randomize button for colors & settings
Somer water areas are not shown or cut off
OSM does not provide ocean geometries via the API (status proposed), this is why some coastal areas seem to cut off water area. No good solution as of right now.
Hi, can I use different colors if I use it in a colab notebook? I am sorry for such a naive question. Great work on this easy implementation!
I tried on Firefox for Android, and other chromium android browsers because I have no computers at the moment
File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 584, in _run_script
exec(code, module.__dict__)
File "/mount/src/prettymapp/streamlit-prettymapp/app.py", line 167, in <module>
aoi = get_aoi(address=address, radius=radius, rectangular=rectangular)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/prettymapp/geo.py", line 47, in get_aoi
lat, lon = geocode(address)
^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/osmnx/geocoder.py", line 45, in geocode
response_json = _nominatim._nominatim_request(params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/osmnx/_nominatim.py", line 129, in _nominatim_request
response = requests.get(
^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/requests/adapters.py", line 700, in send
raise ConnectionError(e, request=request)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.