how to draw a graph based on GPS coordinates in pyqtgraph? - python

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.

Related

How to get all points that make up a certain shape in vtk

I am working in my graduation project and one of the tasks I am required to draw a 3D shape(for example an ellipsoid using vtkSampleFunction), this represents the heart for example. I need to change the color of certain areas in that shape and make color gradients using 2 colors for example. How can this be achieved? All I could find is that cant be done without having polydata(points) and I dont know how to access specific points on the outline of my shape. Any help would be appreciated
I tried millions of ways to access points on the outline of my shape but I cant find anyway to do it.
I am new to VTK so please try to simply any answer. Thank You
If you are looking for a way to extract all the points inside a surface, you can use the vtkSelectEnclosedPoints method. For example, if you want to find out which all points in pointsPolydata lie inside the surface surfacePolydata, you can use the below example.
select = vtkSelectEnclosedPoints()
select.CheckSurfaceOn ()
select.SetTolerance(0.001)
select.SetInputData(pointsPolydata)
select.SetSurfaceData(surfacePolydata)
select.Update()
outPut=select.GetOutput()
The outPut polydata will have an array named "SelectedPoints", with 0 for point outside the surface and 1 for points inside the surface.
For more details, refer vtkSelectEnclosedPoints

Is it possible to create a thick Mesh?

I'm totally new to this field, I'm using python and Trimesh to create a 3D model of a bone and I need to figure out how can I create or represent the thickness of the bone I only have surface of the bone which is ok, but I need also to represent how the bone looks inside this surface, Anyone has a clue on how to approach this problem?
Ask me if you need more information, I'm not sure what you need to know to understand the problem.
Thanks in advance.
You can use gmsh along with mmg to mesh in volume your surface.
Depending on what you need.
if you want to display volumetric informations, you have 2 options:
generate a voxel filling the volume delimited by your surface
triangulate your volume with tetraedrons (I heard that gmsh was good for it)
if you just want to have successive inner surfaces, you can use offseted/deflated surfaces
this can simply be achieved by offsetting your first surface points along their normal
you can use for instance inflate or thicken here from the pymadcad module

Street mapping with Champlain

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.

Can someone explain how mypoly is used in Python with GPS coordinates?

I understand I can define a polygon in Python using "mypoly".
myPoly = Polygon(p1,p2,p3,…) #list of points
However, what I really want to do is to find a way to use Python to work with polygons that I define with GPS coordinates. The coordinates would show shapes similar to the following:
multiple polygons http://www.jvanderhook.info/images/slabs/drawing_1.png
(the image came from this question on Robotics Stack Exchange
I understand I should be able to work with a polygon once I have it defined, but this is new to me. How can I define one with GPS coordinates? Do I simply replace p1, p2, p3, ... above with the GPS coordinates?
Yes, you can use the gps coordinates to define your polygons. However, understand that these coordinates are typically in degrees (+/- 0-90 lat, +/- 0-180 lon).
Unfortunately, these things aren't as simple as they initially seem they should be. It might help to get comfortable with map projections, here's a good start:
http://kartoweb.itc.nl/geometrics/map%20projections/mappro.html
Then, you may be better off converting to a projection like 900913 (google maps projection) that is in meters and makes points easier to manage.
I tend to use django (which uses geos/gdal/proj4 and is a bit of a pain to get everything working right) for geometry manipulation and transforms. (shapely and pyproj seem like good alternatives if your not using django already)

3D Polygons in Python

As far as I am aware there is no inbuilt polygon functionality for Python. I want to create a 3D map and figured that polygons would be the best way to go about it.
Not wanting to reinvent the wheel I did some googling and found that there's a lot of Python stuff out there, but I couldn't find what I wanted. Thus before I reinvent the wheel (or invent it a whole), does anybody know of a Polygon system for Python?
Note that it does need to be 3D (I found quite a few 2D ones). Note also that I am not interested in the displaying of them but in storing them and the datastructure within Python.
Thanks
One of the most complete geography/mapping systems available for Python that I know about is GeoDjango. This works on top of the Django, an MVC framework. With it comes a large collection of polygon, line and distance calculation tools that can even take into account the curvature of the earth's surface if need be.
With that said, the quickest way I can think of to produce a 3D map is using a height map. Create a two dimensional list of tuples containing (x, y, z) coordinates. Each tuple represents an evenly spaced point on a grid, mapped out by the dimensions of the array. This creates a simple plane along the X and Z axes; the ground plane. The polygons that make up the plane are quads, a polygon with four sides.
Next, to produce the three dimensional height, simply give each point a Y value. This will create peaks and valleys in your ground plane.
How you render this will be up to you, and converting your grid of points into a polygon format that something like OpenGL can understand may take some work, but have a look at Visual Python, its the simplest 3D library I've seen for Python.
I think you mean Polyhedron, not Polygon .. and you might wanna look at vpython
CGAL is a C++ geometry library which, amongst other things, models Polyhedra (3D flat-surfaced shapes)
It has Python bindings available. The documentation for the Polygon3 class is here:
http://cgal-python.gforge.inria.fr/Manual/CGAL.Polyhedron.html#Polyhedron_3

Categories

Resources