Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LOS Graph all Mangled #70

Open
SnicketsCPT opened this issue Jun 2, 2015 · 8 comments
Open

LOS Graph all Mangled #70

SnicketsCPT opened this issue Jun 2, 2015 · 8 comments

Comments

@SnicketsCPT
Copy link

Hi

I Have installed Wind v1.0.1 and when I attempt to do a Line Of Sight Survey, my Graph is all mangled as below image, I am really desperate to get this to work any help would be greatly appreciated.
los

Many Thanks

@jammin84
Copy link
Contributor

jammin84 commented Jun 2, 2015

I've done some changes on this recently. As it didn't work at all for south
of the equator due to how the srtm file is read. When I get a chance I'll
upload the changes.
On 2 Jun 2015 8:40 pm, "SnicketsCPT" [email protected] wrote:

Hi

I Have installed Wind v1.0.1 and when I attempt to do a Line Of Sight
Survey, my Graph is all mangled as below image, I am really desperate to
get this to work any help would be greatly appreciated.
[image: los]
https://cloud.githubusercontent.com/assets/12714077/7935953/35b083da-0935-11e5-9346-27eda27785fa.jpg

Many Thanks


Reply to this email directly or view it on GitHub
#70.

@SnicketsCPT
Copy link
Author

Thanks so much. I will wait for the upload.

Kind Regards

CJ Van Vuuren
[2dbcf32]

Phone: +27 84 603 0046

Email: [email protected]:[email protected]

Fax: 086 721 0120

Website: www.nbconsult.co.zahttp://www.nbconsult.co.za/

[MCITP(rgb)_1313] [Mimecast MCTS L1 and 2 Certification Logo]

Disclaimer
The information contained in this communication from is confidential and may be legally privileged. It is intended solely for use by and others authorized to receive it. If you are not you are hereby notified that any disclosure, copying, distribution or taking action in reliance of the contents of this information is strictly prohibited and may be unlawful.
For more information please visit http://www.nbconsult.co.zahttp://www.nbconsult.co.za/

From: jammin84 [mailto:[email protected]]
Sent: 02 June 2015 04:47 PM
To: wind-project/wind
Cc: CJ van Vuuren
Subject: Re: [wind] LOS Graph all Mangled (#70)

I've done some changes on this recently. As it didn't work at all for south
of the equator due to how the srtm file is read. When I get a chance I'll
upload the changes.
On 2 Jun 2015 8:40 pm, "SnicketsCPT" [email protected]:[email protected]> wrote:

Hi

I Have installed Wind v1.0.1 and when I attempt to do a Line Of Sight
Survey, my Graph is all mangled as below image, I am really desperate to
get this to work any help would be greatly appreciated.
[image: los]
https://cloud.githubusercontent.com/assets/12714077/7935953/35b083da-0935-11e5-9346-27eda27785fa.jpg

Many Thanks


Reply to this email directly or view it on GitHub
#70.


Reply to this email directly or view it on GitHubhttps://github.com//issues/70#issuecomment-107978252.


This email message has been delivered safely and archived online by Mimecast.

For more information please visit http://www.mimecast.com

@SnicketsCPT
Copy link
Author

Hi Jammin84

Did you perhaps have time to upload the changes?

Many Thanks

@jammin84
Copy link
Contributor

Hi SnicketsCPT,

The changes I've made will only work for Southern Hemisphere ... I've
just been lazy and copy/pasted in below but it really needs some merging
and testing so both north/south will work simultaneously.

this is for file globals/classes/srtm.php

class srtm {

    var $data_path;

    function __construct($data_path='') {
            $this->data_path = $data_path;
    }

    public static function get_filename($lat, $lon) {
            $ll = srtm::get_lat_long_adjustments($lat, $lon);
            //print_R($ll);
            $n_lat = ($lat+$ll['lat_adj']);
            $n_lon = ($lon+$ll['lon_adj']);
            return $ll['lat_dir'] . sprintf("%02.0f",

abs((integer)($lat+$ll['lat_adj'])))
.$ll['lon_dir'].sprintf("%03.0f",
abs((integer)($lon+$ll['lon_adj']))).'.hgt';
}

    function get_lat_long_adjustments($lat,$lon) {
            //adjustment for filenames.
            // as the filename is based upon the bottom left corner
            // S locations will be records for -31.0 to -31.9 in a S32

file.
if ($lat < 0) {
$r['lat_dir'] = 'S';
$r['lat_adj'] = -1;
} else {
$r['lat_dir'] = 'N';
$r['lat_adj'] = 0;
}
if ($lon < 0) {
$r['lon_dir'] = 'W';
$r['lon_adj'] = 0;
} else {
$r['lon_dir'] = 'E';
$r['lon_adj'] = 0;
}
return $r;
}

    function get_elevation($lat, $lon, $round=TRUE) {

            $filename = $this->data_path.$this->get_filename($lat,$lon);
            if ($lat === '' || $lon === '' || !file_exists($filename))

return FALSE;

            $file = fopen($filename, 'r');

            $ll = $this->get_lat_long_adjustments($lat,$lon);
            $lat_dir = $ll['lat_dir'];
            $lat_adj = $ll['lat_adj'];
            $lon_dir = $ll['lon_dir'];
            $lon_adj = $ll['lon_adj'];
            $y = $lat;
            $x = $lon;

            //whole number - full number * lines (1201)
            // * (
            $line = (integer)(( (integer)$lat - $lat )* 1201);
            $pixel = round(($lon - (integer)$lon ) * 1201);

            //Debug
            if (isset($_SESSION['userdata']['id']) &&

$_SESSION['userdata']['id']=="-1") {
//echo "filename:$filename, lat:$lat, lon:$lon\n";
//echo "Line:$line, pixel:$pixel, iLine:$iLine,
offset $offset_no_adj
\n";
}
//file naming is from lower left corner.
//data is stored within the file from the upper left corner.
$offset = (($line_1201) + $pixel)_2;

            fseek($file, $offset);
            //reverse string - file read (handle, length)
            $h1 = bytes2int(strrev(fread($file, 2)));
            if ($h1 == -32768) {
                    $h1 = 0;
            }
            fclose ($file);
            return $h1;
    }

}

function bytes2int($val) {
$t = unpack("s", $val);
$ret = $t[1];
return $ret;
}

Regards

Ben Jolly

On 11 June 2015 at 15:31, SnicketsCPT [email protected] wrote:

Hi Jammin84

Did you perhaps have time to upload the changes?

Many Thanks


Reply to this email directly or view it on GitHub
#70 (comment).

jammin84 referenced this issue in jammin84/wind Dec 13, 2015
fixes form action url so photo is applied to correct node id
@jammin84
Copy link
Contributor

Thanks Spinza,

The problem originates from the southern hemisphere SRTM files being read in reverse byte order.

Someone will need to merge and test my code above (11th june) with the WiND version to properly fix this issue.

WiND version only works in Northern Hemisphere, my version above only works in Southern Hemisphere.

@thetechshack
Copy link

Hi there,
I'm using WiND v1.1-0-a1 and fixed the code with LOS issue, but I see the LOS graph is missing on that page/window. Another problem is LOS to APs and other nodes when editing nodes. See images.
wind2
wind1

What am I doing wrong or missing?
Thanks for your assist

@thetechshack
Copy link

Fixed it but there a lot of bugs to be fixed it seems. I'm no programmer but I find my way around.
wind3

@jammin84
Copy link
Contributor

@thetechshack as we had issues getting pull requests resolved, we've now forked this project to https://github.com/southern-wind/wind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants