Jump to content

Find What Image Map Area A Pixel Is In


duncan_cowan
 Share

Recommended Posts

I have a map of the world and each country is an area on an image map.The user will select a start location and an end location and the script will cycle through each pixel in a direct line from the start to the end and i want to find out what country the pixel is in or if it is over sea.

Link to comment
Share on other sites

Correct, there's not a built-in way to do that. You would need to have a Javascript array or something similar where you define the regions and what pixels they cover that you can use to cross-reference a pixel with a region.

Link to comment
Share on other sites

You could devise an algorithm and mathematical formula to find out which pixels are in the area by the coordinates. I'm not going to tell you how to do that, though. I'd need to do some research myself, it's not something simple because it requires geometry.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...