Re: [OSM-talk] Kosmos v1.3 - shaded relief

2008-01-14 Thread Artem Pavlenko
Hi Igor,

Thanks very much for shaded relied algos. I didn't have a chance to  
look, yet, but I sure will.

Cheers
Artem
On 13 Jan 2008, at 17:50, Igor Brejc wrote:

> Artem Pavlenko wrote:
>>
>> AFAIK, all freely available void-filled SRTMs are not free. At  
>> least there's 'for non-commercial use only' clause attached.
>>
> Yes, that's true. When I find the time I will examine the sources  
> and try to contact authors to ask them permission to use their  
> data. As for the "non-commercial use", since Kosmos itself is by  
> currently licensed for non-commercial use only, I don't think that  
> should be a problem.
>>
>> Yes, please. I'm very interested in new ideas for generating  
>> reliefs and filling voids.
>>
>> Anyways, great stuff!
>>
>> Cheers
>> Artem
> I've attached source files for all of the shading algorithms used  
> in Kosovo. I plan to add some more (like elevation coloring) in the  
> future. I hope the source code helps - I've included all the  
> relevant stuff. If you have any questions or suggestions, please  
> feel free to write. I saw your work on DEM processing and I'm  
> impressed. I too am interested in new ideas :)
>
> Regards,
> Igorusing System;
> using System.Collections.Generic;
> using System.Text;
> using System.Drawing;
> using System.Diagnostics.CodeAnalysis;
> using log4net;
> using Brejc.DemLibrary.Shading;
>
> namespace Brejc.DemLibrary
> {
> public sealed class DemProcessor
> {
> static public Image GenerateShadedReliefImage (
> IRasterDigitalElevationModel dem,
> IShadingMethod shadingMethod,
> ShadingParameters shadingParameters)
> {
> Bitmap bitmap = new Bitmap (dem.LonLength, dem.LatLength);
>
> double[][] window = new double[3][] { new double[3],  
> new double[3], new double[3] };
>
> double earthRadius = 636;
> double earthCircumference = earthRadius * 2 * Math.PI;
> double latSpacing = earthCircumference / (360 *  
> dem.LatResolution);
>
> shadingMethod.Initialize (shadingParameters);
>
> for (int y = 1; y < dem.LatLength - 1; y++)
> {
> GeoPosition geoPos = dem.GetGeoPosition (0, y);
> double lonSpacing = earthCircumference / (360 *  
> dem.LonResolution) * Math.Cos (geoPos.Latitude * Math.PI / 180.0);
>
> for (int x = 1; x < dem.LonLength - 1; x++)
> {
> GetMovingWindow (dem, window, x, y);
>
> double dzdx = ((window[0][0] + 2 * window[0][1]  
> + window[0][2])
> - (window[2][0] + 2 * window[2][1] + window 
> [2][2]))
> / (8 * lonSpacing);
>
> if (double.IsNaN (dzdx))
> continue;
>
> double dzdy = ((window[0][0] + 2 * window[1][0]  
> + window[2][0])
> - (window[0][2] + 2 * window[1][2] + window 
> [2][2]))
> / (8 * latSpacing);
>
> if (double.IsNaN (dzdy))
> continue;
>
> double riseRun = Math.Sqrt (dzdx * dzdx + dzdy  
> * dzdy);
> double slope = Math.PI / 2 - Math.Atan (riseRun);
>
> double aspect = Math.Atan2 (dzdy, dzdx);
>
> //double aspect = Math.Atan2 (window[1][0] -  
> window[1][2],
> //window[0][1] - window[2][1]);
>
> if (dzdx != 0 || dzdy != 0)
> {
> if (aspect == 0)
> aspect = Math.PI * 2;
> }
> else
> {
> aspect = 0;
> }
>
> Color color = shadingMethod.CalculateColor  
> (aspect, slope);
>
> bitmap.SetPixel (x, bitmap.Height - y, color);
> }
> }
>
> return bitmap;
> }
>
> static private void GetMovingWindow  
> (IRasterDigitalElevationModel dem, double[][] window, int x, int y)
> {
> for (int xi = -1; xi <= 1; xi++)
> for (int yi = -1; yi <= 1; yi++)
> window[xi + 1][yi + 1] =  
> dem.GetElevationForDataPoint (x + xi, y + yi);
> }
>
> private DemProcessor () { }
>
> [SuppressMessage ("Microsoft.Performance",  
> "CA1823:AvoidUnusedPrivateFields")]
> static readonly private ILog log = LogManager.GetLogger  
> (typeof (DemProcessor));
> }
> }


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] Kosmos v1.3 - shaded relief

2008-01-13 Thread Artem Pavlenko

On 12 Jan 2008, at 10:14, Igor Brejc wrote:

> Artem Pavlenko wrote:
>>
>> I've tried latest Kosmos and it works fine, though a bit slow. Are  
>> you planning to release source?
> Are you referring to the slowness of generating reliefs or  
> generally? When generating reliefs the application first has to  
> download the DEM tiles from NASA FTP site and that may take a while.

Yes, I realized this :)
> But once the DEM is cached locally on your disk, it should work  
> more or less quickly, depending on the hardware.

I've tried again today and it runs not bad ( I'm using http:// 
www.openstreetmap.org/api/0.5/map? 
bbox=-1.37171315786,51.6923750052,-1.14129050705,51.8207152165 ).  
It's possible that vista was downloading and installing updates last  
time , I hardly ever use it.

>> I'm interested to try your shaded relief algorithm. Also, how do  
>> you fill voids ?
>>
> Currently, the voids are not filled :). I'm using the original NASA  
> SRTM3. But I am planning to include void filling or at least  
> support for void-filled datasets that are freely available on the net.

AFAIK, all freely available void-filled SRTMs are not free. At least  
there's 'for non-commercial use only' clause attached.

> As for releasing the source code: I still want to implement a lot  
> of ideas with Kosmos, but I haven't got the time to be involved  
> with maintaining an open source project on a daily basis.
> So until I feel it has reached a certain level of maturity, I'm  
> keeping it closed source.

I understand.
> But if you're interested in any particulars (like shading  
> algorithms), I can send you the code.

Yes, please. I'm very interested in new ideas for generating reliefs  
and filling voids.

Anyways, great stuff!

Cheers
Artem

>
> Regards,
> Igor


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] Kosmos v1.3 - shaded relief

2008-01-12 Thread Igor Brejc
Artem Pavlenko wrote:
>
> I've tried latest Kosmos and it works fine, though a bit slow. Are you 
> planning to release source?
Are you referring to the slowness of generating reliefs or generally? 
When generating reliefs the application first has to download the DEM 
tiles from NASA FTP site and that may take a while. But once the DEM is 
cached locally on your disk, it should work more or less quickly, 
depending on the hardware.
> I'm interested to try your shaded relief algorithm. Also, how do you 
> fill voids ?
>
Currently, the voids are not filled :). I'm using the original NASA 
SRTM3. But I am planning to include void filling or at least support for 
void-filled datasets that are freely available on the net.
As for releasing the source code: I still want to implement a lot of 
ideas with Kosmos, but I haven't got the time to be involved with 
maintaining an open source project on a daily basis. So until I feel it 
has reached a certain level of maturity, I'm keeping it closed source. 
But if you're interested in any particulars (like shading algorithms), I 
can send you the code.

Regards,
Igor

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] Kosmos v1.3 - shaded relief

2008-01-11 Thread Artem Pavlenko
Hi Igor,

On 10 Jan 2008, at 22:46, Igor Brejc wrote:

> Hello everybody,
>
> Kosmos rendering engine has a new version (1.3). The main new  
> feature is
> relief shading tool in Kosmos.Gui, which can automatically download  
> and
> process SRTM3 data for a given map area.
> If you're interested, visit http://wiki.openstreetmap.org/index.php/ 
> Kosmos.

I've tried latest Kosmos and it works fine, though a bit slow. Are  
you planning to release source?
I'm interested to try your shaded relief algorithm. Also, how do you  
fill voids ?

Cheers
Artem

>
> Good night,
> Igor Brejc
>
> ___
> talk mailing list
> talk@openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


[OSM-talk] Kosmos v1.3 - shaded relief

2008-01-10 Thread Igor Brejc
Hello everybody,

Kosmos rendering engine has a new version (1.3). The main new feature is 
relief shading tool in Kosmos.Gui, which can automatically download and 
process SRTM3 data for a given map area.
If you're interested, visit http://wiki.openstreetmap.org/index.php/Kosmos.

Good night,
Igor Brejc

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk