Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map offset #32

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ Change this to match your communities' name. It will be used in various places.
This affects the initial scale of the map. Greater values will show a larger
area. Values like 1.0 and 0.5 might be good choices.

## mapLatOffset and mapLngOffset (float)

Normally the center of your map is calculated by the geo coordinates of your nodes. If you want to center the map slightly different, you can use mapLatOffset and mapLngOffset. A value of 0 will center the map as normal. Value can be negativ.

## showContact (bool)

Setting this to `false` will hide contact information for nodes.
Expand Down
2 changes: 2 additions & 0 deletions config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"dataPath": "https://map.luebeck.freifunk.net/data/",
"siteName": "Freifunk Lübeck",
"mapSigmaScale": 0.5,
"mapLatOffset": 0.1,
"mapLngOffset": -0.1,
"showContact": true,
"maxAge": 14,
"mapLayers": [
Expand Down
4 changes: 2 additions & 2 deletions lib/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ define(["map/clientlayer", "map/labelslayer",
if (nodes.length === 0)
return undefined

var lats = nodes.map(function (d) { return d.latitude })
var lngs = nodes.map(function (d) { return d.longitude })
var lats = nodes.map(function (d) { return d.latitude + config.mapLatOffset })
var lngs = nodes.map(function (d) { return d.longitude + config.mapLngOffset })

var barycenter = L.latLng(d3.median(lats), d3.median(lngs))
var barycenterDev = [d3.deviation(lats), d3.deviation(lngs)]
Expand Down