Skip to content

Commit

Permalink
rewritten to JsxNik and separated to components (#258)
Browse files Browse the repository at this point in the history
* JsNik->JsxNik (WiP)

* fixed types and the rest

* formatting

* fixed style

* fixed style

* fixes

* fixes

* formatting

* refactored styles+layers to components

* separated features

* removed unused code

* fixed shading

* cleanup

* fixes

* cleanup

* fixed legend

* fixed (hacked) custom (drawing) layer
  • Loading branch information
zdila authored Sep 8, 2022
1 parent ce84040 commit 0da6dfc
Show file tree
Hide file tree
Showing 79 changed files with 5,527 additions and 5,794 deletions.
25 changes: 4 additions & 21 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,9 @@
"ecmaVersion": 2018
},
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single",
{ "avoidEscape": true }
],
"semi": [
"error",
"always"
],
"no-console": [
"off",
"always"
]
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"],
"no-console": ["off", "always"]
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ sandbox
shading
*land-polygons*
grid
dist
*.osm.pbf
3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"trailingComma": "all",
"singleQuote": true
"printWidth": 120
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## Features

* Mapnik configuration in Javascript adding all benefits of scripting (preventing repetition, programatic style generation, …)
* Map tile serving (TMS)
* PDF output
* Configurable map pre-rendering
* On-demand tile rendering (if tile is not rendered yet)
* Detection of dirty tiles (based on changes reported by imposm3) and rendering scheduling
* Easy style development and debugging (save and reload)
* Many features are configurable
- Mapnik configuration in Javascript adding all benefits of scripting (preventing repetition, programatic style generation, …)
- Map tile serving (TMS)
- PDF output
- Configurable map pre-rendering
- On-demand tile rendering (if tile is not rendered yet)
- Detection of dirty tiles (based on changes reported by imposm3) and rendering scheduling
- Easy style development and debugging (save and reload)
- Many features are configurable

## Demo

Expand Down
31 changes: 16 additions & 15 deletions config/default.json5
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
db: {
type: 'postgis',
host: 'localhost',
type: "postgis",
host: "localhost",
port: 5432,
user: 'gis',
dbname: 'gis',
password: 'secret',
user: "gis",
dbname: "gis",
password: "secret",
estimateExtent: false,
extent: '557173.4135719,4364860.6746929,3333877.3735052365809679,6659193.9171888176351786',
extent: "557173.4135719,4364860.6746929,3333877.3735052365809679,6659193.9171888176351786",
max_size: 24,
},
dirs: {
tiles: 'tiles',
expires: 'expires',
fonts: 'fonts',
tiles: "tiles",
expires: "expires",
fonts: "fonts",
},
server: {
port: 4000,
Expand All @@ -35,15 +35,16 @@
limits: {
minZoom: 0,
maxZoom: 19,
polygon: 'limit.geojson',
polygon: "limit.geojson",
scales: [1, 2, 3],
cleanup: true,
},
prerender: { // set to null to disable pre-rendering
// set to null to disable pre-rendering
prerender: {
// workers: 8, commented out = use num of cpus
minZoom: 8,
maxZoom: 14,
polygon: 'limit.geojson',
polygon: "limit.geojson",
zoomPrio: [12, 13, 14, 15, 11, 16, 10, 9, 8],
},
rerenderOlderThanMs: 0, // use 0 to disable
Expand All @@ -52,9 +53,9 @@
notFoundAsTransparent: true,
maxMapUseCount: false,
format: {
extension: 'jpeg',
mimeType: 'image/jpeg',
codec: 'jpeg92',
extension: "jpeg",
mimeType: "image/jpeg",
codec: "jpeg92",
},
minExpiredBatchSize: 500,
expiresZoom: 14, // imposm3 is configured to check for expired tiles on zoom 14
Expand Down
10 changes: 5 additions & 5 deletions config/docker.json5
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
db: {
type: 'postgis',
host: 'freemap-postgis',
type: "postgis",
host: "freemap-postgis",
port: 5432,
user: 'postgres',
dbname: 'postgres',
password: 'secret',
user: "postgres",
dbname: "postgres",
password: "secret",
},
forceTileRendering: true,
dumpXml: false,
Expand Down
14 changes: 7 additions & 7 deletions doc/DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Requirements

* Docker
- Docker

## Initial setup

Expand Down Expand Up @@ -47,9 +47,9 @@ docker run --rm --name=freemap-mapnik -v $(pwd):/freemap-mapnik --network=freema

Alternatives:

* open [preview.html](../preview.html) in your browser
* after changing and saving some style (eg. [app/style/index.js](../app/style/index.js)) just reload the page
* use any app where you can enter following TMS URL template: `http://localhost:4000/{z}/{x}/{y}`
* use JSOM
* use TMS map URL `tms[19]:http://localhost:4000/{zoom}/{x}/{y}`
* after changing and saving some style right-click the map and choose _FLush tile cache_.
- open [preview.html](../preview.html) in your browser
- after changing and saving some style (eg. [app/style/index.js](../app/style/index.js)) just reload the page
- use any app where you can enter following TMS URL template: `http://localhost:4000/{z}/{x}/{y}`
- use JSOM
- use TMS map URL `tms[19]:http://localhost:4000/{zoom}/{x}/{y}`
- after changing and saving some style right-click the map and choose _FLush tile cache_.
2 changes: 0 additions & 2 deletions doc/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,8 @@ gdalwarp -overwrite -of GTiff -ot Float32 -co NBITS=16 -co TILED=YES -co PREDICT
# -s_srs "+proj=krovak +ellps=bessel +nadgrids=slovak"
```


gdal_translate -of AAIGrid square.tif square.asc


Convert HGT to tiff

```
Expand Down
1 change: 1 addition & 0 deletions freemap-mapserver.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module "freemap-mapserver";
8 changes: 0 additions & 8 deletions index.js

This file was deleted.

8 changes: 8 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { startMapserver } from "freemap-mapserver";
import { mapnikConfig, generateFreemapStyle } from "./style";
import { initIcons } from "./style/routes";
import { legend } from "./legend";

initIcons().then(() => {
startMapserver(mapnikConfig, generateFreemapStyle, legend);
});
Loading

0 comments on commit 0da6dfc

Please sign in to comment.