{"id":13463386,"url":"https://github.com/apneadiving/Google-Maps-for-Rails","last_synced_at":"2025-03-25T06:31:54.063Z","repository":{"id":56874674,"uuid":"1367656","full_name":"apneadiving/Google-Maps-for-Rails","owner":"apneadiving","description":"Enables easy Google map + overlays creation in Ruby apps","archived":false,"fork":false,"pushed_at":"2018-02-02T02:57:30.000Z","size":1908,"stargazers_count":2262,"open_issues_count":39,"forks_count":382,"subscribers_count":92,"default_branch":"master","last_synced_at":"2025-03-20T06:07:18.991Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://apneadiving.github.io/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apneadiving.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-02-15T01:05:14.000Z","updated_at":"2025-03-04T13:23:04.000Z","dependencies_parsed_at":"2022-08-20T22:30:31.473Z","dependency_job_id":null,"html_url":"https://github.com/apneadiving/Google-Maps-for-Rails","commit_stats":null,"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apneadiving%2FGoogle-Maps-for-Rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apneadiving%2FGoogle-Maps-for-Rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apneadiving%2FGoogle-Maps-for-Rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apneadiving%2FGoogle-Maps-for-Rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apneadiving","download_url":"https://codeload.github.com/apneadiving/Google-Maps-for-Rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245414299,"owners_count":20611357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T13:00:52.521Z","updated_at":"2025-03-25T06:31:53.775Z","avatar_url":"https://github.com/apneadiving.png","language":"JavaScript","readme":"== Google Maps for Rails  {\u003cimg src=\"http://www.pledgie.com/campaigns/23367.png\" alt=\"Endorse\" /\u003e}[https://pledgie.com/campaigns/23367] {\u003cimg src=\"https://www.codementor.io/d/images/badge-dark.png\" alt=\"codementor-button\"\u003e}[https://www.codementor.io/apneadiving?utm_campaign=profile\u0026utm_source=button-apneadiving\u0026utm_medium=dark]\n\n\n{\u003cimg src=\"https://secure.travis-ci.org/apneadiving/Google-Maps-for-Rails.svg?branch=master\" alt=\"Build Status\" /\u003e}[http://travis-ci.org/apneadiving/Google-Maps-for-Rails]\n{\u003cimg src=\"https://codeclimate.com/github/apneadiving/Google-Maps-for-Rails.svg\" /\u003e}[https://codeclimate.com/github/apneadiving/Google-Maps-for-Rails]\n{\u003cimg src=\"https://badge.fury.io/rb/gmaps4rails.svg\" alt=\"Gem Version\" /\u003e}[http://badge.fury.io/rb/gmaps4rails]\n{\u003cimg src=\"http://api.coderwall.com/apneadiving/endorsecount.png\" alt=\"Endorse\" /\u003e}[http://coderwall.com/apneadiving]\n\nGmaps4rails is developed to simply create a Google Map with overlays (markers, infowindows...).\nYet it's backed on a very flexible codebase which could be prone to accept other map providers.\n\nUse it with any Ruby app (I guess you could simply take the js anywhere if you like).\n\nHere is a {quick tutorial on youtube}[http://www.youtube.com/watch?v=R0l-7en3dUw\u0026feature=youtu.be], \nand my {presentation on speaker deck}[https://speakerdeck.com/apneadiving/gmaps4rails].\n\nFor live examples, {see here}[http://apneadiving.github.io/].\n\n\n== A note for \u003c 2.x users\n\nGoogle-Maps-for-Rails-2.0 is an important rewrite to keep the minimum code and features. If\nyou're migrating from previous versions, you may want to read the {rationale about it}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Why-but-why%3F].\n\n== Requirements\n\n1) Gemfile\n\n    gem 'gmaps4rails'\n\n2) HTML\n\nAdd a div to bear your map, example:\n\n    \u003cdiv style='width: 800px;'\u003e\n      \u003cdiv id=\"map\" style='width: 800px; height: 400px;'\u003e\u003c/div\u003e\n    \u003c/div\u003e\n\n3) Javascript Dependencies:\n\nInsert google scripts in your dom:\n\n    \u003cscript src=\"//maps.google.com/maps/api/js?key=[your API key]\"\u003e\u003c/script\u003e\n    \u003cscript src=\"//cdn.rawgit.com/mahnunchik/markerclustererplus/master/dist/markerclusterer.min.js\"\u003e\u003c/script\u003e\n    \u003cscript src='//cdn.rawgit.com/printercu/google-maps-utility-library-v3-read-only/master/infobox/src/infobox_packed.js' type='text/javascript'\u003e\u003c/script\u003e \u003c!-- only if you need custom infoboxes --\u003e\n\nYou'll require underscore.js too, see here: {http://underscorejs.org/}[http://underscorejs.org/] (`lo-dash` is compatible too, your choice!).\n\n4) Javascript source code\n\nIf you have the asset pipeline, add this:\n\n    //= require underscore\n    //= require gmaps/google\n\nIf you don't have asset pipeline, you'll need to import the js OR coffee files:\n\n    rails g gmaps4rails:copy_js\n\n    rails g gmaps4rails:copy_coffee\n\n5) Javascript code:\n\nCreate your map:\n\n    handler = Gmaps.build('Google');\n    handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){\n      markers = handler.addMarkers([\n        {\n          \"lat\": 0,\n          \"lng\": 0,\n          \"picture\": {\n            \"url\": \"http://people.mozilla.com/~faaborg/files/shiretoko/firefoxIcon/firefox-32.png\",\n            \"width\":  32,\n            \"height\": 32\n          },\n          \"infowindow\": \"hello!\"\n        }\n      ]);\n      handler.bounds.extendWith(markers);\n      handler.fitMapToBounds();\n    });\n\n6) Add options:\n\nYou're likely going to want to customize your maps by passing an options object. Using the example above,\nlet's say you'd like to disable the map controls. This and any other options you can find in the {Google\nMaps API reference}[https://developers.google.com/maps/documentation/javascript/reference]\ncan be passed into the `provider` options hash like so:\n\n    handler = Gmaps.build('Google');\n    handler.buildMap({\n        provider: {\n          disableDefaultUI: true\n          // pass in other Google Maps API options here\n        },\n        internal: {\n          id: 'map'\n        }\n      },\n      function(){\n        markers = handler.addMarkers([\n          {\n            \"lat\": 0,\n            \"lng\": 0,\n            \"picture\": {\n              \"url\": \"http://people.mozilla.com/~faaborg/files/shiretoko/firefoxIcon/firefox-32.png\",\n              \"width\":  32,\n              \"height\": 32\n            },\n            \"infowindow\": \"hello!\"\n          }\n        ]);\n        handler.bounds.extendWith(markers);\n        handler.fitMapToBounds();\n      }\n    );\n\nYou can see other examples of adding `provider` options in the {live examples}[http://apneadiving.github.io/]. Also,\ncheck the {wiki}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Js-Methods] for further documentation on\nthe possible JavaScript methods.\n\n== Generating JSON\n\nIn your controller:\n\n    @users = User.all\n    @hash = Gmaps4rails.build_markers(@users) do |user, marker|\n      marker.lat user.latitude\n      marker.lng user.longitude\n    end\n\nIn your view:\n    \n    \u003cscript\u003e\n        markers = handler.addMarkers(\u003c%=raw @hash.to_json %\u003e);\n    \u003c/script\u003e\n\n== Easily customizable\n\nYou can change almost everything with a few lines of code. {See details here}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki/Change-handler-behavior].\n\n== Options\n\n* Markers with Info window, Custom Picture, RichMarkers (make your own markers with custom html)\n\n* Circles, Polylines, Polygons, Kml\n\n* Refresh your map on the fly with Javascript (and Ajax)\n\n* {More details in the Wiki}[https://github.com/apneadiving/Google-Maps-for-Rails/wiki]\n\n== Todo?\n\nFeel free to contact us, you have your say.\n\n\n== Copyright\nMIT license.\n\nAuthor: Benjamin Roth\n\n{Contributors}[https://github.com/apneadiving/Google-Maps-for-Rails/graphs/contributors]\n","funding_links":[],"categories":["Time \u0026 Space","JavaScript","Geolocation"],"sub_categories":["Geocoding \u0026 Maps"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapneadiving%2FGoogle-Maps-for-Rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapneadiving%2FGoogle-Maps-for-Rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapneadiving%2FGoogle-Maps-for-Rails/lists"}