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 8061577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:23:01+00:00 2026-06-05T10:23:01+00:00

I am having trouble with using OpenLayers in Gmaps4Rails (Gem version 1.5.2.) When I

  • 0

I am having trouble with using OpenLayers in Gmaps4Rails (Gem version 1.5.2.) When I click on a marker I would like to show the typical callout (Infobox). Unfortunately I get the following JavaScript error:

this.serviceObject is undefined

Firebug calls the line 195 of the file “gmaps4rails.openlayers.js” responsable:

return this.serviceObject.addPopup(popup);

If I use Google Maps as API provider instead, everything works fine. Showing and hiding the infobox works nicely. This is why I assume that the error must be somewhere in “gmaps4rails.openlayers.js”

I tried on the latest FF and Chrome on Mac.

For reproducing the error in a reduced example, I created a simple HTML page in the public folder of my Rails 3.2 app and directly linked the needed JS and CSS files. To create the HTML page I copied the HTML code of my broken Rails app and reduced it.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <link href="/assets/gmaps4rails.css" media="screen" rel="stylesheet" type="text/css" />
    <script src="/assets/gmaps4rails/gmaps4rails.base.js" type="text/javascript"></script>
    <script src="/assets/gmaps4rails/gmaps4rails.openlayers.js" type="text/javascript"></script>
  </head>
  <body>
    <div class="map_container"> 
      <div id="map" class="gmaps4rails_map"></div>
    </div>
    <script src="http://www.openlayers.org/api/OpenLayers.js" type="text/javascript"></script>
    <script type="text/javascript" charset="utf-8">
      Gmaps.map = new Gmaps4RailsOpenlayers();
      Gmaps.load_map = function() {
        Gmaps.map.map_options.provider = "openlayers";
        Gmaps.map.initialize();
        Gmaps.map.markers = [
          {"description":"<p>This shall be in in the popup</p>",
          "id":117979030,
          "lat":39.5715,
          "lng":2.64694}
        ];
        Gmaps.map.create_markers();
        Gmaps.map.adjustMapToBounds();
        Gmaps.map.callback();
      };
      Gmaps.oldOnload = window.onload;
      window.onload = function() { 
        Gmaps.triggerOldOnload();
        Gmaps.loadMaps();
      };
    </script>
  </body>
</html>

Unfortunately I could not find a working example of a successful Gmap4Rails–Openlayers integration on the web. Am I missing a mandatory parameter?

Thanks in advance.

  • 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-06-05T10:23:03+00:00Added an answer on June 5, 2026 at 10:23 am

    It’s a bug.

    Replace:

    return this.serviceObject.addPopup(popup);
    

    with:

    return this.map.addPopup(popup);
    

    I’ll push a fix soon, thanks and +1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble using multiple methods in JavaScript. What would be the best way
I'm having trouble using jQuery with child page parent.html loads child.html like so: ie
i'm having trouble using jwplayer events to work. i have jwplayer 5.7.1896 (Licensed version)
I'm having trouble using setInterval/clearInterval. I've tried to do something like this: int =
Having trouble using foreach to output the contents of a mysql table. The table
Anybody having trouble using AVFoundation with GC ON??? What I am experiencing is that
I am having trouble using nested ajax calls with selectors. I have a section
I'm having trouble using filesystemobject in a vba function I am writing. I keeping
I've been having trouble using cucumber and webrat to test authlogic-openid authentication in a
I'm having trouble using os.utime to correctly set the modification time on the mac

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.