Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

mapkick

> 编程语言
Open source

Create beautiful JavaScript maps with one line of Ruby

302 stars0 likes2 views
WebsiteGitHub

About

Create beautiful JavaScript maps with one line of Ruby

Mapkick

Create beautiful JavaScript maps with one line of Ruby. No more fighting with mapping libraries!

See it in action

:fire: For static maps, check out Mapkick Static, and for charts, check out Chartkick

Installation

Add this line to your application’s Gemfile:

ruby
gem "mapkick-rb"

Mapkick uses Mapbox GL JS v1. To use tiles from Mapbox, create a Mapbox account to get an access token and set ENV["MAPBOX_ACCESS_TOKEN"] in your environment (or set Mapkick.options[:access_token] in an initializer).

Then follow the instructions for your JavaScript setup:

  • Importmap (Rails default)
  • Bun, esbuild, rollup.js, or Webpack
  • Sprockets

Importmap

In config/importmap.rb, add:

ruby
pin "mapkick/bundle", to: "mapkick.bundle.js"

And in app/javascript/application.js, add:

javascript
import "mapkick/bundle"

Bun, esbuild, rollup.js, or Webpack

Run:

bash
bun add mapkick
# or
yarn add mapkick

And in app/javascript/application.js, add:

javascript
import "mapkick/bundle"

Sprockets

In app/assets/javascripts/application.js, add:

javascript
//= require mapkick.bundle

Maps

Point map

erb

Area map

erb

Data

Data can be an array

erb

Or a URL that returns JSON (same format as above)

erb

Point Map

Use latitude or lat for latitude and longitude, lon, or lng for longitude

You can specify a label, tooltip, and color for each data point

ruby
{
  latitude: ...,
  longitude: ...,
  label: "Hot Chicken Takeover",
  tooltip: "5 stars",
  color: "#f84d4d"
}

Area Map

Use geometry with a GeoJSON Polygon or MultiPolygon

You can specify a label, tooltip, and color for each data point

ruby
{
  geometry: {type: "Polygon", coordinates: ...},
  label: "Hot Chicken Takeover",
  tooltip: "5 stars",
  color: "#0090ff"
}

Options

Id, width, and height

erb

Marker color

erb

Show tooltips on click instead of hover

erb

Allow HTML in tooltips (must sanitize manually)

erb

Map style

erb

Zoom and controls

erb

Refresh data from a remote source every n seconds

erb

Pass options directly to the mapping library

erb

See the documentation for Mapbox GL JS for more info

Global Options

To set options for all of your maps, create an initializer config/initializers/mapkick.rb with:

ruby
Mapkick.options[:height] = "400px"

Sinatra and Padrino

Download mapkick.bundle.js and include it manually.

xml

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

  • Report bugs
  • Fix bugs and submit pull requests
  • Write, clarify, or fix documentation
  • Suggest or add new features

To get started with development:

bash
git clone https://github.com/ankane/mapkick.git
cd mapkick
bundle install
bundle exec rake test

Issues· 4 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言