gmaps4rails

GMaps4Rails and Turbolinks not loading without full page refresh

天涯浪子 提交于 2019-11-30 12:14:27
问题 I'm using gmaps4rails to load a map on a "clients" show page. I've integrated turbolinks to make the app speadier all together, but now I'm hitting an issue where I have to refresh the page with the map for the map to show up. All I get is a blank map frame. When I refresh the page, the map shows up correctly. I tried adding the gem 'jquery-turbolinks', but the problem persists. In view: <%= gmaps("map_options" => {:container_class => "map_container_renamed", "zoom" => 15, "auto_zoom" =>

Zoom bar disfigured in Google-Maps-for-Rails (gmaps4rails)

百般思念 提交于 2019-11-30 06:48:32
For some reason my zoom bar is all pixelated and I'm not sure why. Any ideas? I used the basic setup: Controller: @json = User.all.to_gmaps4rails View: <%= gmaps4rails(@json) %> I'm not passing any special parameters or anything. The markers that I have on my models show up beautifully. Add this to your css... there you will also have an issue with the terrain and overlays dropdowns... #mapCanvas label { width: auto; display:inline; } #mapCanvas img { max-width: none; } With the gmaps4rails 1.5.6, use map instead of mapCanvas , i.e., #map label { width: auto; display:inline; } #map img { max

GMaps4Rails and Turbolinks not loading without full page refresh

江枫思渺然 提交于 2019-11-30 02:08:12
I'm using gmaps4rails to load a map on a "clients" show page. I've integrated turbolinks to make the app speadier all together, but now I'm hitting an issue where I have to refresh the page with the map for the map to show up. All I get is a blank map frame. When I refresh the page, the map shows up correctly. I tried adding the gem 'jquery-turbolinks', but the problem persists. In view: <%= gmaps("map_options" => {:container_class => "map_container_renamed", "zoom" => 15, "auto_zoom" => false},"markers" => { "data" => @json }) %> In application.js //= require jquery //= require turbolinks //=

Ruby on rails gem for google map integration

自古美人都是妖i 提交于 2019-11-30 01:37:59
I would like to ask which is the best solution for integrating google maps into ruby on rails apps. Is a specific gem worth it or should we write our own views for it? Thanks for any input. I've used the YM4R, Georuby and spatial adapter gems with good results before. see this description . Fyi, I've finished a stable release of gmaps4rails. See: https://github.com/apneadiving/Google-Maps-for-Rails If your requirements are only to show google map of specific region, possibly with some markers, you can use Google Maps Static Image API, for example: <img src="http://maps.google.com/maps/api

Gmaps4rails Maximum call stack size exceeded?

南楼画角 提交于 2019-11-29 15:29:49
I've got the following setup, what I want to do is update the markers when a map is moved: https://gist.github.com/277894809fe04cbc29c7 The json endpoint returns for example: [{"_id":"4ecc19ca8de17b2f0f000001","latitude":47.413358,"location":[47.413358,9.744583],"longitude":9.744583,"name":"d2"},{"_id":"4ecc14e68de17b2924000001","latitude":47.413417,"location":[47.413417,9.744417],"longitude":9.744417,"name":"another"}] but I get the following error when moving the map: Uncaught RangeError: Maximum call stack size exceeded I.get a.(anonymous function) tB.(anonymous function).zoomRange_changed

Google Maps for Rails - update markers with AJAX

我怕爱的太早我们不能终老 提交于 2019-11-29 12:42:43
I am working on a web app and I use Ruby on Rails. Our index is made of a map and of a search field. You can search a location and the map updates its markers. I would like to use Ajax to avoid refreshing the page. So I added remote: true to the form, a respond_to in the controller and a new search.js.erb. My search.js.erb renders a partial _googlemap.erb which contains the script to initialize the map. Here is my problem. As the map already exists, it's like if I wanted to create the same object twice, which of course doesn't work and is awfull. I'd like to update only markers in the map with

How do I display the user's location with a marker in gmaps4rails?

て烟熏妆下的殇ゞ 提交于 2019-11-29 10:27:19
问题 I have been trying to get a custom use of gmaps4rails running, and I have the code set to display my string of json coordinates on the map, and the center on user IS working, I can zoom into my location from home, work and my phone. I just cannot get the js right to display an 'Im here' button on the map once permission is given. here is the code I use for the map from gmaps4rails: <%= gmaps(:map_options => {:detect_location => true, :center_on_user => true, :auto_zoom => false, :zoom => 12,

Rails - gmaps4rails gem on postgres

不羁岁月 提交于 2019-11-28 14:24:46
I successfully use the gmaps4rails gem on my local MySQL machine. However, when I deploy to PG on Heroku, I get the following error with respect to code that uses the gmaps4rails "near" function to find locations near the selected location: 2012-05-21T17:58:40+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: operator does not exist: numeric - character varying 2012-05-21T17:58:40+00:00 app[web.1]: ^ 2012-05-21T17:58:40+00:00 app[web.1]: LINE 1: ...8.755864232 * 2 * ASIN(SQRT(POWER(SIN((30.1926300 - venues.l... 2012-05-21T17:58:40+00:00 app[web.1]: HINT: No operator matches

Google Maps for Rails - update markers with AJAX

倾然丶 夕夏残阳落幕 提交于 2019-11-28 06:54:04
问题 I am working on a web app and I use Ruby on Rails. Our index is made of a map and of a search field. You can search a location and the map updates its markers. I would like to use Ajax to avoid refreshing the page. So I added remote: true to the form, a respond_to in the controller and a new search.js.erb. My search.js.erb renders a partial _googlemap.erb which contains the script to initialize the map. Here is my problem. As the map already exists, it's like if I wanted to create the same

Dynamically load Google Maps Markers with gmaps4rails

北城以北 提交于 2019-11-28 04:47:46
How do I load only markers that are inside the map bounds with gmaps4rails ? And of course load new ones after pan and/or zoom. Directly related to that, how can I get the current boundaries and zoomlevel of the map? Here is how I did it, I only replace the markers after the user finishes panning or zooming, if you require different behavior then use a different event listener: In your view (index.html.erb): <%= gmaps({ "map_options" => { "zoom" => 15, "auto_adjust" => false, "detect_location" => true, "center_on_user" => true }}, false, true) %> At the bottom of your view add: <script type=