-2

I am working with the Google Maps Javascript API. I have 793 points with some associated information in a MySQL table. This morning I added 303 points to reach the current total. There are now three data "sources" by which I am color coding the markers. This morning prior to adding the additional markers there were only two data sources and all points (490) were apparently being mapped. (this is apparently still true if I select only points matching first two sources)

I have confirmed XML output exists from the PHP data-fetching sub-page for all 793 points including the corresponding source information. The problem is that the first data source points are no longer appearing.

If I select random points and limit them to 500, then all three colors appear in approximately the appropriate distributions, but when I remove the limit there are no markers for the first data source anymore.

Weirder still it seems like the first points are falling off when I don't randomize but do limit the results. In that case, the proportions of colors bias toward the second and third source points until there are no more points from the first source.

I cannot find evidence of a limit for the number of markers that can be displayed using the Javascript API (although I do know I am approaching the reasonable marker display density in some neighborhoods, that is not my concern yet).

Similar question: how to raise a marker limit in Google Maps? (Answers suggest there is no API limit)

FYI, I have not included any code because the code seems to be working correctly except for the roll off effect that appears to be attributable to the API. If you think I may be making an error in the code that is producing the described behavior I will edit my question to include additional information. Thank you.

Community
  • 1
  • 1
  • 2
    As far as I know, there is no marker limit except for what you'll run into on the client's processing power (I have placed thousands on a Google Map). We would need to see some code to see what you're doing. Admittedly this may not be what you're looking for, but I found it a very nice solution for the "too many markers" problem - *Marker Clustering:* https://googlemaps.github.io/js-marker-clusterer/docs/examples.html – dmgig Mar 14 '16 at 17:06
  • Agreed about the marker limit--there is none for the API. No client processing power issues, the map is operating normally. I will pursue the clustering as necessitated by the marker density once I am sure all markers are being displayed. – diggabledork Mar 14 '16 at 17:12
  • 1
    It would help if you provided code, I imagine you must be setting marker.map = null someplace. – dmgig Mar 14 '16 at 17:13
  • Why would you imagine that if it works for a subset of the data but when I change the query to include more data suddenly points are dropping off? When I randomize I see markers of all three colors. When I don't I only see the second and third marker colors. – diggabledork Mar 14 '16 at 17:20
  • I have a feeling that when you are looping through your dataset to add the markers to the map, you are inadvertently removing some of the existing. I assume you are storing all of your markers in an array? Are you overwriting them maybe? Again, hard to know without code. – dmgig Mar 14 '16 at 17:22
  • How are you displaying the markers on the map? Are you using the visualization library with fusion tables? Please provide a [Minimal, Complete, Tested and Readable example](http://stackoverflow.com/help/mcve) that demonstrates the issue. – geocodezip Mar 14 '16 at 17:33
  • Difficult to produce minimal and complete example when dealing with 793 points and the problem is only apparent over 490. I cannot publish these addresses to generate the example. I am displaying the markers on the map by `var marker = new google.maps.Marker({ map: map, position: point, icon: icon.icon });` this happens inside a forloop: `for (var i = 0; i < markers.length; i++) {` – diggabledork Mar 14 '16 at 17:45
  • I can't believe the moderators (geocodezip, DesertIvy, Lawrence Aiello, Drew, Unheilig) don't see the value here. The big takeaway is about overlapping points being easy to (dis)miss. No one suggested that might be the problem. See also: [here](http://stackoverflow.com/questions/21694211/google-map-markers-overlapping-and-not-visible) and [here](http://stackoverflow.com/questions/8258124/google-map-api-v3-markers-overlapping). In addition, as I mentioned in the question, the problem was hinted at by the ordering! See also: [here](http://stackoverflow.com/search?q=overlapping+map+markers+order) – diggabledork Mar 15 '16 at 12:54

1 Answers1

0

Garbage in, garbage out: The data is bad, where is the bathroom?

Markers of each color show up when the data is randomly selected because it changes the data order. Without randomization, redundant points covered the first set of points making it appear as though there were no first data points. Randomized data randomly covered either the first or third color rather than only the first.

I wonder if I had posted the (working) code, would anyone have helped me figure out that the code wasn't the problem faster?

The MySQL query I used to determine the problem: select PropertyID, FormattedAddress, Latitude, Longitude, Source from MapData group by Source;

This produced three results, one from each source, at which point the redundancy was obvious. I will go back to the data compilation phase and correct it.