i'm developing a Gtk Program with Python. I have to display a map and some nodes on this map, which walking around on streets. To achieve this I am using libchamplain.
Displaying the map was quite easy. But is there a way to check if a Coordinate (lat, lon) points on a street? Or any other solution to put some walking markers on the map?
Thank you.
I solved my problem.
I created a PathLayer and calculated a very, very simple route for a randomly chosen Point on the Map based on this algorithm. Then i use Object to print that Point on the route. Every second the Point removes and get plotted on the next position.
Related
I have a point cloud and meshes (vertices=points of the point cloud).
I want to project the point cloud with a certain virtual camera.
Here, since the point cloud is sparse, the rendered result includes the points which should be occluded by foreground objects.
To resolve this issue, I want to use mesh information to identify which points should be occluded.
Is there any smart way to do this in python?
Kind advice will be greatly appreciated.
After hours of searching, I conclude that I have to re-implement a novel rendering pipeline to achieve my goal.
So, instead of this, I use a mesh-based renderer to render a depth map.
And then I simply project the points of the point cloud with a projection matrix.
Here, I use the depth map to check whether the point fits with the depth or not.
If the projected point is the one that should be occluded, then the depth of the point would be larger than the depth map value at the corresponding pixel.
So, such points should be ignored while rendering.
I know that this is a less elegant and inefficient trick but anyway it works very well :)
I have two sets of data points; effectively, one is from a preimage and the other from its image, but I do not know the rule between the two. This rule/function is nonlinear.
I've collected many data points of corresponding locations on both images, and I was wondering if anyone knew of a way to find a more complete mapping. That is, does anyone know the best way to find a mapping from R^2 to R^2 with an extensive set of sample points. This mapping is one-to-one and onto.
My goal is to use the data I've found to find a polynomial function that takes in some x,y coordinate from the preimage, and outputs the shifted coordinates.
edit: I have sample points along the domain and their corresponding points in the image, but not for every point in the domain. I want to be able to input any point (only integer values) in the domain and output the shifted point.
I don't think polynomial is easy (or easy to guarantee is a bijection). The obvious thing to do is to
Construct the delaunay triangulation of the known points in the domain.
For each delaunay triangle the mapping is just the linear mapping which interpolates the map on the vertices.
Then, when you have a random point, look up its delaunay triangle, and apply the requisite map.
I believe that all of the above can be done via scipy.spatial.delaunay.
The transformation you're trying to find sounds a lot like what's accomplished in Geographic Information Systems using a technique called rubber-sheeting https://en.wikipedia.org/wiki/Rubbersheeting
Igor Rivin's description of a process using a Delaunay triangulation is pretty much the solution that's used in such systems. Some systems will use a Barycentric coordinate system rather than a linear mapping to try to reduce the appearance of triangle-related artifacts in the transformed image.
What you are describing also sounds a bit like the "morphing" special effect used in video. Maybe a web search on that topic would turn up some leads for you.
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.
I have a data set which contains latitude and longitude.(These are car racing data ) I like to draw a map in pyqtgrapgh based on this coordinates and then interact with it. The problem is I cannot find the proper way to draw the map with the current pyqtgrapgh api. (or maybe I am missing something).
Does anybody know how can I draw the map with pyqtgraph?
I would start with Qt's primitives like QGraphicsPathItem or QGraphicsPolygonItem. If you are starting from a numpy array of coordinates, then you might find pg.arrayToQPath() useful as well.
I have a road network shapefile as a polyline and I want to convert this to a polygon layer wherever the network forms a 'hole' or closes in on itself. The problem is a hole could be made from more than one road feature. (i.e. three connecting roads form a hole). This means that I cant just say "if the first feature vertext is equal to the last vertex form a polygon."
I only have access to open source modules (PySAL, shapely etc NOT ArcPy)
Any ideas? Been stuck on this one for way too long!
I think you can iterate through the points,
And at each point compare to all points examined so far.
If there's a match, close-off a polygon.
Not sure if you're going to get much better than O(n^2).