Code Monkey home page Code Monkey logo

hgtreader's People

Contributors

tito10047 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

hgtreader's Issues

Fix issue for negative coordinate(s)

Hi !
Bad value are return in case of negative (S for lat, W for lon) value(s)
Here is the fix:

		private function getSec($deg) {
			if($deg < 0) if($deg < 0) // fix for negative (S lat, W lon) value(s)
				$deg = abs(floor($deg))+$deg;
			$deg = abs($deg);
			$sec = round($deg * 3600, 4);
			$m   = fmod(floor($sec / 60), 60);
			$s   = round(fmod($sec, 60), 4);
			return ($m * 60) + $s;
		}

comparing result with gdallocationinfo

$data = "dtm-srtm1";
$lat = 45.46480442513404;
$lon = 5.925116105081207;
echo "getPhpAlt : ".Gis::getPhpAlt($lat,$lon,$data).PHP_EOL;
echo "getGdalAlt: ".Gis::getGdalAlt($lat,$lon,$data).PHP_EOL;
echo "-----------------".PHP_EOL;
$lat = 28.27269471435608;
$lon = -16.642273055313222;
echo "getPhpAlt : ".Gis::getPhpAlt($lat,$lon,$data).PHP_EOL;
echo "getGdalAlt: ".Gis::getGdalAlt($lat,$lon,$data).PHP_EOL;
echo "-----------------".PHP_EOL;
$lat = -21.099441526860588;
$lon = 55.480034066439416;
echo "getPhpAlt : ".Gis::getPhpAlt($lat,$lon,$data).PHP_EOL;
echo "getGdalAlt: ".Gis::getGdalAlt($lat,$lon,$data).PHP_EOL;
echo "-----------------".PHP_EOL;
$lat = -17.61924106680689;
$lon = -149.47775720235984;
echo "getPhpAlt : ".Gis::getPhpAlt($lat,$lon,$data).PHP_EOL;
echo "getGdalAlt: ".Gis::getGdalAlt($lat,$lon,$data).PHP_EOL;

return correct values

getPhpAlt : 1927.13
getGdalAlt: 1921
-----------------
getPhpAlt : 3705.69
getGdalAlt: 3707
-----------------
getPhpAlt : 3052.29
getGdalAlt: 3052
-----------------
getPhpAlt : 982.85
getGdalAlt: 985

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.