0

The gem by itself is working pretty well because when I register a new location I just put the address and it brings me the latitude and longitude. However, when I try to display this location in a map it does not show anything
Help please

Show.html.erb
<%= image_tag "http://maps.google.com/maps/api/staticmap?size=450x300&sensor=false&zoom=16&markers=#{@location.latitude}%2C#{@location.longitude}" %>

location.rb

class Location < ApplicationRecord
geocoded_by :address
after_validation :geocode
end 

  • You have to pay them (Google). I'd be easier to tell if you were handling errors that come from the external request instead of just passing in a hardcoded image_tag string – Mark Merritt Oct 31 '19 at 00:31
  • Is there a way to use this gem without use google api? –  Oct 31 '19 at 05:48

1 Answers1

1

It looks like you are making a request to Google Maps Platform's [Maps Static API] (https://developers.google.com/maps/documentation/maps-static/intro) without an API key. To use the service, a key parameter is required.

To create a successful request, Google Maps Platform APIs require authentication requirement (which is an API key) and a valid billing account linked to your own Google Maps Platform project.

Pagemag
  • 2,779
  • 1
  • 7
  • 17