A Google Maps-like UI for Kerbal Space Program (KSP) celestial bodies.
- Clone the repository.
- Edit
config/dev.exs
to set up the database connection appropriately. - Run
mix deps.get
. - Run
make develop
.
Note that image tiles are not included in this repository:
- They add up to more than 11 GB of data (at present, and that's just for Kerbin).
- They should be pushed out to a CDN for efficiency.
- They can be generated as needed (see below).
query params
body
loc
center
zoom
overlays
- Download and install the Heroku CLI.
- Install and set up Docker.
- Create an app on Heroku. The following steps assume that it is named
kerbal-maps
. - Add Heroku Postgres. The "Hobby - Dev" level should be sufficient for now.
- Define config vars:
DATABASE_URL
- something likepostgres://username:password@host:port/database
ERLANG_COOKIE
- can be anything, as far as I knowSECRET_KEY_BASE
- get by runningmix phx.gen.secret
TILE_CDN_URL
- base URL to where the map tiles are stored, up to but not including the body name, with no trailing slash
heroku login
heroku git:remote -a kerbal-maps
heroku container:login
heroku container:push web
heroku container:release web
The map tiles are extracted using the Sigma-Cartographer mod for KSP.
When Sigma-Cartographer loads (when KSP is started), it looks for a file
somewhere in the GameData
directory tree with the extension .cfg
and
containing the tag @SigmaCartographer
. It uses the configuration in this file
to determine what tiles to render and how to render them.
The file should contain one or more sections that look like this.
Maps
{
body = Kerbin
biomeMap = false
colorMap = false
slopeMap = false
satelliteBiome = true
satelliteMap = true
satelliteSlope = true
oceanFloor = true
width = 512
tile = 256
exportFolder = 0
leaflet = false
}
body
is the name of one of the bodies of the Kerbin system, in proper case.
Note:
Jool
is not allowed, as it has no surface, and therefore no map.
tile
should always be 256
.
exportFolder
is the zoom level. Its value should be between 0
and 7
inclusive.
Higher zoom levels are not disallowed, but at level 7 there's already visible rendering artifacts.
width
is correlated to the zoom level. Its value should be 512 * 2^(zoom level)
.
The Ruby script in script/gentiles.rb
can generate the configuration file for you.
The rendered tiles are written to GameData/Sigma/Cartographer/PluginData/(body)/(exportFolder)
.
They require some rearranging and renaming before they can be uploaded to the CDN.
The Ruby script in script/mvtiles.rb
will do that.
Note that on my computer (2.9 GHz Intel Core i7 with 16 GB of memory) rendering a full set of tiles (all three styles, zoom levels 0-7) for a single body takes in excess of twelve hours. Plan accordingly.
- Install dependencies with
mix deps.get
- Install Node.js dependencies with
cd assets && npm install
- Start Phoenix endpoint with
mix phx.server
Now you can visit localhost:4000
from your browser.
Unit tests were written with ESpec.
Execute the specs by running mix espec
.
See the open issues on Github.
Made possible in part by:
- Kerbal Space Program
- Sigma-Cartographer
- Waypoint Manager
- Leaflet.js and plugins:
- Bootstrap
- Font Awesome
- RealFaviconGenerator
- Distillery
- Andy Ogzewalla
Copyright (c) 2018-2019 Craig S. Cottingham, except where stated otherwise.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.