# Bathymetry Projection

## Recommended Posts

Hello guys, im new at this forum. Im dealing with bathymetry data, its a Trituple with a Latitude, Longitude and Depth. In fact, the points represent a real river bed. Indeed, I have to project this point to X,Y,Z(pixel) for drawing it in OpenGL and build the river mesh. The problem is that im not really sure which method is correct for my problem... I dont know if it could be The mercator projection or Miller Projection or something else. The thing is that i have a lot of points, and the related projections use trigonometrical calculations, and the cost is to height. There is no other way to calculate the projection ? i dunno, for example with the Height and Width of the sample. Thanks in advance, i'll appreciate your help Cheers, Cristian. PS: Forgive me if the answer is in the forum, i could't find it.

##### Share on other sites
Assuming you're looking at a relatively short river (ie: not the Amazon), you can pretty much ignore projections, I think. Just treat the long/lat/height data as a height map for flat ground. The differences between projection types tend to be trivial if you're dealing with something on the scale of up to a few hundred square miles.

Google around for height maps. There should be plenty of code.

##### Share on other sites
Thanks for your replay Numsgil... I don't know which river refers the bathymetrys, but in one file i had 20.000 points.

With heightmaps, the usage of them it would be as:

River[lat][long] = depth; ?

The data are like these:

-41.07303111,-71.50509332,5.752855

You say that i can use the first batymetry, the most lesser latitude and longitude, as a reference point ?

And what happens with the scale ? it should be correct to represent the river with this aproximation ?

Oh, the points are interpolated with the delaunay triangulations...

##### Share on other sites
20K points is roughly a square 150x150 units. Which isn't all that big really.

Take the least extreme and most extreme longitude and latitude values, and convert them into something like kilometers. If it's something on the order of 100km x 100km or less, you're probably fine ignoring the curvature of the Earth.

I say probably because it really depends on what you're doing. If it's just a visualization, it doesn't really matter. If you're going to feed those points and distances into a missile guidance system, it probably matters.

So yeah, pick some reference point to get relative long and lat values. Then do something like: River[lat][long] = depth; Or actually life will be easier if you convert the relative lat/long into meters or kilometers.

If your lat and long are evenly spaced in a grid, it's really quite easy. You can just google for any literature on height maps. If they're randomly placed, it gets a lot messier. Since you're using Delaunay triangulation, I'm assuming that's the case. It just means you have to carefully construct your triangle indices into the vertex buffer.

As for the scale, that's actually something you can play with. You'll need to define an equation to convert between the scale of your altitude readings (probably in meters) and your long/lat values, so that all your units are consistent. But the fun is that you can then play with this scale for dramatic effect. Like exaggerate the height differences to emphasize something. If you use vertex shaders, you can do this on the shader side.

##### Share on other sites
forgive my dumb question but any clue for converting lat/long into meters ?

I have a mess in my head with geographic data...

And yep, its only a visualization porpouse.

##### Share on other sites
Found this searching around google for "longitude in meters".

##### Share on other sites
But again, that's a kind of projection. The calculation of that for each latitude and longitude has a big cost. Look in the source, it use a lot of cos and logarithms.

Correct me if im wrong...

##### Share on other sites
The source for that is:

####################################################################// Set up "Constants"m1 = 111132.92;		// latitude calculation term 1m2 = -559.82;		// latitude calculation term 2m3 = 1.175;			// latitude calculation term 3m4 = -0.0023;		// latitude calculation term 4p1 = 111412.84;		// longitude calculation term 1p2 = -93.5;			// longitude calculation term 2p3 = 0.118;			// longitude calculation term 3// Calculate the length of a degree of latitude and longitude in meterslatlen = m1 + (m2 * Math.cos(2 * lat)) + (m3 * Math.cos(4 * lat)) +				(m4 * Math.cos(6 * lat));longlen = (p1 * Math.cos(lat)) + (p2 * Math.cos(3 * lat)) +				(p3 * Math.cos(5 * lat));####################################################################

can you explain me what does that ? and what means that constants ?

Thanks, again :D

PS: The code meta-tag doesnt work..

##### Share on other sites
What I'm saying is ignore the per long/lat calculation. Pick a point at one extreme of your data and plug it in to that calculator to get meters per long/lat at that point. Then do the same for the other extreme. Then just assume that it applies linearly across that range even though it doesn't. Bilinearly interpolate across that range to get meters for some given long/lat pair in your data.

As long as your long/lat pairs are within about a degree of each other, it won't matter.

##### Share on other sites
It doesn't matter if the projection is expensive, since you only need to do it once. Store the results somewhere.

##### Share on other sites
I can't get a real representation of the river:

@Numsgil:

I wrote and algorithm to translate the lat/long using the calculator code.
This is what i've done:

When im inserting to the set the lat/long im keeping updated the minor lat and long.
For get those points translated the first step is to use the calculator with the lat of the reference point. Now i had the calculate the increment in one degree upon the reference point in latitude and longitude, the next step is to substract the point that i wanna to represent with the reference point, and next multiply the differences in latitude and longitude with the respective latitude and longitude lengths upon the reference point. And so on...

So, all the lat/long are in meters from the reference point.

The thing is that the points are to close, may be it can be a problem with the scale....

@Vorpy:

I'll give a try to Miller projection to compare the results with the method that im actually using.

I'll appreciate a soon response...

Thanks a lot!

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627726
• Total Posts
2978815

• 10
• 9
• 21
• 14
• 12