Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4536800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:35:06+00:00 2026-05-21T14:35:06+00:00

i am using the Google-Maps-for-Rails gem and I am now trying to display circles.

  • 0

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 include the radius attribute in the markers hash ? Like:

gmaps("circles"     => { "data" => @markers })

Probably something like:

Place.all.each |place| place.merge!(:radius => 1000) ...

would do, but I think there may be a nicer solution

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:35:07+00:00Added an answer on May 21, 2026 at 2:35 pm

    The logic behind markers and circles is really different.

    In your controller

    @markers = Place.all.to_gmaps4rails
    @circles = Place.all.map{|p| {:longitude => p.longitude, :latitude => p.latitude, :radius => p.radius}}.to_json
    

    In your view:

    <%= gmaps({ "markers" => {"data" => @markers},
               "circles" => {"data" => @circles}
              }) %>
    

    Or if you don’t need infowindow or other features, you could simply do:

    In your controller

    @circles = Place.all.map{|p| {:longitude => p.longitude, :latitude => p.latitude, :radius => p.radius}}.to_json
    

    In your view:

    <%= gmaps({ "markers" => {"data" => @circles},
               "circles" => {"data" => @circles}
              }) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking at using the gem google maps for rails but cant see
I'm using Google-Maps-for-Rails in a Rails app. In the Model controller I have def
I am using Google Maps V3 API to display my map. Problem: How can
I'm using google maps autocomplete for user to input the place. after that I
I am using Google Maps in order to display current user location. While using
I just started working using Google Maps API yesterday, and trying to set up
I'm using Google Maps v3. I've already suppressed markers to display my own on
i am using google maps api v3, and the InfoBubbles plugin. I am trying
I am using Google Maps API to display a map on a certain page.
I'm trying to transfer Rails-generated json into Google Maps markers on a map, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.