Questions tagged [gmaps4rails]

gmaps4rails is a Ruby on Rails 3 gem, which provides a clear interface with GoogleMaps, OpenLayers, Bing and Mapquest

Enables easy display of items (taken from a Rails 3 model) with Google Map, OpenLayers, Bing or Mapquest.

Geocoding + Directions included.

Provides much options:

  • markers customization
  • infowindows
  • auto-adjusted zoom
  • polylines
  • polygons
  • circles
  • rich markers
  • multi maps etc...

See wiki for full description and examples.

700 questions
25
votes
6 answers

Ruby on rails gem for google map integration

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.
23
votes
3 answers

Gmaps4rails V2 - change default zoom

I'm a complete noob, building my first rails app. I successfully implemented Google-maps-for-rails V2, using apneadiving's tutorial on youtube: http://www.youtube.com/watch?v=R0l-7en3dUw&feature=youtu.be My issue is that for each of my maps, I'm…
dmt2989
  • 1,610
  • 3
  • 17
  • 30
17
votes
3 answers

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

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…
ryanjones
  • 5,383
  • 4
  • 28
  • 24
15
votes
2 answers

Google Maps: scroll map programmatically of x pixels

Is there a simple way to scroll a google map programmatically of x pixels? I can only think of using setCenter, but the problem is that I would have to compute the new location (lat/lng) depending on the zoom level... Can you think of something…
Robin
  • 21,667
  • 10
  • 62
  • 85
13
votes
3 answers

Custom Markers in Google Maps not Showing up in Firefox

I have a map that I have created in rails using the google maps for rails gem. It works in Chrome and Safari but it does not display custom .svg markers in Firefox 29. It does display the custom image for clusters (which is a png). I have bumped…
nilesvm
  • 329
  • 1
  • 3
  • 14
13
votes
2 answers

Incrementing letters using .next

def home letter = 'A' @markers = Location.all.to_gmaps4rails do |loc, marker| marker.infowindow render_to_string(partial: '/locations/info', locals: {object: loc}) marker.picture({picture:…
Dudo
  • 4,002
  • 8
  • 32
  • 57
12
votes
3 answers

Gmaps4rails : Setting map width and height

Reading the gmaps4rails gem documentation, I didn't find any way to set the map width and height. Is there any way to do this ?
manu_v
  • 1,248
  • 2
  • 12
  • 21
12
votes
1 answer

When adding circles to a gmaps4rails, I get an error that reads: TypeError: 'undefined' is not an object (evaluating 'circle.serviceObject.getBounds'

My objective is to add circles in place of markers to show the general area of the location of the each tool in the Tool model. I was able to add circles based on other answers on SO, however using the following code I get the error in the title…
thewheelz
  • 379
  • 2
  • 15
12
votes
6 answers

GMaps4Rails and Turbolinks not loading without full page refresh

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…
Shaun
  • 583
  • 5
  • 19
10
votes
2 answers

Reuse a Google Maps street view inside of a modal

I am developing a web app in Rails. When I open a marker, a modal pops up with a street view in a box. I can open one or two markers, but after that I get an error that WebGL has hit a snag. I have tried to look online for resources but nothing…
10
votes
3 answers

How to append JSON objects together in Ruby

I am trying to create a group of map markers with the results of to_gmaps4rails in an each block. On an array with valid geo coordinates the to_gmaps4rails method produces valid JSON. I'm using Mongoid and my geo coordinates are in a…
SteveO7
  • 2,430
  • 3
  • 32
  • 40
9
votes
1 answer

Google-maps-for-Rails - undefined method `gmaps' for (object) in rake task

When I run a rake task that involves a model with gmaps4rails enabled I get this error, and if I comment the model so it's not acts_as_gmappable it completes properly. enter code here troy$ rake populate:scans --trace ** Invoke populate:scans…
8
votes
3 answers

Google Maps, Ruby on Rails, Zoom level with one marker

I am adding google maps support with apneadiving / Google-Maps-for-Rails (thanks awesome gem) I am finding one slight glitch, however, which very likely is my fault. auto_zoom works great when there are multiple markers. However, when there is only…
8
votes
1 answer

prevent sql injection in rails

I am using the following query to find nearest locations google maps. Is it immune to the Sql injection. If not can anyone help me to get rid of it. AlphaCourses.find_by_sql("SELECT *,( 6371 * acos( cos( radians( #{@latitude} ) ) * cos( radians(…
P J S
  • 170
  • 2
  • 16
7
votes
1 answer

Rails 4 gmaps4rails - How to include a link to a "show" view in marker infowindow in gmaps4rails gem

I have gotten gmaps4rails working in my rails 4 app, with markers for my lcoation, and I would like to include a link in each location's marker to each location's individual show view. My spaces controller index action looks like this: def index …
1
2 3
46 47