rurseekatze / node-tileserver Goto Github PK
View Code? Open in Web Editor NEWA lightweight tileserver based on NodeJS for serving bitmap and vector tiles.
A lightweight tileserver based on NodeJS for serving bitmap and vector tiles.
way.test {}
AttributeError: ConditionClass instance has no attribute 'as_js'
way { set .test; }
AttributeError: ClassStatement instance has no attribute 'as_js'
Compare the MapCSS implementation of node-tileserver with other implementations and drafts and add missing features and ensure compatibility:
Currently it is necessary to restart node-tileserver to apply stylesheet changes. This behaviour is not very smooth as it e.g. aborts pending tile requests.
It would be nice if the stylesheets could be reloaded with a command without the need to restart node-tileserver.
Hello,
I'm getting mixed SRID geometries error in funcion: getDatabaseQuery: function(bbox) in tile.js
Do you have any idea why?
this is the generated query:
SELECT ST_AsGeoJSON(ST_TransScale(ST_ForceRHR(ST_Intersection(way, ST_SetSRID('BOX3D(3889115.9991497695 3769262.7387969648,3890338.9916023314 3770485.731249527)'::box3d, 900913))),
-3889115.9991497695, -3769262.7387969648, 8.176665341681026, 8.176665341677914), 0) AS way,
hstore2json(CAST(hstore(tags) AS hstore)) AS tags,
ST_AsGeoJSON(ST_TransScale(ST_ForceRHR(ST_PointOnSurface(way)), -3889115.9991497695, -3769262.7387969648, 8.176665341681026, 8.176665341677914), 0) AS reprpoint
FROM ( SELECT (ST_Dump(ST_Multi(ST_SimplifyPreserveTopology(ST_Buffer(way ,-8.59916568208233), 8.59916568208233)))).geom AS way,
tags
FROM ( SELECT ST_Union(way) AS way, tags
FROM ( SELECT ST_Buffer(way, 8.59916568208233) AS way,
CAST(tags AS text) AS tags
FROM planet_osm_polygon
WHERE way && ST_SetSRID('BOX3D(3889115.9991497695 3769262.7387969648,3890338.9916023314 3770485.731249527)'::box3d, 900913) AND way_area > 41.08091690439025 AND (tags->'usage'='main') ) p
GROUP BY CAST(tags AS text) ) p
WHERE ST_Area(way) > 73.94565042790245
ORDER BY ST_Area(way)) p
UNION
SELECT ST_AsGeoJSON(ST_TransScale(ST_Intersection(way, ST_SetSRID('BOX3D(3889115.9991497695 3769262.7387969648,3890338.9916023314 3770485.731249527)'::box3d, 900913)), -3889115.9991497695, -3769262.7387969648, 8.176665341681026, 8.176665341677914), 0) AS way,
hstore2json(CAST(hstore(tags) AS hstore)) as tags,
Null AS reprpoint
FROM ( SELECT (ST_Dump(ST_Multi(ST_SimplifyPreserveTopology(ST_LineMerge(way), 8.59916568208233)))).geom AS way,
tags
FROM ( SELECT ST_Union(way) AS way,
CAST(tags AS text)
FROM planet_osm_line
WHERE way && ST_SetSRID('BOX3D(3889115.9991497695 3769262.7387969648,3890338.9916023314 3770485.731249527)'::box3d, 900913) AND
(tags->'usage'='main') GROUP BY CAST(tags AS text) ) p ) p
UNION
SELECT ST_AsGeoJSON(ST_TransScale(way, -3889115.9991497695, -3769262.7387969648, 8.176665341681026, 8.176665341677914), 0) AS way,
hstore2json(tags) AS tags,
Null AS reprpoint
FROM planet_osm_point
WHERE way && ST_SetSRID('BOX3D(3888829.3602937004 3768976.0999408956,3890625.6304584006 3770772.3701055963)'::box3d, 900913) AND (tags->'usage'='main') LIMIT 10000
Thank you very much for your help,
Adi Barda
Add a config option to set the SRID of the osm2pgsql database (but only support 900913 and 3857 as a first step).
This task was taken from #122.
Prints "Syntax error in input at line N", probably because some other regex is too greedy.
To speed up loading and reduce the traffic, empty bitmap tiles should no be transferred. Instead an error code should be sended to inform the client to use a transparent standard tile (errorTileUrl in Leaflet), which was loaded just one time.
While solving #74, I discovered that there is a huge problem with too big vector tiles on low zoom levels. There should not be more than 10.000 features necessary for rendering just this single tile. In low zoom levels the single ways are simplified, but not merged. This causes that there are thousands of ways that consist of one or two nodes. Merging these short ways to a few longer would reduce the file size.
This issue can be used for collecting ideas on how to reduce the number of features in low zoom levels.
Currently node-tileserver considers some MapCSS properties such as kothicjs-ignore-layer: true;
to ignore some statements in certain renderers. A better solution is to add support for MapCSS media queries.
Hi,
I cannot find this file. Do i have to create it ? and what shall it contains ?
Thanks
There are some strange rendering results at this tile: http://tiles.openrailwaymap.org/standard/18/138997/90723.png
Sometimes there are gaps at the switches, sometimes the lines are too long.
node-tileserver currently works with EPGS:900913 while current osm2pgsql versions use EPSG:3857.
To do:
Ordering features with z-index to determine their rendering order does not work correctly in some cases.
I guess that the problem occurs when using splitted MapCSS rules where multiple rules match on one feature (like in the example). It is also thinkable that z-indexes dynamically created with eval() are not supported by parts of the code. Therefore analyse what is happening here:
node-tileserver/kothic/style/style.js
Line 79 in 034152a
Example:
Speed signals and the used MapCSS stylesheet.
The MapCSS spec says that both single and double quotes are supported and can be used to mask the other type. Currently all quotes from the beginning and end of both keys and values are stripped, and at the end always single quotes are used.
This is currently no big issue as those things are quite uncommon, but it should not get lost.
Add logging and statistics of tile requests to be able to:
MapCSS converter throws syntax errors when trying to compile MapCSS stylesheets with regular expressions containing square brackets.
It seems that MapCSS parser does not differentiate between square brackets of MapCSS selectors and those inside regular expressions.
See OpenRailwayMap/OpenRailwayMap#200 as an example.
The above example is http://a.tiles.openrailwaymap.org/standard/6/33/21.png as of today. Basically all of these gaps are filled with main or highspeed lines in zoom level 7.
// should start a comment to the end of the line.
Hi,
would it be possible to post the structure of the project, js files and so on thank you :)
Responses should return a Server header:
Server:node-tileserver/0.3
Rendering casings produces strange results:
Source: http://tiles.openrailwaymap.org/standard/19/274327/177836.png
Related vector tile: http://tiles.openrailwaymap.org/vector/19/274327/177836.js
Can't install at windows 10 or windows server.
I can't catch from installation note.
Can I get reference installation note/video for Windows environment?
Thanks.
Hi,
first of all, i have to thank you for this awsome solution.
i just want to know which repositories you used in yum to install all dependencies.
thank you in advance.
it's installed under node_module, and it cannot recognize it !!
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'pg'
at Function._resolveFilename (module.js:289:11)
at Function._load (module.js:241:25)
at require (module.js:317:19)
at Object. (/home/yasser/Desktop/nodetileserver/node-tileserver/tileserver.js:17:6)
at Module._compile (module.js:373:26)
at Object..js (module.js:379:10)
at Module.load (module.js:305:31)
at Function._load (module.js:271:10)
at Array. (module.js:392:10)
at EventEmitter._tickCallback (node.js:108:26)
(Moved issue OpenRailwayMap/OpenRailwayMap#408 by @sb12 over to this repository)
Asian characters like Korean, Japanese or Chinese in station names are not shown on the map
Examples:
Error: Problem with log4js configuration: ({ appenders:
[ { type: 'console' },
{ type: 'file', filename: 'logs/site_1499517945.log' } ] }) - must have a p roperty "appenders" of type object.
at tests.forEach (/var/www/bot/node_modules/log4js/lib/configuration.js:37:1 5)
at Array.forEach (native)
at Configuration.throwExceptionIf (/var/www/bot/node_modules/log4js/lib/conf iguration.js:35:11)
at new Configuration (/var/www/bot/node_modules/log4js/lib/configuration.js: 190:10)
at Object.configure (/var/www/bot/node_modules/log4js/lib/log4js.js:172:12)
at updateLog (/var/www/bot/cf.js:32:9)
at Object. (/var/www/bot/cf.js:29:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
Add https://github.com/mapnik/node-mapnik as an alternative rendering engine for creating bitmap tiles.
The tileserver should not be stopped directly after a quit event, but wait until all pending requests are finished. This ensures that users will receive a response for their pending requests and the program exit will be more smoothly.
Try this:
node|z14-[railway=signal]["railway:signal:speed_limit"=lf7]["railway:signal:speed_limit:speed"]
{
icon-image: eval(concat("icons/de-lf7-", tag("railway:signal:speed_limit:speed"), "-sign-32.png"));
}
Greetings,
I have configured a running installation of node-tileserver on my own server but all tiles generated are empty. I'm using this mapcss style and a recently downloaded extract of Berlim from Geofabrik imported via osm2pgsql.
I'm pretty sure I've followed the README correctly and can't seem to find where the problem is.
This is my config.json:
{
"tileSize" : 256,
"prefix" : "planet_osm",
"database" : "avm-node",
"username" : "avm",
"password" : "",
"vtiledir" : "./tiles",
"tiledir" : "./bitmap-tiles",
"expiredtilesdir" : "./expired-tiles",
"styledir" : "./styles",
"zoomOffset" : 0,
"minZoom" : 0,
"maxZoom" : 20,
"styles" : ["default"],
"intscalefactor" : 10000,
"geomcolumn" : "way",
"pxtolerance" : 1.8,
"maxPrerender" : 8,
"maxCached" : 16,
"minExpiring" : 8,
"maxsockets" : 100,
"tileserverPort" : 80,
"tileBoundTolerance" : 60,
"filterconditions" :
{
"0" : ""
}
}
Hi,
Is it possible to share the example of MapCSS style which you are using and works with map_cssconverter.py
?
I tried some MapCSSs and they raise errors while I try to convert them. Mostly raise Illegal character for !
and +
fs.exists()
is deprecated and should be replaced by fs.stat()
or fs.access()
. More details: https://nodejs.org/api/fs.html#fs_fs_exists_path_callback
Send an UTF-8 encoding header in vector tiles responses.
Try
res.header("Content-Type", "application/javascript; charset=utf-8");
or
res.setEncoding('utf8');
Currently node-tileserver cannot render italic fonts. Add support for the MapCSS statements font-style: italic
and font-style: normal
.
One can get bold fonts, but only if a bold font-family is requested. "font-weight: bold" has no effect. In fact KothicJS calculates the italic and bold styles from the font-family. See getFontString() in kothic/style/style.js.
Related to #16.
Fix a bug that causes rendering artefacts. In every known case a lines goes either from the top left corner parallel to the tile bound or from the top left corner to the bottom right corner of a tile.
The bug can be seen on the map of the OpenRailwayMap project (which uses node-tileserver for rendering):
Replace expire-tiles.js
by a shell script. NodeJS is not necessary and not efficient for this kind of task.
Rewrite the last remaining synchronous functions to have a full asynchronous program.
Currently the rendering of dashes does not work in every case.
Example: Süntelbahn http://www.openrailwaymap.org/canvas.php?lang=de&lat=52.197007066922616&lon=9.450516700744629&zoom=14&style=standard
On zoom 15 it get's worse, but I suspect this could be the renderer doing something wrong:
There are some functions for coordinate transformation such as from4326To3857()
in tile.js
and coordinate transformations in the database query. Check if there is a possibility to remove unnecessary transformations to improve performance.
hi
i try to install your node-tileserver on a fresh ubuntu 14.04
with nodejs install per nvm
nvm set 0.10.28
i get the tileserver.js running, but have troubles with the init-rendering.js
got this error:
[2014-06-17 18:47:07.556] [INFO] [default] - Initial rendering of 87k tiles in the background. This process can take some time.
/home/osm/projects/osmjs/tileserver/init-rendering.js:142
eventEmitter.on('tileFinished', initTileFinished);
^
ReferenceError: eventEmitter is not defined
at Object.<anonymous> (/home/osm/projects/osmjs/tileserver/init-rendering.js:142:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
is there a package missing?
any ideas? i am no programmer :)
thx
rob
It seems that vector rendering is very slow not because of the browser rendering itself, but large vector data tiles.
Another way of reducing tile size is removing tags that are not rendered (such as source=, fixme=, description=, note=) and compressing tags since there are a lot tags that occur at almost every feature (like railway=rail).
And some compression could be achieved by using shorter property names (e.g. 'c' instead of 'coordinates').
Add an internal logging and statistics to count the number of tiles which was requested in the last minute, hour, day, etc. Also analyse e.g. referers to detect abuse (robots, mass downloads, ...).
It should be possible to access these stats with an API call which returns this data in JSON format.
i got an error pointing to the first parameter of the config file.
i updated all modules and still it gave me the same thing.
i'm using node v0.4.0
/home/yasser/Desktop/nodetileserver/node-tileserver/config.json:2
"tileSize": 256,
^
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected token :
at Module._compile (module.js:368:25)
at Object..js (module.js:379:10)
at Module.load (module.js:305:31)
at Function._load (module.js:271:10)
at require (module.js:317:19)
at Object. (eval at (/home/yasser/Desktop/nodetileserver/node-tileserver/tileserver.js:33:9))
at Object. (/home/yasser/Desktop/nodetileserver/node-tileserver/tileserver.js:33:9)
at Module._compile (module.js:373:26)
at Object..js (module.js:379:10)
at Module.load (module.js:305:31)
any ideas ?
thanks in advance
To save disk space, empty bitmap tiles should not be cached on hard disk. Instead, there should be a hardlink to one transparent tile created.
hi,
i'm working on ubuntu 14.04 LTS.
when i start the server i get this this error:
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Problem reading log4js config { appenders:
[ { type: 'logLevelFilter',
level: 'ERROR',
appender: [Object],
makers: [Object] },
{ type: 'logLevelFilter',
level: 'INFO',
appender: [Object] } ] }. Error was "log4js configuration problem for { type: 'logLevelFilter',
level: 'ERROR',
appender:
{ type: 'file',
filename: 'tileserver.log',
maxLogSize: 20480,
backups: 0 },
makers: { console: [Function], logLevelFilter: [Function] } }" (Error: log4js configuration problem for { type: 'logLevelFilter',
level: 'ERROR',
appender:
{ type: 'file',
filename: 'tileserver.log',
maxLogSize: 20480,
backups: 0 },
makers: { console: [Function], logLevelFilter: [Function] } }
at /home/yasser/Desktop/nodetileserver/node-tileserver/node_modules/log4js/lib/log4js.js:167:15
at Array.forEach (native)
at configureAppenders (/home/yasser/Desktop/nodetileserver/node-tileserver/node_modules/log4js/lib/log4js.js:159:18)
at configureOnceOff (/home/yasser/Desktop/nodetileserver/node-tileserver/node_modules/log4js/lib/log4js.js:208:32)
at Object.configure (/home/yasser/Desktop/nodetileserver/node-tileserver/node_modules/log4js/lib/log4js.js:272:3)
at Object. (/home/yasser/Desktop/nodetileserver/node-tileserver/tileserver.js:11:8)
at Module._compile (module.js:373:26)
at Object..js (module.js:379:10)
at Module.load (module.js:305:31)
at Function._load (module.js:271:10))
at configureOnceOff (/home/yasser/Desktop/nodetileserver/node-tileserver/node_modules/log4js/lib/log4js.js:217:13)
at Object.configure (/home/yasser/Desktop/nodetileserver/node-tileserver/node_modules/log4js/lib/log4js.js:272:3)
at Object. (/home/yasser/Desktop/nodetileserver/node-tileserver/tileserver.js:11:8)
at Module._compile (module.js:373:26)
at Object..js (module.js:379:10)
at Module.load (module.js:305:31)
at Function._load (module.js:271:10)
at Array. (module.js:392:10)
at EventEmitter._tickCallback (node.js:108:26)
any help ?
thanks in advance.
Extend the tileserver so that all requests can also be made using HTTPS.
The vector tiles currently contain three-dimensional coordinates for LineStrings and Polygons: http://a.tiles.openrailwaymap.org/vector/17/68445/45585.json.
This coordinate is always 0
and not necessary for rendering 2D maps.
It might be that also the objects in the osm2pgsql database have such geometries.
Add a package.json file for easier package exchanging and installing with npm.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.