News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPRiot.com:
Reducing a Map Path Using Douglas-Peucker Algorithm
April 29, 2011 @ 12:40:42

On PHPRiot.com there's a new tutorial showing you how to use the Douglas-Peucker algorithm to make the pathing on your map the simplest possible (the fewer points the better) having serious benefits a wide range of users, most notably those on mobile devices.

When drawing a path on a map (for instance, the directions from point A to point B) it is important to consider the limitations of the device you're drawing the path on. In this article, I will show you how to reduce the number of points in a path so the path can be displayed with minimal loss of quality on devices such as iPhone or Android-powered devices that may struggle with an extremely large set of points.

Using the GTFS service's data, he's been creating maps for an iPhone application. Naturally, a path with 700 points would take a lot of resources to render. Using the Douglas-Peucker algorithm he can reduce it down to a much more manageable 70 points. He explains the algorithm briefly and hows how to implement it in PHP with three classes - ShapePoint, Shape and ShapeReducer. The resulting reduced dataset is then passed directly over to a Google Maps for plotting.

0 comments voice your opinion now!
douglaspeucker algorithm reduce tutorial map point path


blog comments powered by Disqus

Similar Posts

SitePoint Web Tech Blog: How to Test Multiple Websites on One PC With Apache Virtual Hosts

Vidyut Luther's Blog: Adding Subscribers to Campaign Monitor Lists using PHP5 and SOAP

The Bakery: New Articles/Tutorials - NiceHead, Field Validation and Plugin Paths

Michelangelo van Dam's Blog: Quality Assurance on PHP projects - PHP_CodeSniffer

Zend Developer Zone: PHP|tek 2009 Conference: Day 1


Community Events











Don't see your event here?
Let us know!


release opinion introduction unittest symfony2 security install hhvm database podcast support facebook application component composer package performance framework language hack

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework