If this works then there is a chance that Blender3d will be used as a 3d training tool at my work!
What i am looking to do is to have blender look at a list and pull out an x, y location from that list and then to have blender create a vertice at that point.
Here’s what the list looks like…

The bold underlined strings are where i want to generate the x,y location from. The value N in the Latitude strings ( ‘y’ location) can be ignored, but in the Longitudinal ones the (‘x’ location) value should be negative IF there is a W. If there is an E then the number should be positive. Then i would like to create a vertice at that resultant x,y location.

Any help would be greatly appreciated. Code snippetts, blender specific list tutorials or anything that can help me work out how to do this.

Ok, since my first post i have gone away and learnt how to create vertices from a python script, which incidentally has nicely led onto lists and their manipulation. However can someone point me in the right direction of how to get the xyz location from the xml list into the vert list?

Thanks for those! I stumbled over the dive into python page on lists yesterday at work but had to leave the computer. I thought ‘thats ok it’ll be in the history when i get back…’ well it wasn’t and i’d put so much into google i couldn’t find what one returned that result on what page. Any way thanks again.

I got the script working the way i want. Yay!
BUT i have run into a new problem and i can see what i need to do to fix it, however i dont think my maths is up to it.
The area of longitude and latitude i am interested in is from 48’N to 60’N, 10’E to 30’W. Because of the curvature of the earth the lat long grid is not square. My script automatically takes lat and long positions from an xml list and creates vertices at given points. The vertices are then created at the associted x,y locations but on a 1:1 grid. Is there a way to scale them to the correct distortion?

If they are in the same object you can scale the object to distort the point locations. I don’t think that is what you want though. I think what you need to do is convert the lat/long to polar coordinates, then plot them in the scene, and maybe flatten them afterward? Polar coordinates aren’t really as scary as they sound, and they can be useful for quite a few things. I don’t know any good links off the top of my head though so check google.

I’ll assume you are converting degrees:minutes:seconds to decimal, leaving long and lat as variables, where lat ######S is negative and long ######W is negative.

Radius of Earth ~6k kilometers so (in blender units)

from math import sin,cos
scale=6

To center around 54 lat and -10 long (the center of your ranges)

th=long+10
phi=lat-54

So a point at 54 lat and -10 long would be (x,y,z) 0,6,0. So for any values of lat and long

To test it you can run it as a couple of ‘for range()’ loops and add the verts, it should draw your ‘area of interest’ as a mass of verts, and if you rotate it around after they should look like a part of a sphere, albeit a fairly flat part.

If you want to scale it up without the object ‘coming out of the screen’ at you, just add

Thanks for that! i’ll see if i can implement that then. What i have done at the moment, and it seems to draw the vertices as they should be displayd is take the ratio of distance between each lat an long , then divide the lonitude by the ratio number. Since convergency is 0’ at the equator and 1’ at the poll, I have been using 1/cos(latitude). This only assumes the earth is a perfect sphere and not an ellipsoid.

Now compared to the formula you have given, that looks far too simple, so now im thinking i can’t be right!

ATM you seem to be ‘plotting’ them on a 2 dimensional plain, and your formula seems right…
All I’ve done is taken cartesian co-ordinates and converted them to polar.
The reason it looks more complicated is it’s outputting x y and z, not just compensating for ‘existing in z’, which is what I think you are doing.

Yes, the lat and log is just being plotted to the 2d grid. The z axis info is contained in different parts of the xml list and its conversion will be different as its in altitude and flight levels. Thanks for your help

In that case use *(scale+altitude) in place of *scale, and definitely use ‘y-=scale’ at the end, and so z is up (not y as shown in my calcs) plot the vertices’s as v=(x,z,y).