Map with German administrative districts

From JSXGraph Wiki
Jump to: navigation, search

This map shows the German administrative districts (counties).


© Bundesamt für Kartographie und Geodäsie, Frankfurt am Main, 2009

Vervielfältigung, Verbreitung und öffentliche Zugänglichmachung, auch auszugsweise, mit Quellenangabe gestattet.

The JavaScript code

The data has been downloaded in ArcView/shape format from Bundesamt für Kartographie und Geodäsie. Then, using shapelib and pyshapelib the file was converted to JavaScript, see krs.js. The shape data from this file is displayed using the following JSXGraph code.

var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:bbox, keepaspectratio:true}),
    c = [], 
    len = paths.length;

function final() {

function createCurve(path) {
    var i = c.length,
        col = JXG.hsv2rgb(360/len*i,0.7,1.0),  // fill color
        scol = '#333333',                      // stroke color
        sw = 1,                                // stroke width
        hcol = '#ffff00';                      // highlight color
    c[i] = brd.create('curve',path,
    JXG.addEvent(c[i].rendNode, 'mouseover', function(){c[i].nohcol = c[i].visProp.fillcolor; c[i].setAttribute({fillColor: 'yellow'});}, c[i]);
    JXG.addEvent(c[i].rendNode, 'mouseout', function(){c[i].setAttribute({fillColor: c[i].nohcol});}, c[i]);
    c[i].hasPoint = function(){return false;};

JXG.timedChunk(paths, createCurve, null, final);