Search code examples
ruby-on-railsrubygoogle-maps-api-3ruby-on-rails-3.1gmaps4rails

How many json entries can be displayed through a replace marker code in gmaps4rails?


Currently I have four .json feeds that can be switched between by clicking corresponding button to replaceMarkers based on the gmaps4rails wiki instructions.

Only, that worked fine with the testing/development environment, and now that we are populating real data on the production server, it is not allowing the replaceMarker code to display any info. We have over 50 listings and will be adding well over 1000 soon.

Is there a cap on markers that can be displayed? If so, how do we go around this for gmaps4rails?

<% content_for :scripts do %>
<script type="text/javascript" charset="utf-8">
    $(function(){
        $("#controller1_markers").click(function(){
            $.getJSON('/controller1.json', function(data){
                Gmaps.map.replaceMarkers(data);
            });
        });

And referencing the feed has worked fine until we started adding in new locations.

Any ideas?

EDIT 1

So I looked at the code and wiki a bit deeper and figured that perhaps in this instance I am not calling the callback properly, as the:

$.getJSON('/controller1.json', function(data) {
Gmaps.map.replaceMarkers(data); 
});

function may be older code for this type of problem using a more 3.1 approach and @json instead of directly naming the location of '/controller1.json'?

Edit 2 (dec.14)

The (data) is the .json string- which looks like:

[{"description": "<a href='/controller1/example-location-1'>Example Location<br />Cafe</a>", "title": "Example Location", "picture": "/images/controller1.png", "width": "60", "height": "60", "lng": "-94.5857704", "lat": "39.0920075"}, ...}]

.. and so on for 64 entries, soon to be 1000+.

The response on the browser shows that there is an Object being passed for each click, however- there are FOUR replaceMarkers codes, for four different models, called the same way. Even weirder, no replaceMarkers functions work on IE, same problem as described above on Chrome and Firefox, and it ALL works on iPhone and iPad... Hence my confusion.


Solution

  • Solved in private chat.

    The problem was due to gmaps4rails not escaping tabs in json, leading to issues in some browsers.