Code Monkey home page Code Monkey logo

stalburgmap's Introduction

Stalburg Map

This is the map of Stalburg repo.

Building the map

You'll need GDAL, ImageMagick and GNU Parallel - install those with your favourite package manager, for example yum install gdal gdal-python ImageMagick parallel. In some cases you may need to install Python bindings separately with pip3 install gdal.

After that just run build.sh. Expect to wait a couple of minutes or even more, tile generation isn't a fast process. If you see no errors, you should be good. Grab the dist folder and serve it with any webserver.

Run the same script with the dev parameter if you want to change map logic or work on locations, that way tiles will be placed in the src directory for you to be able to edit the js sources, and open index.html locally in your browser. Never edit anything in dist directory, it's for distribution purposes only!

Internals

Main source file is src/stalburg/stalburg.svg. It's a good idea to use Inkscape to open it, because unfortunately compatibility between various SVG editors is pretty low. However, in order to generate tiles for Leaflet (see above), we need to export everything to PNG first. Exported layers are also a part of the repo, they are located in layers dir.

The map consists of 4 main layers:

  • Base layer (roads, highways, streets and terrain);
  • Public transport (all train, metro and tram lines combined);
  • Developer commentary (small and somewhat useless, but still cool layer with handwritten notes from developers);
  • INFRA levels (all game levels as they are projected on a city map).

Each layer is a 26100 by 19129 pixels image with optional transparency. The resolution is important, because all locations are tied to it.

In order to export needed layer from Inkscape we can enable or disable object groups as needed.

In other words, the map editing workflow looks like that:
SVG source (src/stalburg/stalburg.svg) >>> 4 PNG layers (layers/) >>> 4 sets of tiles (generated with build.sh).

Other important files:

  • src/root/res/map-v2.js - Main code file with all basic routines;
  • src/root/res/mark.js - Mark's route;
  • src/root/res/objects.js - Various map objects (station names, locations, aliases).

Contributing

Feel free to open PRs with useful or not so useful changes.

stalburgmap's People

Contributors

deseven avatar thepiguy24 avatar

Watchers

James Cloos 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.