My team and I are having an issue with a google map object in our rails app.
Bascially, we have a database. one of the tables has 9 rows in it, each with location attributes. When the page with the google map on it loads, it querys the database, grabs all the location attributes for those 9 rows into an array, loops through and sets markers on the map at all 9 locations, then sets a marker where the user currently is, then puts a 500M radius around said user. This all works beautifully (I’m rather impressed as I’ve never done anything like this before). However, we made a page accessible by mobile devices such as an ipad. My team members worked all that out, it works good.
We are now running into a weird issue. When I navigate to the page.mobile on my laptop to view the mobile page in my browser, AND if I connect and navigate there on my ipad, what it does is it loads the map, all the markers, the users marker, the radius, then stop for a second, then clears all markers and the radius and reloads the map at coords 0,0 (middle of the ocean). I can’t figure out why it does that? Theres no excecuting script after the map loads.. the function that populates the map and all that is the last javascript function that I have excecuting. No errors come up in the console, nothing happens in the rails server after the map loads, the last thing to load is assets/beachflag.png (for the users location), the map also still works fine, just that all the markers and things are gone.
The desktop version seems to work fine also.
Has anyone else seen a similar issue? I need help… This is messedddd up!
p.s. if it matters im using the latest versions of rails and ruby
@rthbound No, just using the javascript api. All the google maps stuff is done with javascript.
regarldess I figured it out. I had a function in my javascript file to initialize the map. I was calling it twice on the page, Once in a script tag on the page, once in the onload function of the body tag. The onload happened last, thus after the map was populated, thus clearing the map and setting it to 0,0