Giter VIP home page Giter VIP logo

mgl-story's Introduction

mgl-story

Mapbox GL JS Story Map Template

This app reads the points from a GeoJSON and creates a story map. It works on mobile and desktop, and can have one or more images, with a field called image or images. The images can be a string or an object of images. It would be nice to have multiple images turn into a slideshow but right now they just append to story before the title. This app is based on the original Mapbox example for scrolling to a location.

Query Parameters

/*
url, token, style, center, zoom, theme, sort
*/

var url = (!params) ? "./story.json" : (!params.get("story")) ? "./story.json" : params.get("story");
mapboxgl.accessToken = (!params.get("token")) ? 'my token will only work on this url' : params.get("token");
var style = (!params.get("style")) ? 'mapbox://styles/mapbox/light-v10' : style;
var center = (!params.get("center")) ? [-82.10116, 39.32739] : [Number(params.get("center").split(",")[0]),Number(params.get("center").split(",")[1])];
var zoom = (!params.get("zoom")) ? 13.6 : params.get("zoom")
var theme = (!params.get("theme")) ? "left" : params.get("theme")
var sort = (!params.get("sort")) ? null : params.get("sort") // sort the geojson by a feature property before creating the story

GeoJSON FeatureCollection Schema

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "title": "This is the title", 
        "story": "This is a story body." //can use story or description for the field name
        "images": ["image1-link.jpg", "image2-link.jpg"] //image or images
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -82.10116267204285,
          39.32739287379205
        ]
      }
    }
}

Other Cool Story Maps

Current Mapbox style reference

mapbox://styles/mapbox/light-v10

mapbox://styles/mapbox/dark-v10

mapbox://styles/mapbox/street-v11

mapbox://styles/mapbox/satellite-streets-v11

mapbox://styles/mapbox/outdoors-v11

mapbox://styles/mapbox/satellite-v9

I published this story map template a few weeks before the 'official' Mapbox Solutions template. That template is more fully-featured but is also more complicated.

mgl-story's People

Contributors

reyemtm avatar

Stargazers

Park Ranger avatar Jinghao Hu avatar  avatar  avatar Daniel Huang avatar  avatar

Watchers

James Cloos avatar  avatar Park Ranger avatar

mgl-story's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.