Integrating a google map into rails - ruby-on-rails

Has anyone got any suggestions on where to start with building a google map into a rails app? I would like users to be able to add a marker by clicking the map, and have spent a few days looking for a suitable tutorial or plugin (beyond ym4r), to little avail...any help would be much appreciated as I am finding the Google Maps API rather difficult to get into! I've also come across the railskit for google maps - does anyone have any experience in using it?

Just fyi, I made https://rubygems.org/gems/gmaps4rails which is a useful wrapper with several options.

I probably wouldn't use YM4R. We tried it and found that it doesn't add much value because it just wraps the API. I would recommend working with Google Maps directly from JavaScript. Google Maps API documentation is pretty good, and there are quite a few examples on the web.
There is an example of a click handler on the map here, and adding a marker is just a matter of doing
map.addOverlay(new GMarker(latlng));

Related

How do I get to Google Code Playground?

I use to be able to get to Google Code Playground page.
As discussed in
A guide to Google Code PlayGround
Its a web-based tool that lets web developers try out all of the APIs that Google provides, tweak the code, and see the results, I found it very useful.
But now when I try, I get redirected to API Explorer!
Has anyone got any ideas why?
Thanks in advance.
I don't know why they changed it, but probably you will need to go to the specific API/product you're looking for and search there.
For example, I used to teach the Visualization APIs with the playground, but these seem to have been reclassified as a chart "product" with the interactive code editing now hosted through JSFiddle:
https://google-developers.appspot.com/chart/interactive/docs/gallery
Good luck (re)locating what you're looking for.

Which fusion tables maps do I need to migrate

I'm unsure if the maps I have created through the last years will work when the Google SQL API is shut down January 14th.
I have read about the migration process and I understand it should be straightforward. I don't think so.
Where can I in the code see if I have to change the code?
Some of my maps I have build with the help of the FusionTablesLayer Wizard.
Other maps I have build by using maps and templates I have found and changed. I have made it work, but I won't say I understand everything going on in the code.
I don't see an api key anywhere in the code of my maps. And that makes me unsure if I need to change anything.
Will this for instance work after January 14th:
http://www.kaasogmulvad.dk/unv/fusion/test.html
and what about this:
http://www.kaasogmulvad.dk/unv/3f/projekter1.html
Any help is much appreciated.
Neither of the examples you reference use the FusionTables SQL API. That is an external API for accessing data stored in FusionTables. Both of your examples just use the FusionTablesLayer from the Google Maps API v3.

Google Places API Violation

I am using Google Places API to pull a list of resturants, and I am displaying them on map. However, since Apple has switched there map services over from Google in iOS 6.0, I am now in violation of Google's terms of use, which states that you must display Google data on a Google map.
"If your application displays Places API data on a map, that map must be provided by Google."
https://developers.google.com/places/policies#terms_of_use
I obviously need to change the map, because I am not going to release an application that is in violation. Any thoughts or suggestions on what to do? Should I go Google Maps with a web view? Does apple have some sort of Google Places API alternative?
Edit:
Using Google Maps through a web view is a hassle, i'd like to find an alternative to that, although it would technically work.
I decided to use Google Maps JavaScript API. Although, it is a little more difficult to deal with, mainly the JavaScript through Objective-C, it is a solution. The map is displayed through a web view, and I use JavaScript to interact with the map.
https://developers.google.com/maps/documentation/javascript/tutorial#api_key
I will wait to accept this answer, to see if anyone else has any thoughts. I just wanted to post this, in case it helps someone else.
Edit:
Google recently released a Maps SDK for iOS, this is the better solution now.
https://developers.google.com/maps/documentation/ios/
I would try to directly contact Google, explaining the situation, and ask them for written permission to use Apple's maps. This is more a legal question than programming. One would think that Google is aware that you can no longer display their maps using Apple's API and that, even regardless of the map, they would want you to use their places, as doing so generates advertising revenue for them.
Agree with #Owen here - you could get permission to leave your app unchanged until some possible future date when you might have to change it, or could you definitely go to the effort of changing it now and then possibly have to change it again in the future for some other reason.
If you could get a 100% guarantee that you could change it once and never have to change it again then I'd say do it now, but nothing's certain.

iOS: Google Calendar Example

Searching around the net for almost 1 day I still did not see any simple good example of an app that implements the Google Calendar API. Or even simple explanation on how to implement the API is still not available. Can someone help me please? I'm a newbie to iOS. I need to learn how to create an event using the Google Calendar API through my app in iOS. I need a sample simple code...
Here are some very useful links when trying to figure out the google calendar api. http://code.google.com/p/gdata-objectivec-client/wiki/GDataObjCIntroduction and mainly http://code.google.com/p/iphone-gcal/. I just downloaded the source code from the second link and worked from there. It was great!
The Google Calendar API, like most Google API's, provides a straightforward REST interface. Instead of focussing first on how to create calendar events, learn how to interact with a RESTful web service. Once you know how to do that, you only have to learn what calls to make to accomplish your goal, and that's already well documented.

Google Maps with Rails 3 multiple markers

I am trying to build a complex google maps application with Rails as the framework. I have seen the YM4R gem and others that supposedly help with google maps development, but I honestly just want to go without them for now.
How can I get it so that rails passes a huge list of points to my google maps view, and the google maps javascript plots all of the points? I understand I probably need to use json somewhere (such as render :json => #points), but when I place that in my controller, I get an Illegal Action error from WEBbrick.
Any help would be greatly appreciated. Thanks!
You should have a look at my gem:
https://github.com/apneadiving/Google-Maps-for-Rails
And for an example of an customization see Google Maps, Ruby on Rails, Zoom level with one marker

Resources