Skip to content

Repository files navigation

What is this ?

This is the source repository for BitCraft Map 🗺️

Overview — Documentation

This file explains how the map is built, how data is loaded, and how you can, as a user, share waypoints with people.

  • Tech: Leaflet and the leaflet-control-search plugin.
  • Map Image: assets/maps/map.png rendered over a simple CRS map with custom bounds. This image is generated from BitCraft files.
  • Coordinate System: The map will accept "Small Hex" coordinates (see F4 debug menu ingame) Small hex coordinates range from 0 to 23040 and are the location X and location Z you get from the database. The map will also accept Small Floating Hex coordinates (case for players and animals).
  • Search Plugin: the search control plugin will look into ruined cities and claims layers, using the claim name as the searchable text.
  • Feature to share waypoints: Share waypoints and shapes by writing GeoJSON.

Feature — Custom Markers

You can add your own markers and shapes to the map by supplying a GeoJSON object. There are two ways of supplying the GeoJSON object.

What is GeoJSON ?

GeoJSON is an open standard format for representing geographical features as JSON.
It defines simple geometries like points, lines, and polygons, grouped inside a FeatureCollection. Each feature can carry custom properties (metadata) alongside its geometry, making it ideal for describing map markers, shapes, and related data in a portable way.

Useful links to validate your GeoJSON :

Methods for sharing waypoints

  1. URL Hash – Append the GeoJSON after # in the URL. Spaces and Line Carries should not break this functionality, please open an issue if you find a case where it does.
  2. GitHub Gist – Upload the GeoJSON into a GitHub Gist as public, then use the ID as ?gistId=... parameter

Working GeoJSON Example

You can try this GeoJSON here: https://bitcraftmap.com/?gistId=8ecf9520d96e13908c060c871430ed37

{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"popupText": "My custom waypoint",
"iconName": "HexCoin3",
"iconSize": [128,128],
"turnLayerOff": ["ruinedLayer","treesLayer","templesLayer"]
},
"geometry": {
"type": "Point",
"coordinates": [15000, 15000]
}
},
{
"type": "Feature",
"properties": {
"popupText": "My custom polygon",
"color": "#c24747ff"
},
"geometry": {
"type": "Polygon",
"coordinates": [[
[23040, 11520],
[19666, 19666],
[11520, 23040],
[3374, 19666],
[0, 11520],
[3374, 3374],
[11520, 0],
[19666, 3374],
[23040, 11520]
]]
}
},
{
"type": "Feature",
"properties": {
"makeCanvas": 1,
"radius": 50,
"fillColor": "#3dd53fff",
"weight": 5
},
"geometry": {
"type": "Point",
"coordinates": [15000, 15000]
}
}
]
}

What GeoJSON is accepted ?

Any GeoJSON following the RFC linked above and being validated by geojsonlint is accepted. If you find any incompatibility, please open an issue. Additionally, some custom properties are accepted to enhance user experience.

Available properties

PropertyTypeValuesDefaultEffect
popupTextstring or string[]Plain text, array of textsBinds a popup to the feature with the given content. Arrays become multi-line (<br>). HTML is escaped.
makeCanvasbooleantrue / falsefalseIf true, draws a CircleMarker on canvas instead of a waypoint. This makes it possible to display much more information.
turnLayerOnstring or string[]See Layer Name ReferenceAfter rendering, adds those layers to the map.
turnLayerOffstring or string[]See Layer Name ReferenceAfter rendering, removes those layers from the map.
iconNamestringSee Icon Name Referencevalidated to waypointIcon you can display as your waypoint. See Icon Name Reference for list of possible icons
iconSize[w, h]Array of 2 numbersvalidated to [32,32]Size of the icon you want to display in pixel weight and width
flyTo[lat, lng]Small Hex Coordinates (0 to 23040)If present withzoomTo, calls map.flyTo(flyTo, zoomTo).
zoomTonumberLeaflet zoom level (-6 to 6)Used with flyTo.
noPanbooleantrue / falsefalseIf feature has bounds and you didn’t use flyTo, the map fits bounds unless noPan is true.
radiusnumberRadius in pixels1 when makeCanvas: trueCircle radius. Only used with makeCanvas
colorstringHex Color#3388ffStroke color. Used with polygons, lines and makeCanvas
weightnumberStroke width in pixels3Stroke width. Used with polygons, lines and makeCanvas
opacitynumber0 to 11Stroke opacity. Used with polygons, lines and makeCanvas
fillColorstringHex Color#3388ffFill color. Used with polygons, lines and makeCanvas
fillOpacitynumber0 to 10.2Fill opacity. Used with polygons, lines and makeCanvas

Icon Name Reference (for iconName)

The full list of icons available for this properties is available in this file

Layer Name Reference (for turnLayerOn / turnLayerOff)

You can turn on an off these layers :

treesLayertemplesLayerruinedLayerbanksLayermarketsLayerwaystonesLayerwaypointsLayerclaimT0LayerclaimT1LayerclaimT2LayerclaimT3LayerclaimT4LayerclaimT5LayerclaimT6LayerclaimT7LayerclaimT8LayerclaimT9LayerclaimT10LayercaveT1LayercaveT2LayercaveT3LayercaveT4LayercaveT5LayercaveT6LayercaveT7LayercaveT8LayercaveT9LayercaveT10Layer

About

Bitcraftmap Code

Resources

Stars

3 stars

Watchers

0 watching

Forks

Contributors

Languages