kothic / kothic-js Goto Github PK
View Code? Open in Web Editor NEWKothic JS — a full-featured JavaScript map rendering engine using HTML5 Canvas
Home Page: http://kothic.org
License: BSD 2-Clause "Simplified" License
Kothic JS — a full-featured JavaScript map rendering engine using HTML5 Canvas
Home Page: http://kothic.org
License: BSD 2-Clause "Simplified" License
Kothic Map Renderer Depends: 1. tWMS http://twms.googlecode.com/ symlink twms directory into src/ 2. python-lxml 3. python-psyco, if available. 4. pygtk for GUI 5. pycairo 6. python-psycopg2 7. python-shapely 8. python-pyproj To run: 1. Install all dependancies. 2. cd src/ 3. cat small_test_osm_dump.osm | python osm2tiles.py 4. wait a bit and check if tiles got generated 5. python kothic.py to run GUI NOT READY FOR DAILY USAGE!
psycopg2.ProgrammingError: column "transport" does not exist
LINE 3: ...ferry_terminal')) OR (("natural" = 'water')) OR (("transport...
Seems like the transport
key is obsolete.
This is how OpenRailwayMap looks with the original rendering code:
The casing is now either always on or always off as it looks to me. The change is the new dashing code from @braandl.
Allow drawing 3D-objects on canvas
It would be nice to be able to load MapCSS to Kothic JS in real time, bypassing the python scripts step.
http://zaach.github.com/jison/
After fixing my intitial problems in #34, i ran into problems with the _onKothicDataResponse
function in kothic-leaflet.js
this.kothic = new Kothic({
buffered: layer.options.buffered,
styles: layer.options.styles,
additionalStyle: layer._additionalStyle,
locales: ['be', 'ru', 'en']
});
layer.options.styles
was always undefined
. The initialize method ddidn't set the correct options object. I included the fix in pull request #34
В тесте производительности(Win):
Change mapcss.js to let user have a set of maps with different styles on a page.
This page http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames specifies that zoom_levels range from 0 to 18
The first things I encountered were TileLayer.Canvas and _reset(), which are not in 1.0 anymore.
Currently, Konqueror has support for canvas but has no functions to work with text on it.
Probably we can add checks for text functions availability and don't render (and don't fail) if they're unavailable.
Implement http://wiki.openstreetmap.org/wiki/MapCSS/0.2#Label_properties while not breaking current parsing logic for files where those attributes are unused.
image: for linear objects s the same as fill-image: for polygons
Now, each tile creates own instance of Kothic. I've tried to share Kothic instance, but it caused some kind of race-condition issue. We should remove all shared state from Kothic to allow simultaneous tiles rendering.
Hello,
I am currently developing an own web application using KothicJS and Leaflet to render a map overlay. But I am having some problems to get this application running.
In my browser's Javscript console I get this error:
Uncaught ReferenceError: s_everything is not defined
This error is caused by the Javascript stylefile.
My stylefile, which I generated with mapcss_converter.py, contains these lines at the end of the function restyle:
if (!K.Utils.isStyleUseful(s_default)) {
style['default'] = {};
for (var attrname in s_everything) { style['default'][attrname] = s_everything[attrname]; }
for (var attrname in s_default) { style['default'][attrname] = s_default[attrname]; }
}
return style;
The stylefile on the example page (http://kothic.org/js/osmosnimki.js) is a bit different at this part of the code and does not contain s_everything:
if (!K.Utils.isEmpty(s_default)) {
style['default'] = s_default;
}
if (!K.Utils.isEmpty(s_centerline)) {
style['centerline'] = s_centerline;
}
if (!K.Utils.isEmpty(s_ticks)) {
style['ticks'] = s_ticks;
}
if (!K.Utils.isEmpty(s_label)) {
style['label'] = s_label;
}
return style;
Why is there a difference between my file and the example file?
I hope you can help me.
Regards
Alex
This should make it much easier to improve styling performance (better cache, less styling passes, etc.).
Sometimes icons are not redrawn correctly after changing the zoom level.
If you change the zoom level, you will see that sometimes after zoom-in the icons appear in the intended size, but also in twice as big:
(source: http://www.openrailwaymap.org/?lang=en&lat=51.22263642333937&lon=6.676366925239563&zoom=17&style=signals)
A similar problem happens after zooming out. In this case, the icons are only half of the intended size.
It seems that something with the zooming transition fails. Maybe the resized icons are not removed after re-rendering the canvas layer.
Kothic can choose map locale based on browser properties. Seems there is no standard way to do this in pure JS. This Stack Overflow question may be helpful:
http://stackoverflow.com/questions/1043339/javascript-for-detecting-browser-language-preference
Original Kothic has useful "get_interesting_tags" function. This function returns list of tags used in MapCSS style. We should generate same function in MapCSS -> JS converter and use if for style caching.
This isn't really Kothic's bug but a blocker for release.
0.1 should be released/tarred after:
Using casing-dashes: 0,0;
or dashes: 0,0;
in a MapCSS style causes a crash of Chromium (and probably other browsers too).
An automatic testsuite would be very helpful to catch regressions, and ideally it could be even integrated with Travis CI.
Accroding to http://code.google.com/p/chromium/issues/detail?id=86287#c13 or code creates lots of canvases somewhere inside, so it might be worth investigating it.
Contrary to what the Wiki says, cond() is actually not supported. Look into src/style/mapcss.js, there is no e_cond function. We have hit this wall in OpenRailwayMap as we currently can't use that in our MapCSS files.
В последнем хроме (13.0.782.1) всё стало выглядеть, как взрыв на макаронной фабрике. Any ideas? Наша бага, или хрома?
http://latlon.org/~komzpa/screenshots/kothic-js-leaflet-chrome13.jpg
В результате зачисток поломалась логика коллизий для иконок с подписями.
Если у иконки есть подпись, то убирать и показывать их надо только вместе - не нужно допускать ситуации, когда рисуется только иконка, или только подпись.
Looks like we need some sort of wrapper around Kothic to enable features absent, or broken, in some browsers. Including, but not limited, to:
Hi,
if you download the trunk codebase, open debug/index.html and zoom in until zoom level 13 (the first with house numbers), you'll see that house numbers that should be at the bottom of the tile are at the top and those who should be at the bottom are at the top, i.e. y was replaced by tile_height - y in the geometry. See picture at http://imageshack.us/f/835/picture1dpi.png/
I was looking at a possible fix by removing the call to this._invertYAxe(data) in kothic_leaflet.js, but this actually inverts the y axis for all the geometries, not only the house numbers.
Only the trunk version is affected. kothic.org/js looks perfectly fine.
metric("3m") should render as real-world 3m wide line, not 3 mercator metre wide.
fill-image: The URL (absolute or relative) of an image with which to fill the canvas
When trying to compile my on distribution of kothic the closure compiler (started via make all
) complains about a missing src/renderer/renderer.js
. it isn't available in the src
directory. I guess it has been removed.
Make an example how to change styles on the fly, and implement it if it's impossible now.
I want to see the demo.http://kothic.org/js/
canvas{antialiasing:full} - default, antialias everything
canvas{antialiasing:text} - antialias only text
canvas{antialiasing:none} - antialias nothing
Now, when tile moved out of visible area, the tile being completely removed from memory. We need to cache preprocessed data to reduce tile loading next time. Bobcat renderer already has cache implementation, so it can be easily copied.
Seems like canvas is the slowest part for now, but probably there are others, that aren't seen for now. Can we fake canvas object with something that will accept all the used calls and return immediately, to see only numbers that depend on object sorting?
There are at least 2 z-index issues, which probably need a combined solution, so I report them in one issue:
When you have 2 dashed lines close to each other (which quite often happens on railway tracks) which are not exactly aligned, i.e. when they are bend, the dashes will often merge so the line appears solid. The reason is obvious, but I would also like to get a solution.
Purpose is to pre-process elevation data such as SRTM, and include it as vector data in tiles, in order to allow rendering of contour and / or hillshading.
Rewrite Kothic to support closure compiler's --compilation_level ADVANCED_OPTIMIZATIONS.
It might be helpful to transliterate Cyrillic names to Latin for English-speaking users.
Useful code for transliteration: https://code.djangoproject.com/browser/django/trunk/django/contrib/admin/static/admin/js/urlify.js
Provide a full list of supported MapCSS features.
example of such documentation:
http://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation
simlpe tutorial sample:
http://josm.openstreetmap.de/wiki/Help/Styles/MapCSSTutorial
This is what I get when I use json_getter:
Traceback (most recent call last):
File "json_getter.py", line 226, in <module>
aaaa = get_vectors(bbox,zoom,style,"coastline")
File "json_getter.py", line 163, in get_vectors
b.execute(query)
psycopg2.ProgrammingError: relation "coastlines" does not exist
LINE 5: coastlines
These are the tables I have:
planet_osm_line
planet_osm_nodes
planet_osm_point
planet_osm_polygon
planet_osm_rels
planet_osm_roads
planet_osm_ways
Currently there is no way to say what went wrong when you end up with a bunch of gray tiles and some rendered ones. There should be some kind of possibility to extend the current debugging info (layers styled, map rendered, icons/text rendered).
Things that would be helpful:
*Tile number
*Whether data needed for rendering has been downloaded successfully or not
Maybe this info can be added as a half transparent layer (so that info for each tile is shown inside that tile) that can be switched on when necessary.
Looks like a good feature: allow user to specify (or autodetect?) map locale, and render map using that locale.
sample for Belarusian: http://osmosnimki.ru/kothic/kothic-js/debug/be
Also, it might be useful to make autotransliteration of Cyrillic for English-speakers.
With the last commit, the distribution file was overwritten with empty content. I guess this was not deliberate. Could you add it again?
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.