How to use the geojs/jsonReader function in geojs

To help you get started, we’ve selected a few geojs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenGeoscience / geonotebook / js / src / map / geojs.js View on Github external
_add_vector_layer (name, url, vis, query) {
    var data = url;
    var layer = this.geojsmap.createLayer('feature');
    vis = vis || {};

    // make sure zindex is explicitly set
    this._set_layer_zindex(layer, vis['zIndex']);

    var start = 0;
    JsonReader({layer}).read(data, function (features) {
      var colors = vis.colors;
      if (colors) {
        _.each(features, (feature) => {
          var data = feature.data() || [];
          var feature_start = start;
          feature.style('fillColor', (d, i, e, j) => {
            // point and polygon features have different interfaces, so make
            // changes to the arguments to unify the rest of the styling function.
            if (e) {
              d = e;
              i = j;
            }

            // we are going to extremes to avoid throwing errors
            var properties = d.properties || {};
            var id = properties._geonotebook_feature_id;