Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am designing an application that allow users to highlight areas of a geographical map using a tool that is like brush or a pen. The tool basically draw a circle with a single click and continue drawing those circles with mouse move.

Here is an example of drawing made by moving the tool. It is pretty much same as Microsoft Paint.

enter image description here

Regardless of programming language what is best approach (most inexpensive approach) for saving this kind of data?

share|improve this question
up vote 4 down vote accepted

There is an implementation of MVC objects in Google Maps JavaScript API V3. It allows map objects to store state and update their presentation automatically. There is a DEMO of moving and resizing a circle which may provide what you require. The full tutorial can be seen HERE

share|improve this answer
+1. This is better than my answer because it provides a complete solution with minimal coding. Internally the library seems to be doing the same thing as what I had outlined though. – Apoorv Khurasia Oct 21 '12 at 16:42
Glad to be of help. – david strachan Oct 21 '12 at 16:44
Thank you for references. I find out this a better match for my needs. – Mohsen Oct 21 '12 at 21:44

I am not aware of any mapping libraries that support highlights outright but if you want to do this with Google Maps or Yahoo GeoService then you can simply record the latitude and longitude of the bounds of the highlight area in a database.

On loading the map again, you can restore the highlight area from those bounds by rendering points using the lat/long. The approach will also work with resizable and transformable maps.

Obviously, the more complicated shapes you support the messier the implementation would get. Simplest would be to support shapes that follow a simple 2 variable equation (e.g., circles or rectangles).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.