Giter Site home page Giter Site logo

nicar24-self-hosted-maps-codespace's Introduction

Self-hosted maps in a codespace

This repo contains a Dockerfile and dev container configuration that will build the tools necessary for self-hosted maps:

  • pmtiles CLI
  • tippecanoe
  • NodeJS
  • Python

The Makefile includes build steps for an example project mapping trees in Baltimore. You can see the finished project on Github.

Read more about self-hosted maps.

Setup

This project will work with or without Docker. The easiest setup uses Github's codespaces. Locally, it can use a development container to create a consistent environment.

Getting started via Github.com

  1. Navigate to https://github.com/eyeseast/self-hosted-maps-codespace (you might already be here)
  2. Click Use this template, then click Open in a codespace

See Codespaces Quickstart for more information.

Inside the codebase, you'll need to install Python and NodeJS dependencies to use Datasette or build the map. Running make install will get both.

Working locally, using VSCode and docker

Assuming you've cloned this repository, open it in VS Code, and you should be prompted to reopen it inside a dev container. This will build a docker image with all dependencies installed.

For more detailed instructions, see Developing inside a Container.

This will work on any system that can run Docker and should give you a consistent development environment regardless of your root operating system.

Working locally on MacOS

I work on a MacBook, and if you don't mind installing things with Homebrew, you can work without a dev container.

brew install pmtiles
brew install tippecanoe
brew install libspatialite

(It's possible I'm forgetting something here. I don't recreate my laptop environment from scratch that often. Please open an issue if needed.)

Building the final map requires NodeJS. I recommend either downloading the current LTS version or using a version manager like nodenv.

To explore the included tree data with datasette, you'll need a working Python environment. You can follow my recommended Python setup. This repo uses Poetry instead of Pipenv, so install that using pipx install poetry.

Once Python and NodeJS are configured, run make install to download dependencies for both environments.

Building the map

tl;dr

make install
make tiles
make fonts
npm run dev

We have two sets of tiles: the underlying street map, and the point data for trees. Running make tiles will get both. Street tiles are extracted from today's Protomaps build. We use tippecanoe to turn tree data into tiles.

Exploring tree data with Datasette

If you want to dig into Baltimore's tree inventory, you can build a SpatiaLite database and explore it with Datasette.

make trees # build the database
make ds # run datasette

Have fun.

nicar24-self-hosted-maps-codespace's People

Contributors

jnschrag avatar

Watchers

 avatar

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.