I'm trying to find the concave hull of a lat, lon pointset but when I project my points on my map it doesn't look like expected. I've tried a lineare projection and a spherical projection. My data is about 10000-70000 lat lon pairs. How is this possible?
$mapWidth = 2000; $mapHeight = 2000; $mapLonDelta = $mapLonRight - $mapLonLeft; $mapLatDelta = $mapLatTop - $mapLatBottom; $worldMapWidth=(($mapWidth/$mapLonDelta)*360)/(2*M_PI); $f=min(max(sin($mapLatBottom*(M_PI/180)),-0.9999),0.9999); $mapOffsetY=$worldMapWidth/2 * log((1+$f)/(1-$f)); $f=min(max(sin($mapLatTop*(M_PI/180)),-0.9999),0.9999); $mapOffsetTopY=$worldMapWidth/2 * log((1+$f)/(1-$f)); $mapHeightNew=$mapOffsetTopY-$mapOffsetY; $mapRatioH=$mapHeight/$mapHeightNew; $newWidth=$mapWidth*($mapHeightNew/$mapHeight); $mapRatioW=$mapWidth/$newWidth; $tx = ($lon - $mapLonLeft) * ($newWidth/$mapLonDelta)*$mapRatioW; $f = sin($lat*M_PI/180); $ty = ($mapHeightNew-(($worldMapWidth/2 * log((1+$f)/(1-$f)))-$mapOffsetY));
This should look like Germany. What's wrong?:
Update: It seems to work. This is a map of Bonn(Germany):