-1

I have the below javascript;

var XX = $.getJSON("skiareas-polygons.geojson",function(data){ // add data to map L.geoJson(data, { style: function (feature) { return { color : 'black', weight: 1, fill: true, fillColor: 'grey', fillOpacity: 0.3 }; } }).addTo(map); }); 

I am having difficulty understanding how to access the response object. In particular, I can see the responseJSON below with indexes 0, 1 and 2. What is I wanted to

(1) access responseJSON.features.0.properties.name? (2) wanted the geojson version of all the data in all indexes or just 0?

Sorry but I hope I am clear. Maybe I just need some pointers in the right direction or links to read please?

response object

1

1 Answer 1

-1

Use simple responseJSON.features[0].properties.name

Since features is an array and contains 3 elements, square brackets are used to access an element, not the dot notation (dot notation is used to access an object's property).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.