BlenderGPS - Importer for GPS trace data (CSV and GPX)

Well this script started out as a discussion about good, reasonably priced GPS units on #blender. Anyway one thing lead to another and now we have a CSV and GPX importer. I’ve tested it on a good many files and it hasnt had any problems. If you have a slower computer and turn on preview, turn samples up a bit (I know that sounds counter-intuitive).

Anyway, screenshot here,

Script here,

Now lets see some cool GPS tracks.

Hey timmeh,

I am having trouble using the gpx files that Garmin’s MapSource is exporting.

Link to GPX

Is it something easily fixed? I compared it to the gpx files here which are different but the calls still look the same.

Thanks for this awesome plugin btw!

Nice one timmeh… do you recon we could use something like this to import something like “map coordinates”? Perhaps import all borders on the planet and make a globe?

The borders of countries fall into the category of Geographic Information System (GIS) data. A common format for line-like things is Digital Line Graph (DLG). I have not looked lately but there are some python scripts that import various types of GIS data.

On the other hand, the idea of sending youngbatcat out on an extended tour of the world’s borders on a bicycle with sandwiches and a handheld GPS certainly does have some appeal.

Ok fixed!! the file was formated slightly different, eg leading tabs and blank lines, so, new script,

macuono - sure with some small modifications i think that would be a great addition

Thanks Timmeh!

Here is the path of my golf bag during a round of golf.

I used a really cool gps program(GPSBabel) to export the same data to a kml file to load in google earth.
Google Earth Image Link

But Yahoo Maps Beta has better coverage so I used the blender render and a screen grab to create THIS. It didn’t match up very well so I had to warp it a good amount.

Time for more experimenting… man this is fun!

i have some BIG ideas for what you have started here.

A Create World Function. Here you would enter a lower left lat and long coordinate and an upper right. Now it would create a rectangle, very similiar to what you have done so far, and north would be +y, east +x and z would be altitude. Scale is very important so during this process you should input what a blender unit is equivalant to (meters, kilometers, feet, or miles).
to bring this further you could have it create a grid base on increment settings in degrees minutes and seconds (each of these fields could start at 0 for none).

An Import Function
. Here you could import gps tracks, srtm data, or geotiff type data. If the “world” is not already created it could be at this point based on the boundries of the input file and a scale inquiry.
For SRTM input you should have another bounding variable as srtm files can be huge and you may not want to import the whole thing. Another key option would be to decide the sample rate (every 1 post, 2, 3, 10, etc…).
A geotiff or satellite image could be imported by creating a rectangle from corner lat/longs and creating a plane with the image uv mapped.
I think you have gps track import nailed!
srtm import 1 - srtm import 2

A Create or Read Function
: The ability to add an empty or another object at an entered lat/long. The ability to read an objects lat/long value.

What do you think?

A Create World Function - As we have discussed before this is not so simple, in that it requires an auto rotation. The main issue with all the methods I’ve tried so far is that there are a great many (possibly infinite) number of solutions. With regards to the world itself, this is basically already implemented with the option to change the planet’s radius, and its scale factor. Just thinking about this has given me another idea for auto rotation, I’ll try and test it today to see if it will work.

An Import Function - not particularly difficult, just means writing importers for those formats as well, there is already the infrastructure in the existing code to do sample rates (as witnessed in the preview render on the GUI)

A Create or Read Function - Waypoints already exist…I’m pretty sure the last version I uploaded had waypoints support…I’ll look into it if not(from what I remember of the file format it will be very easy)

As far as the auto rotation and scale go, well this is the foundation which the rest needs to be built on. I think I could run with this (even with my lack of python knowledge atm) if I could get help with the “Create World” part of this. The first SRTM import script I linked to seems to handle this pretty well, I am just not sure how accurate it is yet. I just found z3r0 d 's when I posted this so I haven’t tried it yet.

It is very important to have blender units = real world units. Then all work done with the help of said script could easily be exported to collada or kml formats for use in Google Earth and beyond. Also measurements between location could be quickly made, I am thinking of Macouno’s measurement script inparticular.

What do you think about storing the “world” conversion values. should this be done in a text file?

Thanks for looking and having interest in this. I hope others find this “Blender Earth” script idea exciting.

lucidMonkey: these should help you out if you want real world measurements.

I basicly converted blender units to millimetres in every case, then from there convert to whatever real world unit you want.

The way to solve the rotation thing is to have a relative lat/long origin that matches blenders origin.

Then lat and long are relative from that point.

Some math/programming references I found.

I have started making a flat earth version of this. Here is some code to setup the space… with these variables you should be able to find the lat long of blender x y position. Something is still screwy with the math but it’s real close. I don’t think I am calculating x and y properly with x = d * cos(heading) & y = d * sin(heading). d=distance

import Blender
from Blender import NMesh

import math
from math import *

#bounding coordinates
lat1 = 41.0
long1 = 70
lat2 = 41.5
long2 = 70.5

# this should be the average of the bounding coordinates or for tracks the average of extreme 2 values
originlat = (lat1 + lat2)/2
originlong = (long1 + long2)/2

## effort to calculate xy of region 1 bounding coordinate using distance, bearing, and xy result
R = 6372.795477598; # earth's mean radius in km
dlat = lat1 - originlat
dlong = long1 - originlong

a = sin(dlat/2) * sin(dlat/2) + cos(lat1) * cos(lat1) * sin(dlong/2) * sin(dlong/2)

c = 2 * atan2(sqrt(a), sqrt(1-a))

d = R * c

heading = atan2( sin(dlong)*cos(lat2), cos(lat1)*sin(lat2) - sin(lat1)*cos(lat2)*cos(dlong) )

x = d * cos(heading)
y = d * sin(heading)

##draw bounding box

boundry = NMesh.GetRaw()







f.v.append(boundry.verts[0 ])
f.v.append(boundry.verts[1 ])
f.v.append(boundry.verts[2 ])
f.v.append(boundry.verts[3 ])


NMesh.PutRaw(boundry, " plane", 1)


has anyone a copy of the BlenderGPS Script?
The download site has closed down :confused:
('Sorry the personal web site for this customer has been suspended. ')

Or is there another possibilty to get some gpx/kml/geosomething stuff into blender?

At the moment I’m cutting some movies and stills with the sequence editor.
Stuff is from a bike trip and I want to get a 3d representation from the gps trace into the project.

thanks in advance,

I can’t even find my own orginal of this script. if you provide a copy of the GPX file you want to import, I’ll code up a new importer.

that sounds cool. But only if you want to :cool:

One of the GPX Files is located here:

This file direcly came out of a Garmin eTrex HCX ( this one can produce gpx files directly and saves them as a daily log on the sd card).

The above file was a roundtrip by bike in the austrian part of the Alps.


Link is dead! And the creator of it hasn’t posted since February this year. 2Bad :frowning:
I would really appreciate if anybody else, who still has the script, created a mirror. Not much hope on that one. But let’s see… (…waiting for good fairy…

I can host if anybody finds the script… and until timmeh comes back.

Hi everyone and sorry for digging out this old thread.

Since half a week I am searching for a way to import .gpx files into blender.
Sadly most things I found on the internet didn’t work or have been deleted.

I would be extremely pleased and thankful if somebody could upload or send me the script.

I’ve recently ported my GPX importer to Blender 2.80.
It imports a GPX-track as Blender curve.

Get here:

GPX importer from the message above is now part of the blender-osm addon. Please read the announcement at the blender-osm thread.