gmaps4rails

Reuse a Google Maps street view inside of a modal

喜夏-厌秋 提交于 2019-12-08 17:06:52
问题 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 makes sense. See below pics for more info. Any help would be greatly appreciated. First image with error Here is an image of what my console log looks like: Here is my JavaScript code in my webapp. <script type="text/javascript"> var handler = Gmaps

gmaps4rails - drop marker to new position

久未见 提交于 2019-12-08 14:17:24
I have application where gps info are extracted from photo with gps data. When I want to update position by edit action, I would like to drag a marker, replace it and save new position. When I click to map, old marker is still there, so there are two markers. First is old and second is new one, dragable. I update form ids in javascript but new position is not saved. When I check length of array in javascript, then there is nothing there. But if I see source of page, there are few markers in array. Am I missing something? Thank you properites_controller.rb def edit @property = Property.find

Impossible to prevent auto panning to a marker when clicking on it (google maps)

北城以北 提交于 2019-12-08 10:26:25
问题 I use the google maps api v3, gmaps4rails and infobox and I cannot figure out how to remove the event which consist in auto panning the map on a marker as soon as it has been clicked... The markers are sent from my controller: Gmaps4rails.build_markers(experiences) do |experience, marker| marker.lat experience.latitude marker.lng experience.longitude marker.infowindow render_to_string(partial: "/trip_experiences/infowindow.html.erb", locals: { experience: experience, trip: trip }) marker

how to set a zoom level using Gmap4rails?

佐手、 提交于 2019-12-08 09:54:56
问题 I've just setup a new project following this video http://youtu.be/R0l-7en3dUw. I was wondering how can I set the map zoom level in a project like this. I've looked at the src on github and since in map.coffee there isn't something like zoomTo: (zoomLvl)-> @getServiceObject().setZoom(zoomLvl) I don't have any idea how to do it. So can anyone help me? I've tried this kind of solution as suggested here (zoom in to particular region in gmap4rails) but with any good result: Gmaps.map.callback =

How to add a radius to a marker in Google-Maps-for-Rails?

落爺英雄遲暮 提交于 2019-12-08 09:09:33
问题 i am using the Google-Maps-for-Rails gem and I am now trying to display circles. My Model "Place" consists of: longitude latitude radius etc I have no problem to display markers: # Controller: @markers = Place.all.to_gmaps4rails gmaps("markers" => {"data" => @markers}) Unfortunately it doens't include :radius => .. I also know that circles can be displayed like: gmaps( "circles" => { "data" => '[ {"longitude": -122.214897, "latitude": 37.772323, "radius":1000000} ]', }) Is there any way to

gmaps4rails on jQueryMobile don't work

不羁岁月 提交于 2019-12-08 09:09:10
问题 I tried gmaps4rails on jQueryMobile Framework. One page is only link to gmaps page. Two page is gmaps4rails page. jQueryMobile ajax page enabled. From one page to two page don't display gmaps. But Two page direct access is success display gmaps. This is my repository. https://github.com/y-hirasawa/sample-jqm-map I want to use ajax pages, and display gmaps. Help me. 回答1: You need to include the googlemaps javascript files in your layout: <script type="text/javascript" src="http://maps.google

gmaps4rails show hide functionality

浪尽此生 提交于 2019-12-08 09:01:57
问题 I'm hoping to get a little bit of insight on show / hide functionality in gmaps4rails. example functionality // == shows all markers of a particular category, and ensures the checkbox is checked == function show(category) { for (var i=0; i<gmarkers.length; i++) { if (gmarkers[i].mycategory == category) { gmarkers[i].setVisible(true); } } // == check the checkbox == document.getElementById(category+"box").checked = true; } // == hides all markers of a particular category, and ensures the

gmaps4rails - drop marker to new position

妖精的绣舞 提交于 2019-12-08 07:56:52
问题 I have application where gps info are extracted from photo with gps data. When I want to update position by edit action, I would like to drag a marker, replace it and save new position. When I click to map, old marker is still there, so there are two markers. First is old and second is new one, dragable. I update form ids in javascript but new position is not saved. When I check length of array in javascript, then there is nothing there. But if I see source of page, there are few markers in

gmaps4rails get latitude and longitude in the server

谁都会走 提交于 2019-12-08 06:35:45
问题 I'm reading about 'gmaps4rails' , but I have a question about the gem. Is possible obtain the location (lat, lng) only with the address? 回答1: Yes it is, but I would first use the Geocoder gem. gem 'geocoder' You need to create a migration to add latitude and longitude floats to your table rails g migration AddLatitudeAndLongitueToModel latitude:float longitude:float Obviously, replace Model with your table name. then run rake db:migrate Then in your model, make sure the attribute for an

Using the Google-Maps-for-Rails Gem how would I find points within a specified distance to a given point?

放肆的年华 提交于 2019-12-08 04:05:27
问题 I'm wondering if its possible to use the Google-Maps-for-Rails gem to find a list of points that are saved in the database that are within a specified radius of a given point. For example, how would I find all the points in my database that are within 20 miles of the Statue of Liberty. I couldn't find anything in the documentation that goes over this scenario, unless I missed it. Thank you for looking. 回答1: I don't think Google Maps for Rails does this out of the box. I ended up using Google