I have a Drupal 7 project that I want to add location information (latitudinal/longitudinal) to most of my content types. Currently I have noticed that if there are multiple nodes that are shown on a map and if any of those nodes have identical latitudinal/longitudinal data, then the map markers are overlaid on top of one another and only the top map marker is visible. The markers under the top most marker can’t be accessed (clicked to show data).
This essentially hides content, which is a type of bug, and if the content is hidden, most times you won’t realize it is a problem.
This becomes a serious problem when you are generating map data from address locations. The user can be very vague with their address, and simply put their country ie: “Mexico”. If other nodes are created with such vague data then the overlap problem occurs.
One was around this is to use the module “Google Map Field”, which allows the user to use a map with a map marker when creating or editing content to specify where the node is referring to. The lat/long data is generated behind the scenes. It is very hard to get duplicated lat/long data when selecting the location on a map with a map marker. One problem with this is that the “Google Map Field” also allows them to enter their location by address, (ie:Eugene, Oregon, USA), if they don’t want to do it with the map/marker. An admin can put a nice label on the field saying to only use the map/marker, and not put it in by address, but people often ignore instructions on labels.
We also need to have location (lat/long) data for Users “Profile2” profile. One problem with this is the “Google Map Field” does not work with Profile2, and gives a recursion error. The only way around this is to make the user put their lat/long data in by hand (not going to happen), or do it like we are currently doing it, where the user puts in their address and the lat/long data is calculated from that address. Again the problem where users can put in vague address location information and cause duplicate lat/long data that cause map marker obfuscation.
I have not seen any good solutions for this. I have thought of some custom solutions (some I don’t know are possible, and currently purely hypothetical)
1)For “Google Map Field” somehow disallow the inputting of the location information through the address textbox, thereby forcing them to enter their address information from the Map/Marker. I am not sure what best ways of doing this are…Change the available fields for the module manually? Find a different contributed module that allows you to deny certain fields for nodes being created or edited? (does such a module even exists?)
2) A possible solution would be to create a module that goes through the Drupal database and finds tables that have latitudinal/longitudinal coordinates that are attached to content types. The module would check for identical latitudinal/longitudinal coordinates that were identical and change their coordinates ever so slightly (like adding a one-one-hundredth of a degree to one of the identical coordinates, there by making them non identical. Experimenting with this manually, I was able to change one-one-thousandth of a degree to one lat/long row for identical location coordinates and this corresponded to about a 1 block change in location (thereby making the 2 markers have different locations on the map). If you set this module up to perform this calculation and data alteration every time cron is run then you would then solve your identical lat/long data problem.
One potential problem I have thought of is that we would like, in the end to have our profile2 profile data synchronize with our Salesforce data, and if that was the case, then if the Salesforce data was altered, it would synchronize with our Drupal data, and then the lat/long data could potentially overwrite our changes our custom module made, thereby adding identical lat/long data (sort of un-fixing our fix). If we did have our Profile2 data synchronizing with Salesforce (which would sync every cron run), I had considered finding a way to make sure our custom module was run AFTER the Drupal/Salesforce sync module ran.
I’m posting these hypothetical solutions to you, the Drupal community because it is possible that one of you have already solved this problem, and have just not posted anything about it, or you might have a strong opinion about one of these solutions, one way or another. It might be possible that you have encountered this problem, but had no solution, even hypothetical in mind, and this posting to this forum helps you in some way.
Please, I would love to hear alternative solutions, opinions about my hypothetical solutions, or thoughts in general about this identical location map marker overlay problem.