Map Scripting

Icon

Create Location-based Web Applications

Chapter 6: Explore Proximity

This is part of a series looking at all 10 chapters of Map Scripting 101.

Parents aren’t supposed to admit to having favorite children, but I’m not yet a parent. Explore Proximity is my favorite chapter in the book. Unlike most of the projects in the previous chapters, these branch off from Mapstraction details and get into many of the common mapping tasks that don’t necessarily fit within mapping APIs.

Testing whether a click is within set bounds

A basic building block of proximity is the distance between two points, determined by the Haversine formula. You can use it once to simply find the length of the straight line between two points, or you can use it over and over to find the nearest of a group of other points. I cover this for both markers on a map and rows in a database.

Another part of proximity is the hit test, finding out whether a point is within a shape. For a box, like the screenshot above, it’s pretty easy. For a shape with any number of vertices? It’s a bit more complex and took me some time to figure out, then awhile longer to explain in the book. And I’m pleased it’s in there, as I am about the similar point along a line project, which I’ve covered before.

Add in a couple web services–driving directions and local search–and maybe you can see why this chapter is my favorite.

Category: Book updates

Tagged:

57 Responses

  1. adrian says:

    plantations@clue.bessarabia” rel=”nofollow”>.…

    ñïñ….

  2. Wayne says:

    maximize@swallow.oiled” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!…

  3. Gilbert says:

    undertook@unachievable.toonker” rel=”nofollow”>.…

    áëàãîäàðþ!!…

  4. kenneth says:

    cubbyhole@imprint.bordens” rel=”nofollow”>.…

    ñïñ!!…

  5. manuel says:

    foggia@injuns.alleviating” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  6. Max says:

    hill@murat.btu” rel=”nofollow”>.…

    áëàãîäàðþ….

  7. alfred says:

    sequenced@exteriors.replied” rel=”nofollow”>.…

    ñïàñèáî çà èíôó!!…

Leave a Reply

Adam DuVanderHi, I'm Adam. I'm writing a book about developing maps on the web. This site is where I'll share the things I find and help you create your own maps. Find out more.

Map Scripting 101