HistWar

HistWar (international zone) => Communities => MODs => Discussion démarrée par: Marbot le 23 février 2010, 20:10:38 pm

Titre: Elevation on maps
Posté par: Marbot le 23 février 2010, 20:10:38 pm
Hello,
I have talked about this topic on another thread, but it was not really the best place.
The way the map editor works is that you have to design by hand the elevation map. However, I have some maps where data is already digitised and I would like to import directly the data to avoid doing it twice. The elevation data take the form of complete triangulations of the battlefields where I can have the ground elevation at any position, which means it should be easy to adapt the import to the LG format. Am I right to say that the .txt file in the map directory is where the elevations are stored and each number is the average height of a "pixel" of the map?
If so I would just need the size of that pixel and to know how elevations are converted to be able to do that import.
I also have the localisation of all the main features (road villages, farms...), but is seems harder to import straight away since the other files seem to be binary.

Any iformation on that matter would be very much appreciated.

Regards
Titre: Re : Elevation on maps
Posté par: Hook le 23 février 2010, 20:30:05 pm
The text file, GroundV4.txt, appears to be a code for what each terrain cell contains, or other information, but it is not the elevation.

HighV4.hgh is the elevations in meters.  The maps are always 100 by 75 cells, so each number represents the elevation of one corner of each map cell, as there are 101 by 76 cells in the HighV4.hgh file.  The format is binary, two bytes per cell, with low order byte first, and the elevations are in meters above a zero reference elevation which won't be sea level. 

For example, Austerlitz uses about 200 meters above sea level for the zero reference elevation.  The lowest elevation in the Austerlitz map is 0, or 200 meters above sea level, and Pratzen Heights is about elevation 80-90, or 280-290 meters above sea level.

Negative numbers here represent rivers, lakes, and marshes. 

Citer
However, I have some maps where data is already digitised and I would like to import directly the data to avoid doing it twice.

If you can show me the format of this data, I might be able to help with a program to convert it to a HighV4.hgh file.

Hook
Titre: Re : Elevation on maps
Posté par: Marbot le 23 février 2010, 22:50:11 pm
Hello Hook,

Thanks for your answer. Attached is typically the kind of file I can generate. It is what I made for the Waterloo Napoleon's last battle series for the battle of quatre-bras. It is very similar in principle to the LG file, the difference being that it is not binary. If of help I could also put commas to separate the different elevations. Instead of a number I can put anything more suitable like the modified elevation. The other thing I can do is to simply generate a .CSV type file with i,j,z. One set of coordinates for 1 line.
Will it be possible later on in the map editor to put a picture in the background to help digitise locations of the main features like, houses, rivers, forests etc...?

Regards
Titre: Re : Re : Elevation on maps
Posté par: Hook le 23 février 2010, 23:00:59 pm
Will it be possible later on in the map editor to put a picture in the background to help digitise locations of the main features like, houses, rivers, forests etc...?

You can already do that. :)  Instructions are in the manual in book 2.  A few people have already tried it.  You can even use these in the game itself, from what I understand.  I'm waiting for someone to find a good period map to use there.

I can work with whatever format you have, and the simpler the better as I'd have to reformat it anyway. 

Do you know what the lowest and highest elevations are in meters in that map you attached?

Hook
Titre: Re : Elevation on maps
Posté par: Hook le 24 février 2010, 15:10:45 pm
Here is what your elevation map looks  like in the game.  The contours are 5 meters.  This will fit in a 10 km or larger map, but the 6km map uses a different scale.

Let me know if this is going in the right direction.

Hook
Titre: Re : Elevation on maps
Posté par: Marbot le 24 février 2010, 18:50:46 pm
Hello Hook,

Thanks for your input, This is looking good as you can see from the map attached.
I am going to give you the true elevation and adapt the file to the 101/76 scale.

Cheers
Titre: Re : Elevation on maps
Posté par: Hook le 24 février 2010, 19:39:50 pm
That map is about 5 km wide.  If you want to put this on a 6 km map,  the dimensions are 61 by 46.  If you're making a 10 km map or larger, use 101 by 76.

You can use whatever symbols you wish for the elevations.  Using a to z might be better than the numbers and letters.  Use however many letters you need, just tell me how much elevation each one represents.  If your elevations are to the meter, use a-z then A-Z and 0-9, or any ascii sequence that's easy to translate to a number.

Hook
Titre: Re : Elevation on maps
Posté par: Marbot le 24 février 2010, 22:45:24 pm
Hello Hook,

The map I have of the battlefield for quatre bras is quite small (4km*3km) so instead I am giving you the Waterloo one which fits very well.
I have coded the elevation from a to z as suggested. Lowest is a at 70m and highest is z at 161 the increment is therefore 3.64 m.

I have tried to use the "carte utilisateur" Menu in the map editor, but nothing happened when clicking on it.

Cheers
Titre: Re : Elevation on maps
Posté par: Hook le 25 février 2010, 04:55:25 am
Here is the converted Waterloo height map.  I had to duplicate one row of numbers on the right, two on the left, and one each on the top and bottom to make the size 101 by 76.  This shouldn't have much effect on the actual map.

The letters used were a through u, so I used a scale factor of 4.5 to get the correct elevations.  This is trivial to change, so if you want me to use another scale factor, let me know.

Note that the HighV4.hgh file will not work for a 6 km map, only for 10 km or larger.

Hook
Titre: Re : Elevation on maps
Posté par: Hook le 25 février 2010, 05:13:35 am
Here is the same map using your suggested 3.64 scale factor.

Hook
Titre: Re : Elevation on maps
Posté par: Broadsword le 25 février 2010, 05:48:27 am
It has been fascinating to watch you two work out this system for creating more precise heightmaps.
I can't wait to see the results of this in a scenario.
But also: Once you have it figured out, could someone post the step-by step process in a simple, "for dummies" fashion, so that the rest of us might eventually be able to make custom terrain for HW:LG this way?
That would be great.
Titre: Re : Elevation on maps
Posté par: glaude1955 le 25 février 2010, 12:13:56 pm
Superbe travail, impressionnant.
Nous sommes preneur d'un tutoriel... ;)

Superb work, impressive. 
We are taker of a tutorial...

Yves
Titre: Re : Elevation on maps
Posté par: Hook le 25 février 2010, 15:50:22 pm
If it's not obvious, you can use the HighV4.hgh file in the game now.

Make a new 10 km map and save it, then exit the map editor.  Unzip one of the HighV4.hgh files and copy it into map folder.  If your new map is called Waterloo, the folder will be called Waterloo in the Map folder.  Overwrite the HighV4.hgh file that is already there.  Reopen the map editor and select Waterloo, and the height data will be there.  If you save the map now, it will create the CARTE2D.BMP file.

You can add terrain features as you wish... it doesn't have to be the actual Waterloo battlefield.  While you can't add rivers at this point, you can add lakes and marshes, and everything else.

There may be a way to add rivers, but I'll have to experiment with that a bit.  No guarantees just yet.

Once I've got the program to convert text height files in the format that Marbot has provided polished sufficiently, I'll post it if there is sufficient interest.  Basically, you just drag the text file on top of the program icon and it produces a proper HighV4.hgh file for you.  Creating that text file may be somewhat more difficult. :)

Marbot, if you want I can provide the C source code I use, so that you can create the files directly yourself, or I can send you a copy of the program I use.  Feel free to get in touch any time.

Hook
Titre: Re : Elevation on maps
Posté par: Marbot le 25 février 2010, 20:05:33 pm
Hello,

Sorry for the mistakes, they should all be fixed in the attached file. The scale factor has slightly changed to 3.5m.
I would love to use your program. Can you adjust the scale factor in it? I am also interested by the code but a don't have a compiler. I used to do some C a few years back at Uni...

Regarding the way I create these points is unfortunately not straighforward as I am using a software dedicated to do some geology work and that is fully 3D. I just digitise the elevation lines at their correct elevation using a picture of the map correctly georeferenced in the background and then I create a triangulation (3D surface) of the whole map. I create a grid of all the points required for LG and then I project them onto the triangulation. I use the export function to have a list of all the points which I can then import into Excel and after a few transformations the final map given to Hook is made.

I can help anyone  to build the topography for a scenario as long as a topographical map of the area is available.
Titre: Re : Elevation on maps
Posté par: Hook le 25 février 2010, 22:58:39 pm
Latest version.  The map seems to have shifted a bit. :) 

Elevations displayed are 10 meters.  This is selected by the game and can't be specified.

There used to be a free download for Microsoft Visual C++.  I'm looking for it while I upload these files.

Hook
Titre: Re : Elevation on maps
Posté par: Hook le 25 février 2010, 23:38:46 pm
There used to be a free download for Microsoft Visual C++.  I'm looking for it while I upload these files.

Never mind.  I know what I'm looking for and I can't find it.  Good luck finding a compiler.  If I have to, I'll port it to use the free DJGPP compiler.

Hook
Titre: Re : Elevation on maps
Posté par: zu Pferd le 27 février 2010, 05:33:40 am
Congratulations to both of you for this very impressive work :!: :!:
Titre: Re : Elevation on maps
Posté par: Hook le 27 février 2010, 10:39:13 am
Citer
Can you adjust the scale factor in it?

Yes.  I've got it set up currently so that if you put a scale factor as the first line of the text file, it will use that number instead of an internal default.

I have it set up so that it works with the 6 km maps as well but I need to run some tests.

(It's the height of each contour shown in the map image that is set by the game and can't be selected. I think I wasn't clear when I mentioned that before.)

Hook
Titre: Re : Elevation on maps
Posté par: Marbot le 27 février 2010, 13:45:18 pm
Hello Hook,

I have managed to load your map in the editor, it works very well indeed and fits the map in the background. Thanks for your input.
However, my mistake again :( I did not notice in your post that for the 6km map the grid changes as the map I gave you has originally a 6km width (the Waterloo battlefield is very small), which explains why the map looks flatter than actually is.
I am dowloading the visual C++  free edition. I hope this will be able to compile your C program.

How do you plan to make these tools available?
Titre: Re : Elevation on maps
Posté par: Hook le 27 février 2010, 14:59:55 pm
Could you please post the 6 km version of the text file?  I want to test my program to see if it handles them properly, and can give you a height map for the 6 km battlefield.  I'll need the scale factor as well.

The dimensions of a 6 km map are 61 by 46.

Send me the link for the page you used to download the free version.  I couldn't find it.  Unless you mean the new 2010 version Release Candidate.  That thing probably has an expiration date on it. 

I can send you a copy of the necessary source code, and can talk you through making a project with it.  I'll also send the executable file for you to play with.  I just need to test it a bit more first.

Hook
Titre: Re : Elevation on maps
Posté par: Marbot le 27 février 2010, 18:14:24 pm
Hello Hook,

Here is where I downloaded C++: http://www.microsoft.com/express/Windows/

Here is attached the file as requested.
 I'll wait for your feed back

Cheers
Titre: Re : Elevation on maps
Posté par: Hook le 27 février 2010, 18:54:01 pm
Converted with elevation factor of 3.5.  Works in the map editor for a 6 km map.

Thanks for the link.

Hook
Titre: Re : Elevation on maps
Posté par: Marbot le 01 mars 2010, 18:56:13 pm
Hello Hook,

The map looks really good, thank you.

Cheers
Titre: Re : Elevation on maps
Posté par: TC237 le 10 mars 2010, 02:22:18 am

Hook, I'm trying my hand at maps, let me know if I'm on the right track...
As an example we'll use spec10's Gettysburg map...(for some reason, to me, the elevations look too high)

I have a topo map of Gettysburg and established that a good base elevation (zero elevation) for the area is 400ft (Rock Creek just SE of battlefield).
Big Round Top is 785ft...the difference in elevation is 385ft or 117.3 meters from lowest to highest point.

So...a game map of Gettysburg would have Big Round Top at an elevation of 117.3m.

Does that sound right?
Titre: Re : Elevation on maps
Posté par: Hook le 10 mars 2010, 02:37:34 am
So...a game map of Gettysburg would have Big Round Top at an elevation of 117.3m.
Does that sound right?

That sounds right to me.

The elevations are definitely too high in that map.  I converted the Sid Meier's Gettysburg map to run in Steel Beasts once, and while the area is hilly, it's nowhere near as hilly as the LG map for Gettysburg.

If you happen to have the map files for Sid Meier's Gettysburg, I can make a height map from that which we should be able to use in the game.   Zip 'em up and attach them here.

By the way... long time no see! :D

Hook
Titre: Re : Elevation on maps
Posté par: TC237 le 10 mars 2010, 03:07:55 am
SMG? wow that's a blast from the past...luckily I don't throw anything away,  found the CD :smile:
Any idea what the file name is?

So the height  file for Histwar is basically a text file (similar to SMG)?
If so then I have to figure out a different method, I've been thinking in terms of DEM files and grayscale gradients (similar to TC2M).

Another question:
The manual suggests a 512x512 or 1024x1024 "User Map".
When I created a new 10km map and loaded a 10km x 10km military topo map with 1km gridsquares (both at 512 & 1024) as a User Map it was "squashed", not square.
Measuring with the distance tool, each 1km gridsquare was correct at 1000m horizontally but they were squashed vertically, about 800m instead of 1000m.

Any hints to loading a "User Map"? Should it be 1024x768 instead?


Citer
By the way... long time no see!
;)

Titre: Re : Elevation on maps
Posté par: Hook le 10 mars 2010, 03:22:03 am
SMG? wow that's a blast from the past...luckily I don't throw anything away,  found the CD :smile:
Any idea what the file name is?

It's not going to work anyway.  I compared the LG Gettysburg map to the one I was working on for the Gettysburg Annex and some of the terrain features aren't in he same places in both maps.  Thanks anyway.

Citer
So the height  file for Histwar is basically a text file (similar to SMG)?
If so then I have to figure out a different method, I've been thinking in terms of DEM files and grayscale gradients (similar to TC2M).

The file is a binary format.  I described the format in my first post in this thread.  I've written a program that converts the text files to the proper binary format.  If you can output a two-byte-per-cell grayscale without a header, you might be able to use that directly.  If not, send me a copy of what you have and I can convert it.  Just keep in mind that all height maps  in the game are 101 by 76 cells (representing the height at the corners of each cell) except for the 6 km maps which are 61 by 46.

Citer
The manual suggests a 512x512 or 1024x1024 "User Map".
When I created a new 10km map and loaded a 10km x 10km military topo map with 1km gridsquares (both at 512 & 1024) as a User Map it was "squashed", not square.
Measuring with the distance tool, each 1km gridsquare was correct at 1000m horizontally but they were squashed vertically, about 800m instead of 1000m.

What you need to do is get a map that's 10 km by 7.5 km, then squash it so that it's square in Photoshop or other graphics program.  It will appear at the normal aspect in the map editor.  If you use a different map size, make sure the aspect ration is 4:3 before you squash it into a square.

Hook
Titre: Re : Elevation on maps
Posté par: Hook le 10 mars 2010, 03:28:50 am
And just for fun, here's the Sid Meier's Gettysburg map displayed a slightly different way. :)

Hook
Titre: Re : Elevation on maps
Posté par: TC237 le 10 mars 2010, 05:16:02 am
Thanks,
Got the user map working.
The other stuff is over my head for tonight   :? ,  I'll try again tomorrow.
Titre: Re : Elevation on maps
Posté par: spec10 le 15 mars 2010, 12:01:02 pm
Argh, stupid me.  I used detailed maps to create the topography, but I'm a moron ... my zero elevation is totally wrong, that's why everything is too high. Round top for example has the correct height of ~780 ft / ~240 m but of course it doesn't start at zero in real life, so it's much too high in the game... :(

Well, at least it looks pretty, got some alpine touch, doesn'T it? ... :D
Titre: Re : Elevation on maps
Posté par: brucepos le 18 mars 2010, 16:03:59 pm
Hook - you've cost me three days of my life! :smile:

I got really interested in the idea of creating elevation maps directly rather than through the editor and wondered whether there was a way of using the free satellite elevation data that's avaliable. It turns out that you can do it, but it takes a bit of time. First of all, you can get the data from www.ambiotek.com/topoview/srtm41.kmz - this is an overlay for Google Earth, so you need this installed first.

Selecting the data centre nearest the location you want will produce a grid of satellite data sets - you can then pick and download the ones you need  - I had to download two because the area I wanted was in the middle of the sets.

The next bit is a bit awkward - I used a freeware programme called SciLab to do the donkey work. First you need to combine the datasets in a mosaic (if the region you want isn't entirely in a single set). Next you isolate the cells you need (the satellite data is divided into 0.00083333 degree elements (approximately 90m). Then it's necessary to resample the data to fit the 101x76 grid descibed by Hook - I used the linear interpolation function in SciLab for this. Finally, the data is exported to a binary file (the 'hgt' file described by Hook.)

I've generated a map for the Sacile battlefield - it was possible to add the river AFTER the height map was generated.
Titre: Re : Elevation on maps
Posté par: TC237 le 18 mars 2010, 17:04:42 pm
Great!  :D
I'm going to try it. 2 questions to start:
1) will it work with 30m elevation data?
2) can you write up some instructions? anything at all will help us to get started.
Titre: Re : Elevation on maps
Posté par: brucepos le 18 mars 2010, 17:23:02 pm
I found the 90m data without too much trouble, but didn't find a 30m source (for google Earth), but it should work OK.

I'm writing a set of instructions at the moment.
Titre: Re : Elevation on maps
Posté par: brucepos le 18 mars 2010, 22:34:25 pm
I've written (and tested) a set of instructions and put them in the 'Guides' section of the Histwar mods server (guggs.de/hwlg/)

Good luck - I'm off to play with the OOB editor now!
Titre: Re : Elevation on maps
Posté par: spec10 le 18 mars 2010, 22:36:36 pm
awesome guide, i just overflew it and it looks great. gonna try it out on the weekend if i find the time :)
Titre: Re : Elevation on maps
Posté par: Tirailleur le 20 mars 2010, 07:31:26 am
Wow brucepos,

this is fantastic work...thank you
Titre: Elevation on maps
Posté par: glaude1955 le 20 mars 2010, 08:23:34 am
Hi Brucepos,

Devil !, explained of this manner, all has the simple air...   :idea:
Congratulation and thank you for this small jewel that you offer to the creative amateurs.  :smile:

Yves

Diable !, expliqué de cette manière, tout a l'air simple... 
Félicitations et merci pour ce petit bijou que tu offres aux amateurs créatifs. 
Titre: Re : Elevation on maps
Posté par: Bruguière le 20 mars 2010, 08:56:33 am
Thanks a lot for your great job !!!!!  ;)
Titre: Re : Elevation on maps
Posté par: Broadsword le 21 mars 2010, 05:01:26 am
Brucepos,
Thank you for some groundbreaking work (no pun intended) to discover this technique, and for making such a clear step-by-step guide to the process.

The guide was so encouraging that even I (not much of a math or programming geek) had a go at it. I actually got all the way through the steps in Scilab...until the part where you say to enter the first formula to resize everything:

-->x1=1:75/(nr-1):76;
               !--error 27
Division by zero...

Do you know what went wrong here? I cut and pasted the formula from the PDF exactly as written.
Titre: Re : Elevation on maps
Posté par: brucepos le 21 mars 2010, 13:22:47 pm
Hi,

Thanks everybody for all the kind comments!

Broadsword - the problem I think you have is that 'nr', the number of rows in your data file is equal to 1. Did you check the datafile with the size operator 'size(mapdata)'? If it is 1, it suggests that something has gone wrong when you've been combining the data files.

Redo the Scilab part, and check the data sizes as you proceed. The individual satellite data files always seem to be 1200x1200, so your combined files should be multiples of this.

Hope this helps!
Titre: Re : Elevation on maps
Posté par: brucepos le 21 mars 2010, 13:30:18 pm
Hi,

I've had a look over the PDF again and realised that you might have problems if you are cutting and pasting directly from the PDF. You can call the map data and combined data files anything you like - they are just variable names. I've been a bit free and easy with the names in the text, if you want to copy what I've done exactly, then use the code sections in the screen captures (apart from the 'CheekToCheek' one which shows data being joined side to side.)
Titre: Re : Elevation on maps
Posté par: glaude1955 le 21 mars 2010, 14:59:28 pm
Hi,
I don't get data marker to the screen.  
I took your example (venise) but no data marker.  
Has how I operated:  
I went on the site: Hole-filled SRTM 90m Digital Elevation Dated (V4.1)  
I clicked "here" to access the data  
Precisions of the site:  Welcome to TOPOVIEW : the Google Earth interface for the SRTM data (V4.1)    Once loaded into Google Earth, if you tick 'Elevation' under 'Temporary places', each of the grids that you see represents a 5 by 5 degree tile and contains a placemark which links to approx. 90m resolution digital elevation data  
I don't find the place to click " Elevation' under ' Temporary places "  
Where are Temporary places ?
What to make? Who help me ?
Thanks
Yves
Titre: Re : Elevation on maps
Posté par: brucepos le 21 mars 2010, 16:08:00 pm
The attached google earth image shows what I've got on the screen, with the elevation checkbox clicked. To get the preview grid you need to click the 'data' pyramids near to your area of interest.

Hope this helps!
Titre: Re : Elevation on maps
Posté par: glaude1955 le 21 mars 2010, 17:02:51 pm
OK, I found them.
My google Earth was configured badly 
your first photo helped me 
Thanks
I continue toward the following step

Yves
Titre: Re : Elevation on maps
Posté par: Broadsword le 21 mars 2010, 19:26:29 pm
Brucepos,

I followed all your steps, and it seemed to work OK in Scilab, but then when I opened my "Test" map in Histwar it was a mass of scattered little black dots.

Do you think you might be able to refine your manual a bit more, with more precise instructions and more explanations of the terms used? Also, could you show examples of how it works when you don't need to combine tiles and are using only one? I realize you've done a lot already by making this available, but it's a shame to have it not quite work when you've already put this much into it.

I felt as if I followed every step, yet it didn't work.

Thanks again,
Broadsword
Titre: Re : Elevation on maps
Posté par: brucepos le 21 mars 2010, 22:22:19 pm
Hi,

Sorry you're having such a bother - I know how frustrating these things can be!

I've tidied up the guide a bit and I've also produced a script file that will automate some of the SciLab stuff. I've just uploaded onto the mods server, so it may take a little time to appear.

The version 2 guide you're looking for is the PDF file - I manage to upload the old Word Document as the version 2 file by mistake!

Brucepos
Titre: Re : Elevation on maps
Posté par: Broadsword le 22 mars 2010, 01:25:11 am
Hi Brucepos,
Thanks again for the updated manual and the macro.
I wasn't sure how to use the macro -- do I just substitute my filename and path for "filename" in the Line 2, and then hit the "execute" command?
I tried that, but it hung up at one point with an error message:

for i=1:76;for j=1:101;remap(i,j)=linear_interpn(i,j,x1,x2,mapdata);end;end;
                                                                    !--error 999
linear_interpn: Wrong size for input argument #3.
at line       7 of exec file called by :   
exec('C:\Documents and Settings\Gina\Desktop\Histwar downloads\LG files\Altmacro.sce', -1)

Then I tried executing each command manually one by one, and all seemed OK until this:
->for i=1:76;for j=1:101;remap(i,j)=linear_interpn(i,j,x1,x2,mapdata);end;end;
                                                                    !--error 999
linear_interpn: Wrong size for input argument #3.

Suggestions? Also, your manual states: "Hook told us that the histwar maps use elevation data files 101 cells wide by 76 cells high." Would this be true for every size of HW map? I'm making a campaign map.
 
Titre: Re : Re : Elevation on maps
Posté par: Hook le 22 mars 2010, 01:52:46 am
Suggestions? Also, your manual states: "Hook told us that the histwar maps use elevation data files 101 cells wide by 76 cells high." Would this be true for every size of HW map? I'm making a campaign map.

The 6 km map is 61 by 46 cells.  All the rest, including the campaign map, are 101 by 76.

Hook
Titre: Re : Elevation on maps
Posté par: brucepos le 22 mars 2010, 07:22:13 am
Hi Broadsword,

It sounds as if something is going wrong at the data stage of things - if you put the file names left and right, top and bottom positions in correctly, then the macro should work. Could you tell me exactly what you put into the SciLab variables?
Titre: Re : Elevation on maps
Posté par: brucepos le 22 mars 2010, 13:29:13 pm
Hi folks,

Time for some humble pie :cry: - I've found an error in the instructions and macro that meant the last five lines of data weren't transferred to the histwar file. A new set of instructions (Version 3) and a new macro (version 3) have been uploaded to the mods depot.

If you are going to use the macro, remember to set the two filenames, and the left, right, top and bottom values BEFORE you execute the macro.

Good luck (and sorry for using you all as Alpha testers!)
Titre: Re : Elevation on maps
Posté par: Tirailleur le 22 mars 2010, 19:54:36 pm
Hi brucepos,

there is no problem to use us as alpha testers. This is really great work from you and it makes it so easy to have real height files for the napoleonic battlefields. It's the "dot on the i" for Les Grognards.

Thanks a lot
Titre: Re : Elevation on maps
Posté par: spec10 le 22 mars 2010, 20:11:12 pm
Only thing we gotta be careful about, or at least have them in mind: Some elevations might have changed over the years, so it's always good to check the sattelite data against historic maps when possible. (Famous example that comes to mind is the Waterloo battlefield where they moved an awful lot of soil to create that artificial hill that's standing there now, but of course that one's quite obvious. There might be more subtle changes on other Battlefields, I'm no expert on that, just some thought I just had)

But I'm sure many if not most battlefields haven't changed that much. At least that's what I hope, because this way of getting elevation data is simply awesome :)
Titre: Re : Elevation on maps
Posté par: brucepos le 22 mars 2010, 20:57:16 pm
That's a good point - after playing with the OOB editor I think it's like the published OOBs - hardly anything seems to agree and judgement is required. I had a bit of fun with the data visualising a bit of terrain I know - Arthur's Seat in Edinburgh!
Titre: Re : Elevation on maps
Posté par: brucepos le 22 mars 2010, 20:58:51 pm
....and here's the google Earth version
Titre: Re : Re : Elevation on maps
Posté par: Broadsword le 22 mars 2010, 21:43:14 pm
Thanks again for the V3 updates, Brucepos!
Tried again, but still no joy. I'm going to show you my inputs, so you can see where I might have gone wrong:
1. After deriving all the top, right, etc., numbers, I input them as follows:
-->size(alt1)
 ans  =
 
    6001.    6001. 
 
-->left=2108
 left  =
 
    2108. 
 
-->right=2714
 right  =
 
    2714. 
 
-->top=7608
 top  =
 
    7608. 
 
-->bottom=7560
 bottom  =
 
    7560. 

Then  I ran the macro, having changed my terms according to the name and path of my file (my master file is called "alt1"):
stacksize('max');
alt1=fscanfMat("C:\temp\alt1.txt");
mapdata=alt1(top:bottom,left:right);
[nr nc]=size(mapdata);
x1=1:75/(nr-1):76;
x2=1:100/(nc-1):101;
for i=1:76;for j=1:101;remap(i,j)=linear_interpn(i,j,x1,x2,mapdata);end;end;
remap=remap-min(remap);
iremap=iconvert(remap,2);
mopen(fileoutput,'wb');
for i=1:76; mput(iremap(i,:),'sl');end;
mclose();

The Console gave this error result:

-->exec('C:\Documents and Settings\Gina\Desktop\Histwar downloads\LG files\Altmacro3.sce', -1)
for i=1:76;for j=1:101;remap(i,j)=linear_interpn(i,j,x1,x2,mapdata);end;end;
                                                                    !--error 999
linear_interpn: Wrong size for input argument #3.
at line       7 of exec file called by :   
exec('C:\Documents and Settings\Gina\Desktop\Histwar downloads\LG files\Altmacro3.sce', -1)
 
Any ideas?
Titre: Re : Elevation on maps
Posté par: brucepos le 22 mars 2010, 22:43:40 pm
Hi Broadsword,

Try switching the numbers for top and bottom - the index is from the top of the map, so you'd expect the bottom number to be bigger.
Titre: Re : Re : Elevation on maps
Posté par: Broadsword le 23 mars 2010, 00:33:44 am
Hi Broadsword,

Try switching the numbers for top and bottom - the index is from the top of the map, so you'd expect the bottom number to be bigger.

Tried switching top and bottom, but now I got this error:

-->exec('C:\Documents and Settings\Gina\Desktop\Histwar downloads\LG files\Altmacro3.sce', -1)
mapdata=alt1(top:bottom,left:right);
                                    !--error 21
Invalid index.

at line       3 of exec file called by :   
exec('C:\Documents and Settings\Gina\Desktop\Histwar downloads\LG files\Altmacro3.sce', -1)
 
Titre: Re : Elevation on maps
Posté par: brucepos le 23 mars 2010, 07:17:32 am
Hi Broadsword,

If you send me your datafiles and your scilab environment file (use the save option in the menus at the top), I'll have a look at them for you. My Email address is on the instructions.
Titre: Re : Elevation on maps
Posté par: Hook le 23 mars 2010, 10:57:37 am
Just a guess here, but does bottom-top need to be 76 or greater?

The ratio between left to right and top to bottom isn't anywhere near what you'd expect... I suspect there's a math error calculating top and bottom.

Hook
Titre: Re : Elevation on maps
Posté par: Tirailleur le 23 mars 2010, 11:01:50 am
Hi Broadsword,

at my first try, i had the same error as you.

The problem seems to be if you only use the big data file (you can see this on your size(alt1) 6001). You have to look at your adjustments for Google Earth (the checkmarks), so you can see the sub data files, too.

One sub data file has a matrix of 1200 x 1200, so if you use only one data file you should see size(alt1) 1200 1200, or by two 2400 1200.

The big file is for example: srtm_39_03
The sub file: srtm_39_03_3_1
(as you see in the fantastic guide from brucepos)

All went well after i used the sub data files.
Titre: Re : Elevation on maps
Posté par: brucepos le 23 mars 2010, 11:53:35 am
I think Hook's right and there's something gone wrong with the calculcations of the indexes.

The point by Tirailleur is something I didn't realise could be done - I've only ever downloaded the sub files and didn't know that the file for the whole grid could be accessed.

Titre: Re : Elevation on maps
Posté par: Tirailleur le 23 mars 2010, 12:31:48 pm
Yes brucepos,

it's possible. When you click on the green data file symbol, you get an info window, where you can download the whole data of the big file.

I had the same problem with the same error, so it could be possible that it's the same problem.

But i don't know, Broadsword has to try out.
Titre: Re : Re : Elevation on maps
Posté par: TC237 le 23 mars 2010, 14:44:06 pm
Please keep working at this guys, it's going to be a huge help to the game.
....All went well after i used the sub data files.
Did you get the data to load in the map editor?

Another idea, there are a few free digital elevation programs available (MicroDEM) that can load these SRTM .asc files.
 I'm wondering if they can be useful. You can load the .asc file into MicroDEM, then via mouse drag, select the precise area you need for a map.
I haven't been able to export the resulting data into a file type that the game can use.
Mainly because I don't know exactly what all these different elevation data files are (.dem, .asc, .hgt, .prj) and how they are related or need to be converted.
Titre: Re : Re : Re : Elevation on maps
Posté par: Tirailleur le 23 mars 2010, 15:51:46 pm
Did you get the data to load in the map editor?

No, the download is available as mentioned in the guide from brucepos. There appears a pop up window in Google Earth (if you click the sub data file) where you can download the file.
Titre: Re : Elevation on maps
Posté par: Broadsword le 25 mars 2010, 22:13:59 pm
Thanks again, Brucepos!

I started over with my attempt at making my campaign map using the heightmaps and SciLab, etc., and it works like a charm. My Google map usermap aligns perfectly with the HighV4.hgh terrain image in LG. This is astounding, and it lets us re-create precise virtual Napoleonic battlefields from anywhere, in a fairly short time! I found the math part fairly daunting, and painstaking, but well worth the effort -- it's still much faster and results in a far superior map than trying to manipulate elevations in the LG map editor by hand.

What threw me the first time was that I downloaded the entire large-scale tile, rather than the two side-by-side smaller tiles I really needed. As they say, "garbage in, garbage out..." And I had to reread Brucepos' guide several times to grasp the nature of the "stacked" matrices and how to extract a smaller battlefield area from them.

But now the fun begins, and it will be fairly simple to draw my map features. I'll start with a river, then streams. I've learned the hard way to place towns before roads, so you can draw the roads to join precisely with where they enter the towns...My campaign map is the area north of the Landshut crossing from the 1809 campaign. I'll post it as soon as it's done and I know it works.
Titre: Re : Elevation on maps
Posté par: glaude1955 le 10 avril 2010, 21:36:08 pm
Merci Brucepos,

Merci de nous avoir fait découvrir Scilab. Ca fonctionne   (sans la macro qui elle pose des problèmes ausssi ne l'utilisons pas)

Yves

Thank you Brucepos, 
 
Thank you to have made us discover Scilab. That functions (without the macro that puts problems as don't use it) 
Titre: Re : Elevation on maps
Posté par: bibouba le 03 octobre 2010, 09:31:06 am
Ho Hook,

I ve done a test and it works perfectly.

But I ve seen that in a post previously you put a factor (3.5) for the elevation.

How do you do that in scilab ?

Don't see any factor line in the tuttorial. In fact i want to increase the elevation a beat for all mount that ive have in my map.
Titre: Re : Elevation on maps
Posté par: Alfiere le 03 octobre 2010, 10:15:38 am
I do not tried, but perhaps you can increase at point 17 of manual:
when scilab calculate the offset of high:

remap-=remap-min(remap); put the min elevation at 0 e calculate offset other high in matrix.

You can add after
remap=remap*1.05 ;   should be increase of 5% all elevation and 0 remain 0 because 0*1.05=0



Titre: Re : Elevation on maps
Posté par: Alfiere le 03 octobre 2010, 10:42:32 am
Now i have tried.
Seems to work.
I have tried with Auerstadt sat normal version higher point in a aerea zone 170 mt
after increase 5% with scilab , higher in same zone 179 mt with new HighV4
Scilab no errors.
Now the relative high is not real,perhaps there is a way to increase the step with a factor with the same high in HWLG.
But this is possible way.

In the images i have found another poit higher at 175 mt
Titre: Re : Elevation on maps
Posté par: bibouba le 03 octobre 2010, 11:34:18 am
I m gonna try it. thx
Titre: Re : Elevation on maps
Posté par: Alfiere le 03 octobre 2010, 11:38:10 am
In scilab the lowest point is set to 0 and highest point is set to 50.Is all relative.
If you have a 10 mt relative this became 10.5 mt relative.
It is only method to increase the steepness of  climb.
I had undestood that you wanted this.
Titre: Re : Elevation on maps
Posté par: bibouba le 03 octobre 2010, 11:44:40 am
when you write remap-=remap-min(remap);  are you sur that it goes to O ?
Titre: Re : Elevation on maps
Posté par: Alfiere le 03 octobre 2010, 11:48:21 am
yes if i understood well brucepos manual.
I read
"The first is to set the lowest altitude as zero an to offset other altitudes.This sounds complicated, but is really easy to do:
remap=remap-min(remap);"
Titre: Re : Elevation on maps
Posté par: bibouba le 03 octobre 2010, 11:50:43 am
look strange because when I do the methood that you explain me I should have point at 0. But in fact don't find any one. the remap*x apply even at 0 meters.
Titre: Re : Elevation on maps
Posté par: Alfiere le 03 octobre 2010, 12:07:42 pm
I have not controlled this.
Strange that 0*x is not zero.

If is so is not possible , perhaps ,but i do not know after

remap=remap-min(remap);
remap=remap*1.05;
(again)
remap=remap-min(remap);
example my map auerstadt  before 175-> 184 mt  and you tell that 0 is not zezo but perhaps 0.05 mt  ?
0.05 mt is put to 0 and 184 mt is put to 183.05 mt.

The manual seems to me clear.You find 0 meters without remap=remap*1.05; ?

Now take a look on my standard map.
Titre: Re : Elevation on maps
Posté par: bibouba le 03 octobre 2010, 12:12:10 pm
i m gonna do another test
Titre: Re : Elevation on maps
Posté par: Alfiere le 03 octobre 2010, 12:19:30 pm
I have found 0 meter on map with factor 1.05.
Titre: Re : Elevation on maps
Posté par: bibouba le 03 octobre 2010, 12:20:08 pm
when write, you do 1.05 or 1,05 ?
Titre: Re : Elevation on maps
Posté par: Alfiere le 03 octobre 2010, 12:21:54 pm
1.05
Titre: Re : Elevation on maps
Posté par: bibouba le 03 octobre 2010, 12:26:05 pm
Ok it works thax a lot.

it s great
Titre: Re : Elevation on maps
Posté par: Alfiere le 03 octobre 2010, 12:27:35 pm
It was a pleasure,Bibouba.
Hello