<commit_before>function addContourLayer(geojsonUrl, map, layerCollection) {
    console.log('create contour layer for geojson_url', geojsonUrl);

    var replacer = function(key, value) {
        if (value.geometry) {
            var type;
            var rawType = value.type;
            var geometry = value.geometry;

            if (rawType === 1) {
                type = geometry.length === 1 ? 'Point' : 'MultiPoint';
            } else if (rawType === 2) {
                type = geometry.length === 1 ? 'LineString' : 'MultiLineString';
            } else if (rawType === 3) {
                type = geometry.length === 1 ? 'Polygon' : 'MultiPolygon';
            }

            return {
                'type': 'Feature',
                'geometry': {
                    'type': 'MultiLineString',
                    'coordinates': geometry,
                },
                'properties': value.tags
            };
        } else {
            return value;
        }
    };

    var tilePixels = new ol.proj.Projection({
        code: 'TILE_PIXELS',
        units: 'tile-pixels'
    });


    return fetch(geojsonUrl).then(function(response) {
        return response.json();
    }).then(function(json) {
        var tileIndex = geojsonvt(json, {
            extent: 4096,
            debug: 1
        });

        var vectorSource = new ol.source.VectorTile({
            format: new ol.format.GeoJSON(),
            tileGrid: ol.tilegrid.createXYZ(),
            tilePixelRatio: 16,
            tileLoadFunction: function(tile) {
                var format = tile.getFormat();
                var tileCoord = tile.getTileCoord();
                var data = tileIndex.getTile(tileCoord[0], tileCoord[1], -tileCoord[2] - 1);

                var features = format.readFeatures(
                    JSON.stringify({
                        type: 'FeatureCollection',
                        features: data ? data.features : []
                    }, replacer));
                    tile.setLoader(function() {
                        tile.setFeatures(features);
                        tile.setProjection(tilePixels);
                    });
                },
            url: 'data:' // arbitrary url, we don't use it in the tileLoadFunction
        });

        function lineStyleFunction(feature, resolution) {
            var strokeWidth = feature.get('stroke-width');
            var zoom = map.getView().getZoom();
            var lineWidth = strokeWidth;
            var value = feature.get('level-value');
            var color = feature.get('stroke');
            // var color = ol.color.asArray(feature.get('stroke'));
            // color[3] = 0.8;
            var scaleFactor = 0.7;
            var zoomFactor = (zoom*zoom)/100.0;
            var zoomLevelShow10 = 10;
            var zoomLevelShow5 = 11;

            if (value % 60 === 0) {
                lineWidth = strokeWidth*3.0;
            }
            else if (value % 30 === 0) {
                lineWidth = strokeWidth*2.0;
            }
            else if (value % 15 === 0 && zoom < (zoomLevelShow10)) {
                lineWidth = strokeWidth;
            }
            else if (value % 10 === 0) {
                if (zoom < zoomLevelShow10) {
                    color = 'rgba(0,0,0,0)';
                }
                else {
                    lineWidth = strokeWidth;
                }
            }
            else if (value % 5 === 0) {
                if (zoom < zoomLevelShow5) {
                    color = 'rgba(0,0,0,0)';
                }
                else {
                    lineWidth = strokeWidth/2.5;
                }
            }
<commit_msg>show 5 min lines at a lower zoom level<commit_after>function addContourLayer(geojsonUrl, map, layerCollection) {
    console.log('create contour layer for geojson_url', geojsonUrl);

    var replacer = function(key, value) {
        if (value.geometry) {
            var type;
            var rawType = value.type;
            var geometry = value.geometry;

            if (rawType === 1) {
                type = geometry.length === 1 ? 'Point' : 'MultiPoint';
            } else if (rawType === 2) {
                type = geometry.length === 1 ? 'LineString' : 'MultiLineString';
            } else if (rawType === 3) {
                type = geometry.length === 1 ? 'Polygon' : 'MultiPolygon';
            }

            return {
                'type': 'Feature',
                'geometry': {
                    'type': 'MultiLineString',
                    'coordinates': geometry,
                },
                'properties': value.tags
            };
        } else {
            return value;
        }
    };

    var tilePixels = new ol.proj.Projection({
        code: 'TILE_PIXELS',
        units: 'tile-pixels'
    });


    return fetch(geojsonUrl).then(function(response) {
        return response.json();
    }).then(function(json) {
        var tileIndex = geojsonvt(json, {
            extent: 4096,
            debug: 1,
            indexMaxPoints: 100000
        });

        var vectorSource = new ol.source.VectorTile({
            format: new ol.format.GeoJSON(),
            tileGrid: ol.tilegrid.createXYZ(),
            tilePixelRatio: 16,
            tileLoadFunction: function(tile) {
                var format = tile.getFormat();
                var tileCoord = tile.getTileCoord();
                var data = tileIndex.getTile(tileCoord[0], tileCoord[1], -tileCoord[2] - 1);

                var features = format.readFeatures(
                    JSON.stringify({
                        type: 'FeatureCollection',
                        features: data ? data.features : []
                    }, replacer));
                    tile.setLoader(function() {
                        tile.setFeatures(features);
                        tile.setProjection(tilePixels);
                    });
                },
            url: 'data:' // arbitrary url, we don't use it in the tileLoadFunction
        });

        function lineStyleFunction(feature, resolution) {
            var strokeWidth = feature.get('stroke-width');
            var zoom = map.getView().getZoom();
            var lineWidth = strokeWidth;
            var value = feature.get('level-value');
            var color = feature.get('stroke');
            // var color = ol.color.asArray(feature.get('stroke'));
            // color[3] = 0.8;
            var scaleFactor = 0.7;
            var zoomFactor = (zoom*zoom)/100.0;
            var zoomLevelShow10 = 9;
            var zoomLevelShow5 = 11;

            if (value % 60 === 0) {
                lineWidth = strokeWidth*3.0;
            }
            else if (value % 30 === 0) {
                lineWidth = strokeWidth*2.0;
            }
            else if (value % 15 === 0 && zoom < (zoomLevelShow10)) {
                lineWidth = strokeWidth;
            }
            else if (value % 10 === 0) {
                if (zoom < zoomLevelShow10) {
                    color = 'rgba(0,0,0,0)';
                }
                else {
                    lineWidth = strokeWidth;
                }
            }
            else if (value % 5 === 0) {
                if (zoom < zoomLevelShow5) {
                    color = 'rgba(0,0,0,0)';
                }
                else {
                    lineWidth = strokeWidth/2.5;
                }
            }

{'fraction_non_alphanumeric': 0.11627906976744186, 'fraction_numerical': 0.018658734451054624, 'mean_word_length': 1.2572474824534636, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2815422', 'n_tokens_mistral': 2059, 'n_tokens_neox': 1872, 'n_words': 440}