My goal is to detect steep roads (e.g. >5% avg gradient) for cyling.
I'm using https://github.com/gboeing/osmnx to download the roads and then with Python I can get the elevation https://api.opentopodata.org based on the long & lat.
So I have a dataframe which look like that:
osmid,longitude,latitude,elevation
1261226,7.6180524,47.0622816,532.509
1261291,7.6249115,47.0612485,536.148
1261292,7.625841,47.0603622,534.757
1261295,7.6280829,47.0578913,538.98
17407029,7.6229411,47.0614512,536.182
If you plot that on a map it looks like this:
So the points I get from OSMnx are really random, so it's impossible to calculate the steepness.
I'm using MacOS 13.1 with conda.io, Python 3.11.0 and OSMnx
Related
I have an audio signal in wav format. I have to plot its spectrogram using Winger-Vill distribution. I have tried other libraries and other options to plot the spectrogarm like librosa, scipy and matplotlib spec but to compare the differences between these methods, I should use Winger-Vill distribution.
I would appreciate your answers in advance.
I'm trying to use kernel density estimator to obtain the distribution of my data. Using the seaborn, I can simply call sns.kdeplot(temp, shade=True) and that will plot the kde or the distribution of my data. However, with seaborn, I cannot obtain scores for new data points. However, if I'm using the sklearn library, I can simply call kde.score_samples(data). Therefore, how can I achieve the same thing with seaborn? Or, is there a way I can return the kde obtained from seaborn?
Any help is much appreciated!
After looking through the documentation https://github.com/mwaskom/seaborn/blob/a9577e705023873de7c7bbf3e9b6ae0dc1880b51/seaborn/distributions.py#L2641, the bandwidth of the kernel is calculated as: bw = stats.gaussian_kde(a).scotts_factor() * a.std(ddof=1) Consequently, I've used the bw with kde from sklearn as: kde = KernelDensity(kernel='gaussian', bandwidth=bw).fit(temp.reshape(-1, 1)).
Thus, now I'm able to call: kde.score_samples(x_axis.reshape(-1, 1)).
I have a 3d spherical point set of 10 points, (2 layers of pentagonal loudspeaker array) 2. I want to obtain 2D representation of this configuration. (Mollweide, Mercator, Cylindirical or Equirectangular projection?)
I will set the axis so that they give corresponding elevation and azimuthal angles. An example is given in 1 (Taken by ALLRADecoder vst plugin by IEM)
Is there a way to do this with a Python package like matplotlib, mayavi, or similar?
If you want to actually render something similar to above, you might want to look at PyOpenGL however it might not be the most intuitive package to dive into.
If you want to just get the 2d set of points this 3d object makes you could just look at doing some projection maths and then a package like pygame would be ideal for plotting this 2d representation and is quite user-friendly if you're new to python and graphics.
I'm working with a dataset that has X Y coordinates in ArcGIS/esri format. They are akin to 672187.92698, 534175.72095.
I would like to convert them to longitude latitude so they are more like '-90.123, 30.456'.
I've tried a couple npm packages including esri2geo and terraformer-arcgis-parser but these seem to just spit back out the same coordinates. Although with limited documentation not sure using them correctly.
UPDATE: while not in Node.js, using external tools I was able to convert my coordinates. See this GIS Stackexchange Question.
Would still like to know how this conversion could be done within node.js though!
What you actually want to do is project your data to a new coordinate system, not change its format - esri2geo looks like it does the latter, which is why you're just getting the same coordinates back.
According to ArcMap, your data's current coordinate system is:
Projected Coordinate System: NAD_1983_StatePlane_Louisiana_South_FIPS_1702_Feet
Projection: Lambert_Conformal_Conic
False_Easting: 3280833.33333333
False_Northing: 0.00000000
Central_Meridian: -91.33333333
Standard_Parallel_1: 29.30000000
Standard_Parallel_2: 30.70000000
Latitude_Of_Origin: 28.50000000
Linear Unit: Foot_US
Geographic Coordinate System: GCS_North_American_1983
Datum: D_North_American_1983
Prime Meridian: Greenwich
Angular Unit: Degree
...and you want to convert that to, presumably, WGS84.
If this is a one-off job, I would suggest using ArcMap or another GIS package (eg. Quantum GIS) to project the data and save yourself a LOT of pain.
If you have to automate the process, you might have more luck asking about this specific transformation over on GIS.SE.
I'm looking for some tool/library that is able to draw simple 2d geometries from text file or programatically. I already found List of interactive geometry software but that not quite what I'm looking for. I would prefer something more similar in usage to graphviz or gnuplot. I already wrote some scripts for gnuplot but this tool has been designed for different purposes. Required functionality:
support for different kind of 2D geometries: points, segments, lines, circles, polygons
simple input type format maybe similar to postgis Well Known Text
support for objects additional data like tags and colors definition
output in common image format or some kind of interactive GUI (with zoom in/out and select object)
configurable grid
autoscale or draw in defined area
I will use it for testing geometry algorithms and don't want to reinvent the wheel.
Matplotlib. I'm not familiar with all the aspects of this Python library but I've heard it is pretty good.
To quote their introduction,
matplotlib is a python 2D plotting
library which produces publication
quality figures in a variety of
hardcopy formats and interactive
environments across platforms.
matplotlib can be used in python
scripts, the python and ipython shell
(ala MATLAB®* or Mathematica®†), web
application servers, and six graphical
user interface toolkits.
matplotlib tries to make easy things
easy and hard things possible. You can
generate plots, histograms, power
spectra, bar charts, errorcharts,
scatterplots, etc, with just a few
lines of code. For a sampling, see the
screenshots, thumbnail gallery, and
examples directory
(source: sourceforge.net)
>
For example, using "ipython -pylab" to
provide an interactive environment, to
generate 10,000 gaussian random
numbers and plot a histogram with 100
bins, you simply need to type
x = randn(10000)
hist(x, 100)
For the power user, you have full
control of line styles, font
properties, axes properties, etc, via
an object oriented interface or via a
set of functions familiar to MATLAB
users. The pylab mode provides all of
the pyplot plotting functions listed
below, as well as non-plotting
functions from numpy and
matplotlib.mlab.
Maybe dia, with it's SVG output option is what you're looking for? It can be scripted in Python.