All Projects → WSJ → Pinpoint

WSJ / Pinpoint

Licence: mit
JavaScript library for creating beautifully simple maps in seconds

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Pinpoint

Ui Leaflet
AngularJS directive to embed an interact with maps managed by Leaflet library
Stars: ✭ 315 (+279.52%)
Mutual labels:  maps, leaflet
Django Leaflet
Use Leaflet in your Django projects
Stars: ✭ 563 (+578.31%)
Mutual labels:  maps, leaflet
Leaflet.timedimension
Add time dimension capabilities on a Leaflet map.
Stars: ✭ 329 (+296.39%)
Mutual labels:  maps, leaflet
mapus
A map tool with real-time collaboration 🗺️
Stars: ✭ 2,687 (+3137.35%)
Mutual labels:  maps, leaflet
Mapboard
A framework for data-rich web mapping 🌎📊✨
Stars: ✭ 29 (-65.06%)
Mutual labels:  maps, leaflet
o.map
Open Street Map app - KaiOS
Stars: ✭ 51 (-38.55%)
Mutual labels:  maps, leaflet
Prunecluster
Fast and realtime marker clustering for Leaflet
Stars: ✭ 473 (+469.88%)
Mutual labels:  maps, leaflet
leaflet.minichart
Leaflet.minichart is a leaflet plugin for adding to a leaflet map small animated charts
Stars: ✭ 27 (-67.47%)
Mutual labels:  maps, leaflet
Leaflet
🍃 JavaScript library for mobile-friendly interactive maps
Stars: ✭ 32,591 (+39166.27%)
Mutual labels:  maps, leaflet
Agentmaps
Make social simulations on interactive maps with Javascript! Agent-based modeling for the web.
Stars: ✭ 822 (+890.36%)
Mutual labels:  maps, leaflet
crisis-news-mapper
日本の災害関連ニュースをTwitterから収集して地図上にマッピングするFirebaseプロジェクト crisis.yuiseki.net
Stars: ✭ 13 (-84.34%)
Mutual labels:  maps, leaflet
Leaflet Swoopy
⤵️ Swoopy Arrow Plugin for Leaflet
Stars: ✭ 52 (-37.35%)
Mutual labels:  maps, leaflet
vaguely-rude-places
The map of Vaguely Rude Place Names
Stars: ✭ 19 (-77.11%)
Mutual labels:  maps, leaflet
roataway-web
Roataway web site
Stars: ✭ 15 (-81.93%)
Mutual labels:  maps, leaflet
leaflet-draw-toolbar
Leaflet.toolbar for Leaflet.draw. Example: https://justinmanley.github.io/leaflet-draw-toolbar/examples/popup.html.
Stars: ✭ 55 (-33.73%)
Mutual labels:  maps, leaflet
Offlinemap
基于MySQL + Node.js + Leaflet的离线地图展示,支持百度、谷歌、高德、腾讯地图
Stars: ✭ 343 (+313.25%)
Mutual labels:  maps, leaflet
geofind
Multiplayer Geographical Guessing Game using PostGIS, Nuxt, Leaflet & Colyseus.
Stars: ✭ 31 (-62.65%)
Mutual labels:  maps, leaflet
harp-leaflet
Leaflet plugin for harp.gl
Stars: ✭ 16 (-80.72%)
Mutual labels:  maps, leaflet
Leaflet Dvf
Leaflet Data Visualization Framework
Stars: ✭ 678 (+716.87%)
Mutual labels:  maps, leaflet
Ngx.leaflet.component
angular 2+ / leaflet 1.x component collection
Stars: ✭ 46 (-44.58%)
Mutual labels:  maps, leaflet

Pinpoint

A JavaScript library for creating beautifully simple maps in seconds, developed at The Wall Street Journal.

Features

  • Map settings are stored in a simple JSON format and can be generated using Pinpoint Editor.
  • Fully responsive with touch-friendly "click-to-activate" behaviour.
  • Powered by the awesome Leaflet.js.

Quickstart

Include:

In terms of HTML, just a single div is needed:

<div class="map-container"></div>

Then in your JavaScript file:

var options = {
    "element": ".map-container",
    "aspect-ratio": "wide",
    "dek": "",
    "hed": "The U.K.",
    "lat": 51.5049378,
    "lon": -0.0870377,
    "minimap": false,
    "zoom": 4,
    "markers": [
        {
            "lat": 51.5049378,
            "lon": -0.0870377,
            "text": "London"
        }
    ]
};
var map = new Pinpoint( options );

Options

Pinpoint accepts a JavaScript object for configuration.

option type default description
element string "#map-el" CSS selector for map parent element.
aspect-ratio string (required) The shape of the map: "wide" (3x2), "square" (1x1), or "tall" (5x6)
lat number (required) Latitude for map centre.
lon number (required) Longitude for map centre.
markers array (required) Array of markers/icons on map (see below for details).
zoom number (required) Initial zoom level of map.
hed string (blank) Headline for map (optional).
dek string (blank) Dek for map (optional).
note string (blank) Note to go below map (optional).
minimap boolean false Set to true to enables zoomed-out smaller map in corner.
minimap-zoom-offset number -5 Zoom level of minimap relative to main map zoom. Should always be below 0.
basemap string "http://{s}.tile.osm.org/{z}/{x}/{y}.png" Leaflet tile layer URL template (optional)
basemapCredit string "Leaflet | © OpenStreetMap contributors" Credit for tilelayer. Goes at bottom, below note. (optional)
creation boolean false Set to `true tot enables "creation mode" for use in admin tool.
dragend function undefined Anonymous function called on Leaflet dragend event (ie. when dragging/panning map).
zoomend function undefined Anonymous function called on Leaflet zoomend event (ie. when zooming).
markerdragend function undefined Anonymous function called on Leaflet marker dragend event (ie. when dragging a marker around the map). Only works when creation is true.

Marker options

Markers are stored as an array of objects.

option type default description
lat number (required) Latitude of point.
lon number (required) Longitude of point.
text string (blank) Text for marker callout.
icon string "square" Marker icon style: "circle", "square" or "none".
label string "callout" Marker label style: "callout" or "plain".
label-direction string "north" Marker label direction. Available directions varies between label styles.

Example configuration JSON

{
    "aspect-ratio": "wide",
    "dek": "",
    "hed": "The U.K.",
    "lat": 51.5049378,
    "lon": -0.0870377,
    "minimap": false,
    "minimap-zoom-offset": -5,
    "zoom": 4,
    "markers": [
        {
            "icon": "circle",
            "label": "plain",
            "label-direction": "north",
            "lat": 51.5049378,
            "lon": -0.0870377,
            "text": "London"
        },
        {
            "icon": "circle",
            "label": "plain",
            "label-direction": "north",
            "lat": 53.4779669,
            "lon": -2.0613722,
            "text": "Manchester"
        }
    ]
}

Public methods

  • .remove(): Reset map container to empty element.

Compiling dist folder

You must have npm and grunt installed.

  • npm install
  • grunt (this will also run tests)

Note that the images in src/img are not auto-compiled - if they're changed, the SVG code will need to be copied into pinpoint.js.

Customising styles

The look of the map and its markers is mostly controlled with CSS/SASS. These files can be found in src/scss:

  • main: Head and deck, scale line style
  • overlay: "Zoom/pan" icon
  • markers: Square, circle and plain/invisible marker styles
  • marker-label-callout: Callout label with north and south styles
  • marker-label-plain: Plain label with N, NE, E, SE, S, SW, W and NW styles
  • geojson: Styles for geojson objects

To change the map's basemap/tilelayer, use the basemap configuration variable. See above for more details.

Running tests

Tests are carried out with QUnit. To run tests, either open the HTML files in the test/ folder individually, or install NPM and Grunt (see above for details) and run grunt test.

Changelog

v1.1.1 (July 17, 2015)

  • Fixed marker position bug

v1.1.0 (July 17, 2015)

  • Removed jQuery dependency

v1.0.1 (July 9, 2015)

  • Fix bug when no head or deck
  • Throw useful error if Leaflet is missing
  • Add basic tests

v1.0.0

  • Initial release
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].