I have a series of GPS points which collectively form a polyline. Each of these GPS points has a time stamp and I can therefore compute things like journey time and average speed along the poly line.
I now wish to map the resulting polyline onto a road network. However, for obvious reasons the GPS points don't line up with the actual infrastructure and I must attempt to match them across. Is there a python library for doing this?
Check out pyproj, geopandas, and rtree.
Related
I have a large model of a house, with every internal object like walls, tables, doors and tv's inside. The file is a 3D object, either a .obj or a .fbx file. I also have a pointcloud from a 180 degrees lidar scanner that has scanned from somewhere inside the house. I know where the scanner stood with a precision of about 3 meters, and I want to find out what my pointcloud corresponds to in my 3D model. In other words, I want to find the translation and rotation required to move my pointcloud to the correct position in the model.
I have tried to turn the 3D model into a pointcloud, and then use ICP (iterative closest point), but as the points I generate does not necessarily correspond with those from the scanner, I get quite weird results from time to time.
I have also looked at this one Match 3D point cloud to CAD model, but in my case I only have a scan of a small portion of the full model.
Does anyone have any advice on how to do this with python?
I have latitude, longitude and geohash data for some places in a city near some sea(ex. Miami). I want to know which of these places are near the coast line(lets say within 100 m of the coastline). How can I approach this problem?
Data I have :
Name of the place, latitude of the place, longitude of the place, geohash of the place, global coastline data(shape file, but this is not accurate)
Approach Tried :
I downloaded the coastline data from here but this data is not very accurate. When I plot the shape file along with the lat, long of my original places data, I found that many places are lying outside the shorelines which is because the shorelines have been approximated by line segments as we zoom into the map(check the image attached).
Approach I am thinking of trying :
I am thinking of finding all geohashes(level 6) that cut the shoreline and then if the place is present inside these geohashes, I will classify them as near-coast places. Do you think this approach is good and will give desired results? Also I am really sure how I am going to find the geohashes that cut the polygon.
How big of a city is it? If you want a rought aproximation, you could first turn your wgs84 coordinates into an X,Y plane in UTM and then simply try to get an inequality by approximating the coastline to a straight line and figuring which side of the equation you want to keep. You could do this with more lines to make a better representation of the coastline and then offset them by 100 meters to get a polygon
One way to approach this is if you already got the coastline as a collection of points as can be found on the internet as shp files for example.
Iterate over these points and calculate the distance to the place and take the minimum.
If it is less than 100m you got a match.
I'd like to create synthetic training data for DL models for segmentation and classification in point clouds. The ground truth / real data comprise LiDAR point clouds. I scripted a simple mesh sampling model in python/open3d and I'm able to quickly transfer 3D scenes to point clouds (see fig 1), but I need to include certain characteristics of LiDAR sensors.
Blensor (https://www.blensor.org/) works the way I need it (fig 2), but I don't want to use blender atm. Also the results don't have a sufficient quality for my use case.
In the first step I'd just like to cut off the points, which are not reachable by a certain position of a LiDAR sensor, mainly to create the "shadows", which are important to make the training data more realistic. Do you have any suggestions for a simple and fast workaround? My point cloud is saved in a pandas dataframe including x,y,z and nx,ny,nz values.
Thx in advance,
reiti
If your 3D scene can be described in the form of distance functions (essentially consisting of a range of simple geometric shapes opposed to point cloud data) you may be good to go with an easily modified ray tracing algorithm that emulates a LiDAR sensor.
For each LiDAR "ray" (i.e. for every direction) you only need to save the first scene collision's xyz coordinates. This also gives you full freedom to match the original real world sensor properties (like angles and number of points).
How easy the calculation of the distance between scene and sensor-ray will be depends on the scene you have set up and how it is represented. Sorry for not being able to provide you with a ready-to-use implementation, but this might give you some direction.
Suppose there is a geo region X. The celestial bodies move over that region over the year and, of course, the bodies do not remain the same or in the same position. I am trying to build a 2/3-D chart that maps the movement of the bodies over X (and given a certain time and place within X, show the bodies and their location at that time and place). I plan to do this using Python but at the same time lack knowledge of astronomy - Can I do it? Any pointers/modules/tutorials would help. Thanks.
As #postoronnim said, the astropy package provides you with everything you need for this task.
You can go here and you will have a working example.
Just a quick summary:
You can give a location for the observation (the main observatories in the planet are already available in the package but you can define your own with latitude, longitude and elevation).
Then you need coordinates of one object and the moment of the observation and you can plot a 2D (or 3D if you want to play with spherical coordinates) trajectory of you object in the sky. It is in genetal very usefull to plot Alt vs time to visualize when your object is visible.
Hope this helped
I would suggest you to have a glance at the opensource astronomy package stellarium with which you could simulate the sky for a given location for a given body. There should also be a documentation that accompanies that which could be helpful in getting yourself familiarised with the adopted algorithms.
Think of several runners on a marathon. The athletes are all wearing GPS devices. The track itself has no sensors, and I need to know when each athlete crosses a predetermined set of GPS coordinates. However, each athlete may cross the waypoint at a slightly different lat/long, since the track/road might be wide enough that different parts of the track/road are used.
What is the best way to determine whether an athlete has passed a waypoint?
I'm using Python, and am open to using an external library. I'm working with pre-processed GPS data, so I have only the latitude and longitude at each time point (and a few other bits and pieces like speed and distance travelled).
IMHO there are few ways of solving your problem.
First one which came to my mind is this:
from shapely.geometry import LineString
line1 = LineString([(i, i) for i in range(5)])
line2 = zip(range(5)[::-1], range(5))
if line1.crosses(line2):
print 'yeah!'
add a loop and iterate every waypoint-line
Other possible options:
simple math calculation using intersection of two strait lines - high school stuff
import your data into postgres with postgis and use postgis function eg ST_Crosses (if postgres is to heavy for you I would give SpatialLite-sqlite a try)
pyshp, shapely, gdal/geos, geodjango, geoalchemy
combine some of the above and write a bit more fancy algo like creating a buffer around one line/point and check if it "ST_Contains" GPS position also checking if any later positions are off buffer zone(?)
You may try this:
The waypoint is the point at which two track (line) segments meet (black lines in the picture). Draw a line orthogonal to one of the line segments through the waypoint for each of the two line segments meeting in the waypoint (the red and blue line through the way point in the picture). The runner is considered to be near the waypoint when it enters the area marked red in the picture (assuming the runner comes from the right). After some time the runner may enter the area marked blue in the picture - when this happens, the runner has passed the waypoint.
If the runner never shows up in the area marked blue the runner deviated from the track, the waypoint has not been passed.