Giter Club home page Giter Club logo

google-maps-for-rails's People

Contributors

abrambailey avatar alvarezloaiciga avatar amandaporto avatar andresabed avatar antonovga avatar apneadiving avatar aroop avatar avioing avatar baisa avatar bradkollmyer avatar cameel avatar davidruru avatar dleve123 avatar excid3 avatar fgo avatar ihanli avatar jmcopeland avatar kristianmandrup avatar laalex avatar libo avatar logicalhan avatar mrillo avatar narkoz avatar nithinbekal avatar oelmekki avatar oli-g avatar pascalj avatar raid5 avatar turupawn avatar xsve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-maps-for-rails's Issues

js, stylesheet, and images are being served empty by apache

hi there,

thanks for the work on the gem! followed instructions (production env has config.serve_static_assets = true). but apache serves the js, stylesheet, and the marker file as empty.

using apache 2.2.17, rails 3.0.4, gmaps4rails 0.3

in fact, what config.serve_static_assets is set to makes no difference. i get no errors in the production log, or apache logs, and if i try to fetch the files directly (/images/marker.png, for instance), they come back empty

is the gem not being able to find the bundled files? permission issue?

thanks in advance

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

I figured you would ask me to post to stack overflow, so I went there first :)

Not getting any action there - any idea what causes this??

http://stackoverflow.com/questions/6739345/google-maps-for-rails-undefined-method-gmaps-for-object-in-rake-task

troy$ rake populate:scans --trace
** Invoke populate:scans (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute populate:scans
http://goo.gl/fb/977ze
Sat, 16 Jul 2011 19:43:59 GMT
47.676506
-122.121872
91df0f32209c5212bdfd09de5ff0d25dce816596
rake aborted!

undefined method `gmaps' for #Scan:0x000001051fb9a8

Auto Detect not working?

I've set up auto detect location in my view according to the wik, but it just continues to show a map of the world and never attempt to retrieve the user's location. Perhaps I am doing it wrong?

<%= gmaps4rails({ "map_options" => { "container_id" => "connections_map_container", "auto_adjust" => "true", "detect_location" => "true", "center_on_user" => "true" } })%>

Using with https

This is a fantastic tool which made adding maps to our application very easy. Thanks guys!

The only problem I'm hitting now is that if you use it on an https page, then you get security warnings about mixed content. The google maps api does support https, so I think it's just a question of changing the script references from http to https. Unfortunately I think it's hidden behind the "acts_as_gmappable" statement - I was hoping for a content_for block I could modify.

Is there an easy way to make it use the https version of the API?http://code.google.com/apis/maps/documentation/javascript/basics.html#HTTPS

Many thanks,

Alex

JS code to enable display of multiple markers with identical coordinates

guys - here is another suggestion. as you probably know, google api doesn't let you display multiple markers that have identical coordinates (i.e., several people living in the same apartment building, etc.). as far as i know, clustering doesn't solve this either.

here is one workaround - to just slightly adjust the coordinates of some markers (by10 or more meters) to display them all on the map. i don't have a pull request, but here is the link to my code: https://gist.github.com/873142 , and here is a link to a relevant discussion: http://stackoverflow.com/questions/2151250 .

i think this would be a good optional feature to have.

cheers

Auto zoom and centering

First of all thanks for creating Gmaps4rails!

After reading the wiki and trying to read the code (I'm not a dev, so I might missed it), I can't find a way to define the center (long and lat) and the zoom to "auto".

Is this possible with Gmaps4rails right now?

Thanks in advance,
Emiliano

Design limitations and missing features

You can close this if you like, just wanted to share my observations on some design limitations and missing features to an otherwise very nice library. I was hoping to use your library and when I tried it out I found the following issues:

  • Each marker creates a MarkerImage. There is no reuse of MarkerImages. I may have 6 image types shared between 30 markers but they are all duplicated. (See Cartographer's ability to declare Markers)
  • While Markers can be made draggable, I saw no way to attach an event to the drag-end to hook into and update the server. May have just missed it.
  • No shadow images possible for markers.
  • MarkerImage anchors don't seem to support pixel locations. I use these custom map icons (http://mapicons.nicolasmollet.com/) and need the ability to specify pixel specific locations.

There are a number of things I like about your library that are better than Cartographer. I didn't want to try and add any of those features as it would require significant API changes. What are your thoughts/plans for the library and these features?

Possible to turn off validation for testing

Hello,

Since model.gmaps4rails_options returns a new hash each time it's called one cannot modifying an including instance's options. This makes sense though, as most of the options shouldn't be modified, but how can one easily run their unit tests without using real addresses or installing a mock lib.

Factory.define :event do |e|
  # ...
  e.after_build do |ev|   
     ev.gmaps4rails_options[:validation] = false if ev.respond_to? :gmaps4rails_options
  end
end

Instead I've had to do the more invasive: acts_as_gmappable :validation => !Rails.env.test? Maybe there's a better way?

Callbacks (click on map)

Im trying to do a click on map that shows some info. Im using google API's

Gmaps4Rails.callback = function() {
google.maps.event.addListener(map, "click", function() {
alert("You clicked the map.");
});
};

but this is not working, It doesnt no anything

Support for Mongoid_geo

I open this issue in parallel with the one "Support for Mongoid".
I'm developing an application that uses this nice gem: https://github.com/kristianmandrup/mongoid-geo
This gem enables you to write something like this:

class Person
    field :location, :type => Array, :geo => true, :lat => :latitude, :lng => :longitude
    geo_index :location
end

This way, the object Person gains the instance methods .latitude and .longitude. Nice! (read the readme for further details https://github.com/kristianmandrup/mongoid-geo)

The problem is that, in method Gmaps4rails.create_json(object), this call object[object.gmaps4rails_options[:lat_column]] returns nil, because mongoid_geo simply adds the convenience method .latitude, but doesn't create a field latitude: so object[:latitude] is nil.

So, is it possible to change object[object.gmaps4rails_options[:lat_column]].blank? in something like object.send(object.gmaps4rails_options[:lat_column]).blank?

Is something useless for all of you, and so I simply fork this gem for myself? Or you can do this little patch and push it in this main repository?

Screencasts

Can you please do something about the screencasts that you have? I cannot see them at all on the Macbook Pro if I go to the full screen mode and they are quite difficult to see in the original size?

It would be nice if you just posted the source code for your screencasts?

Thanks.

Bharat

SSL

When using this plugin on sites that use SSL the maps are being pulled from non secure resources and it's throwing an error on load, specifically in IE.

Chrome doesn't throw an error, just has a warning in the URL bar, FF removes the color box indicating all content is still from a secure source.

Any clue on if there's a way to make the resources pull from https instead?

Initial values

when assigning values under map_options: { } this values are not working

same when using
<%= gmaps("map_options" => { "detect_location" => false, "center_on_user" => false, "zoom" => 18},"markers" => { "data" => @JSON }) %>

it just uses the default values, for example, zoom = 6

Adding more features into the map

Hi there:

I am very interested in this map plugin. Just wonder, that can it draw any lines or something else onto the map, or it's yet to be implemented? (cuz I didn't see it in the wiki) Thanks very much.

Rails 3.1 support

Doesn't seem like this works in Rails 3.1 (3.1.0.rc4). Even if I copy over the js and css files from source I get a javascript error deep inside of google's code. ("TypeError: Result of expression 'a' [null] is not an object.")

Any ETA on when a 3.1 candidate might be available?

Thanks

Can't get detect_location to init

Following that page on the wiki - I have this in my view:

<%= gmaps4rails(@json,{
        "map_options" => {"detect_location" => "true", "center_on_user" => "true"}
})%>

the @JSON is my data.. the map works, but it doesn't ask me for permission - or show my location. Any idea what is missing?

Mark based on lat and long

Hi there: I just noticed that possibly before 0.4 the mark is based on lat and long, and in version 0.5 there's a big change. Address is not allowed to be null and the lat and long are automatically adjusted based on the address, even if I want to change it manually. I wish to have a feature that marks somewhere directly on the map using lat and long, instead of address. or maybe it could be describes as, make address and coordination independent and mark either one separately? Thanks very much.

Infobox not working on iOS safari

added custom infobox to my app with your 0.8.7 gem. all is working well in chrome, ff, and safari, but not on ipad/iphone. the markers seem not to be clickable. any ideas.

this gem is awesome. thanks for your hardwork!

miguel

Custom Infobox doesn't close when new is opened

Hi it's me again :-P.

I have been playing a bit with the custom infobox you added lately and I realized that if more than one marker is loaded on the map when you click on all of them the box is not closed automatically when a new marker is selected.

Probably you still want to use your openInfoWindow function in your gmaps4rails.js, something like:

create_info_window:
...
var ib = new InfoBox(gmaps4rails_infobox(boxText));

google.maps.event.addListener(marker_container.google_object, "click",
this.openInfoWindow(ib, Gmaps4Rails.map, marker_container.google_object));
...

Instead of calling ib.open, which doesn't appear to handle the closure of the previous marker.

Also, I personally don't find the option "custom_infowindow_status" => "opened" useful, if you have only one marker it can make sense but if you have more the map can end up really confused.

Hope this helps.
Gianluca

map_options disableDefaultUI

Hi, I am trying to disable the UI from the map as follow, but it's not taken into account:

<%= gmaps({
"map_options" => { "disableDefaultUI" => true, "type" => "ROADMAP", "zoom" => 15, "auto_adjust" => true, "auto_zoom" => false, "container_id" => "side_map", } ,
"markers" => { "data" => @GMAP }
} ) %>

Am I doing it the wrong way ?

Thanks.

Markers do not display when upgrading from 0.9.x to 0.10.0

Displaying the default or any other markers seems to be broken when upgrading from 0.9.x to 0.10.0.
They do not display when called, even though the Firebug correctly shows them up as created.
Downgrading to 0.9.0 or 0.9.1 displays them again.

Incompatibility with Uservoice ?

Only when i use Uservoice (http://uservoice.com) script widget on my website here is the error I see :

Uncaught TypeError: Property 'l' of object [object DOMWindow] is not a function
imarkerclusterer_compiled.js :1
Gmaps4Rails.clusterizegmaps4rails.js :353
Gmaps4Rails.create_markers

incompatibility ?

undefined method `gmaps'

I've done everything like in how-to, and every time I try to register new user, i get the following error:

undefined method `gmaps' for #User:0xa3e0788

Google map shows visible tiles and can't be zoomed

I am trying to get gmaps running with my mongoid application. I was able to display the map, but it isn't rendered correctly. See this image http://imagebin.org/165962 .

This is my model:

class Upload
  include Mongoid::Document
  include Mongoid::Document::Taggable
  include Gmaps4rails::ActsAsGmappable
  belongs_to :user

  acts_as_gmappable

  field :name, :type => String
  field :description, :type => String
  mount_uploader :file, FileUploader

  field :latitude, :type => Float
  field :longitude, :type => Float
  field :gmaps, :type => Boolean

  validates_presence_of :name
  validates_presence_of :user


# snip
# ...

  # see https://github.com/apneadiving/Google-Maps-for-Rails
  def gmaps4rails_address
    "Berlin, Germany"
  end
end

The controller fills a variable @json:

    @json = Upload.all.to_gmaps4rails

And I use it like this in the view:

<%= gmaps4rails(@json) %>

I don't know how to find the cause of this rendering problem. Can I supply more information?

How to use multipul map on single page?

Hi,

I want to use multipul map on single page.
Here is.

# example.html.erb
<%= gmaps4rails(@json1) %>
<%= gmaps4rails(@json2) %>

Map can't display, all map white out ...
Please help if anyone knows the solution.

Thanks.

Google Places API

This gem looks great. Are you planning to add Google Places search, autocomplete, etc?

Google is not defined

Hi folks,

I'm trying to use the Gmaps4Rails.replace_markers method in an ajaxed method - yet I'm getting

gmaps4rails.js:486 - Uncaught ReferenceError: google is not defined

Any ideas?

Can't describe how to retrieve the address from my model

On gmaps4rails docs we have:

    def gmaps4rails_address
      self.address #describe how to retrieve the address from your model
    end

How do I set a custom composed address there? I've tried:

    def gmaps4rails_address
      self.address =  (address + ', ' + city + ', ' + state + ', ' + zip)
    end

And it didn't work, I have the city state zip and address field in my table.

Why doesn't it work?

0.8.7 not working on rails 3.0.7...

has the gem now become rails 3.1 only? if so, what is the latest working version for rails 3.0.7 pls? i'm using 0.6.5 alright but going to production soon so would like to use the latest i can. thanks

Cannot set Zoom with single marker present

If a single element is present in @JSON,the map shows fully-zoomed in, ignoring the zoom option. Works fine with 2 or more elements.

<%= gmaps({
"map_options" => { "type" => "SATELLITE", "center_longitude" => 180, "zoom" => 3, "auto_adjust" => true},
"markers"     => { "data" => @json } } )
%>

Update coordinates on changing model's address

Not sure if I am doing something wrong but everything works for me, except when I change the location with address on the model, it does get saved but the coordinates are not updated. I think I can fix this with an before_save function to call geocode but this seems like a bug to me. (or at least a nice new feature to add. :) )

Latitude and Longitude Already Present

Am I correct in thinking that there isn't a current way to handle a dataset where we already have latitude and longitude values in the table rows of the model, but we do not have an address to geocode? It would be nice if I could pass some options to acts_as_gmappable that would tell it where to find the lat and long data.

If that is the case, how interested would you be in adding a patch to support that functionality? I may work on one if it has a reasonable shot of being included.

installing the gem

Dear sir, following your instructions i have no results. Coud you describe better the installation process? ....undefined method `to_gmaps4rail'?

current_location and replace_markers

hi there,

i want to geocode my location and display with google maps

view:
= gmaps({ "map_options" => { "auto_adjust" => true } })
= form_tag geocode_geo_locations_path, :method => :get, :remote => true do
= text_field_tag 'address'
= submit_tag 'search'

in my controller i have:

def geocode
@location = Gmaps4rails.geocode(params[:address])
if @location
@location_hash = @location.map { |loc| {:longitude => loc[:lng], :latitude => loc[:lat], :address => loc[:matched_address]} }.first
end
end

and in the view geocode.js.erb
Gmaps4Rails.replace_markers(<%=raw @location_hash.to_json %>);

it work so far, that i get a marker on the map, however the map doesnt get auto_adjusted .
how can i accomplish that??

Mocks for testing

Feature request: it would be nice to have some mocks/stubs for the geocoding calls to the google api for testing. Or document the call methods so that we can mock/stub them easily.

Critical: marker_picture not working but showing a transparent 'image' instead

As stated in the title, this can be reproduced by putting an icon (png) in the image dir, then use either :marker_picture => "images/xxx.png" or "marker_picture => "images/xxx.png" in the erb statement, the actual map stops displaying the default icon but shows a blank at the place instead. marker_width and marker_length are working properly. Please take a look into this. Thanks very much.

Feature Request? - grab users location from browser

Is this feature there, or talked about already? I'm not the right guy to implement it.. but I would LOVE to see it :)

I might be able to chip in a donation via paypal for a few dollars if someone was on the edge or considering adding it/forking adding/etc

Troy
(love the maps..)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.