So long, long ago, I was using the Rails plugin Cartographer on one of my legion unfinished projects (not the rails version at this point). Since then, google maps api has gone to the 2.0 version, dinosaurs became extinct, and alien beings from beyond the stars have enslaved the human race.
Now, I fired up the ol’ Rails today to get back into the swing of things, and of course the thing craps right out. Ok, so I’m gonna roll up the sleeves, dig into the code, and update this thing. Let’s see how it goes.
Here we go. I’ve lost my API key for development, of course. So, off to the Google Maps API page to sign up for a new one. Google Maps APIs are apparently pretty strict about the URL they apply to, so this is a necessary step. Now it’s time to plug the new key in to the plugin and follow their upgrade instructions to make my code API 2.0 complaint. Then I cross my fingers…and probably start working my way through Action Controller: Exception Caught screens.
Yep. There was some trouble. Looks like the README is still a bit behind the times. Some details:
From the Cartographer README:
<html>
<head>
<%= Cartographer::GMap::Header.header_for(request) %>
[...]
</head>
<body>
should read Cartographer::Gmap, with a lowercase m. Similarly, where the readme has:
@map = Cartographer::Map.new( :name => 'mymap',
Which should read Cartographer::Gmap again. Then,
@marker = Marker.new(:position => [latitude, longitude],
should be @marker = Cartographer::Marker.new. No biggie, took a whole 15 minutes to work my way this far. Now the page loads at least, but still no map. :( Firebug (bless you, little Bug!) tells me, missing ; before statement. I really don’t know what to do about that. It could be a problem with the model I’m using to create marker points for all my childhood dwellings, or it could be that the Cartographer plugin writes bad JS, dunno. But I’m a gonna find out.
Looks like it’s another undocumented change. Previously, map options (not sure of the correct term here) like width, height, controls to show, zoom level, etc, were within the constructor. Now they’re passed with what look like methods. But I’m up and running!
Now I just have to figure out how to get a nice popup window, lightbox style, rather than the default Google speech baloons.
Like gas stations in rural Texas after 10 pm, comments are closed.