Plotting/importing rivers in OSMnx - openstreetmap

I found someone asked a question for how to plot/import the objects other than roads, but he/she didn't get the answer.
Here is the link: Plotting different area objects in OSMnx
I was able to download/install OSMnx and run the examples of OSMnx at "https://github.com/gboeing/osmnx-examples.git".
My interest is on water (i.e., river, reservoir, lake, etc.).
How can I import and plot river/reservoir/lake of Open Street Map from Python?

Per this answer, to model and plot waterways:
import osmnx as ox
ox.config(use_cache=True, log_console=True)
G = ox.graph_from_place('Amsterdam', retain_all=False, truncate_by_edge=False,
simplify=True, custom_filter='["waterway"~"canal"]')
fig, ax = ox.plot_graph(G)
More details available in this example.

I have no experience with OSMnx but I guess you can download one of the usual OSM extracts and filter it. For example by using osmium-tool and extracting elements tagged with natural=water or waterway=*. Then import it into OSMnx.

Related

How to exclude duplicate edges from 3D Delaunay tessellation in SciPy?

I am using scipy.spatial.Delaunay together with Grasshopper (PythonGH module) to generate a 3D Delaunay tessellation. I do get the connectivity matrix from the simplices option, but this matrix contains a lot of duplicate edges (edges that overlap in the resulting tessellation). Is there a simple and efficient way to remove duplicate edges? My final script will contain a significant amount of nodes and edges...
Please be aware that I am not at all experienced in Python. I merely use scipy.spatial.Delaunay since Grasshopper has no 3D Delaunay tessellation module. My current script looks like this, where ‘Connectivity’ will generate a lot of duplicate edges when connecting the array:
import scriptcontext
import ghpythonremote
np = scriptcontext.sticky['numpy']
rpy = scriptcontext.sticky['rpy']
spy = scriptcontext.sticky['scipy']
Points = ghpythonremote.deliver(rpy, [x,y,z])
array = np.array(Points).transpose()
Connectivity = spy.spatial.Delaunay(array).simplices
Connectivity = ghpythonremote.obtain(Connectivity.tolist())
from ghpythonlib.treehelpers import list_to_tree
Connectivity = list_to_tree(Connectivity, source=[0,0])
Thanks in advance!
Regards,
Rowin
I have found this resource, but I do not get it to work by myself… https://groups.google.com/g/scipy-user/c/ZZb58FeeSKo?pli=1
I tried to remove duplicate edges in Grasshopper, but this becomes very slow very fast...

Geometry is an OSMnx network

I am using OSMnx to download and simplify a road network. But the problem I have is that once I simplify, I cannot preserve the precise geometry/geospatial information of links. The following figure shows the road network drawn from the road network in graph format
Road Network from graph
But the interesting fact is if I convert the same network to geodataframe, then that geodataframe has the exact linestring of links like the following figure,
Road network from gdf
I want to save the downloaded and simplified road network in .osm format with preserved geometry/geospatial information of links.
I tried to save the road network in .osm format with the pristine geospatial information of links. But the simplified network in a .osm/graphml format does not have that. But the saved network in .gpkg format has the pristine linestring.

Matlab: Distinguish land from ocean in harbors

I'm trying to distinguish land from ocean in harbors in Matlab. I have tried using the highest resolution maps from gshhs, but it isn't detailed enough. Below are is an example showing that it isn't detailed to the level I want. The one to the left showing the coastline boundaries and the other one showing the geoplot with basemap = 'streets'.
Comparison of the basemap and coastlines:
Since the map is able to plot in such detail, shown below, I would imagine that it should be able to distinguish land from ocean, just based on the colors.
Zoomed in basemap:
Appreciate any help here! Thanks in advance.

In Scala, is it possible to use Plotly's Scatter3d?

My aim is to display points in a 3D space/chart/graph. In python, it seems to be possible : https://plot.ly/python/3d-scatter-plots/
But in Scala, I didn't find this object/class/trait :
The Web site speaks only about surfaces : https://plot.ly/scala/
The Plotly's documentation doesn't contain Scatter3d but only Scatter, which doesn't seem to support 3D : https://asidatascience.github.io/scala-plotly-client/latest/api/#co.theasi.plotly.Scatter
The ThreeDPlot class seems impossible to display points in 3D without drawing surfaces : https://asidatascience.github.io/scala-plotly-client/latest/api/#co.theasi.plotly.ThreeDPlot, and the set of Z-coordinates is strange (e.g. Iterable[Iterable[Double]] instead of something easier, e.g. Iterable[Double])
The GitHub page's presentation use 3D points but display the only in a 2D space, by using only the X and Y coordinates : https://github.com/ASIDataScience/scala-plotly-client
Unfortunately the latest version does not support 3D scatter plots yet.
However I've forked the project and added basic support for 3D scatter plots.
Here is an example that can be run directly from the sbt console:
val (x,y,z) = (Vector(1.0, 3.0, 3.0),Vector(2.0, 5.0, 1.0),Vector(5.0, 7.0, -1.0))
val p = ThreeDPlot().withScatter3D(x,y,z,ScatterOptions().copy(mode = Seq(ScatterMode.Marker)));
draw(p, "hello-plotly");
I've also opened a pull request so that the commit gets reviewed and possibly merged also.
You may use matplotlib (most especially mplot3d)
Taking in consideration that matplotlib does not support natively Scala, you need to convert your scala data to matplotlib format before display and/or use this module which is:
The missing MatPlotLib for Scala + Spark
Regards

ArcMap shapefiles won't overlap

When I upload two shapefiles to ArcMap they are not overlapping. I have to click "Zoom to Layer" to see each one. I know I have to change the coordinate systems but I am unsure how... If anyone would like to see the data I am using, I am using an Oklahoma Counties Shapefile and the Tornado Shapefile provided by NOAA. The links to each are provided below:
Oklahoma Counties Link I downloaded the statewide shapefile
Tornado Link: I downloaded the torn.zip for tornadoes from 1950-2016
How do I get these two shapefiles to overlap? I have spent hours trying to figure this and have been reading/searching other posts but but I am not getting anywhere. Any help that can be provided would be great!
There is no projection defined on the county shapefile .Use the Define projection tool to project it to the projection defined in the textfile.Its(Geographic Coordinate system,NAD1983_2011) .
Also to better help overlay them add the USA counties data from ArcGIS Online and then proceed to add the county and tornado shapefiles and it seemed to work just fine
I have attached a picture below with a definition query on the tornado file to Oklahoma city.
image1