Closed danieldocki closed 12 years ago
This is really weird...
Could you show me the code in your model?
class Point < ActiveRecord::Base
acts_as_gmappable
validates :latitude, :longitude, presence: true
belongs_to :user
def gmaps4rails_address
#{latitude},#{longitude}
end
end
Why do you have longitude and latitude as an address? This is a bit absurd and could be error prone.
Don't process_geocoding if you already have coordinates.
Sent from my iPhone
On 20 avr. 2012, at 16:37, Daniel Dockireply@reply.github.com wrote:
class Point < ActiveRecord::Base acts_as_gmappable validates :latitude, :longitude, presence: true belongs_to :user def gmaps4rails_address #{latitude},#{longitude} end end
Reply to this email directly or view it on GitHub: https://github.com/apneadiving/Google-Maps-for-Rails/issues/190#issuecomment-5245350
ok, I removed the address, but he continues
class Point < ActiveRecord::Base
acts_as_gmappable
validates :latitude, :longitude, presence: true
belongs_to :user
end
generated
<script type="text/javascript" charset="utf-8">
Gmaps.map = new Gmaps4RailsGoogle();
Gmaps.load_map = function() {
Gmaps.map.initialize();
Gmaps.map.polygons = [{"lat":25.774252,"lng":-80.190262},{"lat":18.466465,"lng":-66.118292},{"lat":32.321384,"lng":- 64.75737}];
Gmaps.map.create_polygons();
Gmaps.map.adjustMapToBounds();
Gmaps.map.callback();
};
window.onload = function() { Gmaps.loadMaps(); };
</script>
And you're sure your Points have the coordinates you think they have? Dis you print rhem in console?
On 20 avr. 2012, at 20:03, Daniel Dockireply@reply.github.com wrote:
ok, I removed the address, but he continues
class Point < ActiveRecord::Base acts_as_gmappable validates :latitude, :longitude, presence: true belongs_to :user end
generated
<script type="text/javascript" charset="utf-8"> Gmaps.map = new Gmaps4RailsGoogle(); Gmaps.load_map = function() { Gmaps.map.initialize(); Gmaps.map.polygons = [{"lat":25.774252,"lng":-80.190262},{"lat":18.466465,"lng":-66.118292},{"lat":32.321384,"lng":- 64.75737}]; Gmaps.map.create_polygons(); Gmaps.map.adjustMapToBounds(); Gmaps.map.callback(); }; window.onload = function() { Gmaps.loadMaps(); }; </script>
Reply to this email directly or view it on GitHub: https://github.com/apneadiving/Google-Maps-for-Rails/issues/190#issuecomment-5249770
No response == no issue.
Will soon close it.
expected output
[[ {"lng": -80.190262, "lat": 25.774252}, {"lng": -66.118292, "lat": 18.466465}, {"lng": -64.75737, "lat": -64.75737} ]]
but, output is
[{"lat":25.774252,"lng":-80.190262},{"lat":18.466465,"lng":-66.118292},{"lat":32.321384,"lng":-64.75737}]
is something wrong?
<%= gmaps({ "polygons" => { "data" => @polygons } }) %>