Git Product home page Git Product logo

factorio-leaflet-maps's Introduction

Factorio to Leaflet Maps

A Python script to convert Factorio screenshots into Leaflet map tiles.

Getting Factorio Screenshots

  1. In Factorio, open the console. The default hotkey for the console is `.
  2. Paste the following command and press Enter.
/c game.player.surface.daytime = 0; for x=-1000,1000 do for y=-1000,1000 do if game.forces["player"].is_chunk_charted(1, {x, y}) then game.take_screenshot{show_entity_info=true, zoom=1, resolution={1024,1024}, position={x=32*x+16,y=32*y+16}, path="factoriomaps/chunk_"..x.."_"..y..".jpg"}; end; end; end;

NOTE: Using console commands disables achievements in your current game. To retain achievements, reload your save after running the command.

  1. A set of screenshots is taken and saved to %APPDATA%\Factorio\script-output\factoriomaps

Getting Leaflet Tiles

Script Requirements

  1. Execute the script: python3 factoriomap.py [source] [destination]
  • Source: The path to the directory containing the screenshots, or the path to a tar file containing the screenshots.
  • Destination: The path to a directory to hold the Leaflet tiles.

NOTE: Depending on your system configuration, the command to run a Python 3 script (python3 above) may differ. Use the appropriate command for your system. NOTE: The tar file option is useful if the screenshots need to be uploaded to a remote server before running the script.

  1. The screenshots are converted to Leaflet tiles.

Creating a Leaflet Map

  1. Create an HTML page to launch Leaflet. A simple example page is included in the repository. Change PATH_TO_TILE_DIRECTORY to the actual path of the tile directory.

  2. For further customation, see the Leaflet documentation.

factorio-leaflet-maps's People

Contributors

finwe avatar natemeyer avatar rycieos avatar senorpez 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.