Kari Hanski
Kari Hanski

Reputation: 1

How to use geojson.Reader with Here-API V3

How to access feature data from GeoJSON layer?

How to change marker color on a layer created from GeoJSON with point data?

Following code snippet creates the layer:

var busReader = new H.data.geojson.Reader(busjson);
busReader.parse();
var busLayer = busReader.getLayer();
map.addLayer(busLayer);

Upvotes: 0

Views: 680

Answers (1)

user3505695
user3505695

Reputation:

There is the style option which can be provided with the reader (documentation)

      var reader = new H.data.geojson.Reader(busjson, {
        // This function is called each time parser detects a new map object
        style: function (mapObject) {
          if (mapObject instanceof H.map.Polygon) {
            mapObject.setStyle({
              fillColor: 'rgba(153, 0, 153, 0.5)',
              strokeColor: 'rgba(0, 0, 102, 0.5)',
              lineWidth: 3
            });
          }
        }
      });

      // Start parsing the file
      reader.parse();

      // Add layer which shows GeoJSON data on the map
      map.addLayer(reader.getLayer());

Upvotes: 3

Related Questions