Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to iterate through a GeoJSON file (below) and eventually populate an array with a few attributes within "properties". I keep coming up short working through various examples I can find. Do I need to embed another $.each() to get to properties. If it isn't obvious I'm new to this and I've hit the wall.

What I have so far:

$(document).ready(function () {    
            $.getJSON('testpoint.geojson', function (data) {
                var items = [];
                $.each(data.features, function (key, val) {
                    items.push('<li id="' + key + '">' + val + '</li>');
                $('<ul/>', {

And my json is as follows:

    "type": "FeatureCollection",
    "features": [
            "type": "Feature",
            "properties": {
                "gid": 1,
                "PID": "9-18-3",
                "BCT": "BCT126",
                "OWNER_TYPE": "A",
                "LOCNO": 0,
                "LOCEXT": "",
                "STREET": "CROSBY LANE",
                "ACQUIRED": "5/7/2010",
                "GRANTOR": "John A. SPARGO",
                "UPLAND": 0,
                "WETLAND": 3.96,
                "TOTAL": 3.96,
                "HABITAT": "salt marsh"
            "geometry": {
                "type": "Point",
                "coordinates": [
share|improve this question

2 Answers 2

up vote 6 down vote accepted

You are almost there. Another .each for should work:

$.each(data.features, function (key, val) {
    $.each(, function(i,j){
        items.push('<li id="' + i + '">' + j + '</li>');
share|improve this answer
Thanks Cyrus, that did the trick. I tried every combo but that. I'm a beginner and iterations can become overwhelming quickly – geomajor56 Jul 19 '12 at 19:07

What is written above will loop through each element in each JSON object. Those are JSON objects so you want to treat them as the objects geometry and properties then simply reference them with dot notation.

$.each(data.features, function (key, val) {
  geometry = val.geometry;
  properties =;
  alert (;  
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.