1

I've got a geoJSON file consisting of:

{
"type": "FeautureCollection",
"features": [
    {
        "type": "Feature",
        "id": "1",
        "geometry": {
            "type": "Point",
            "coordinates": [
                5.709531,
                50.855802
            ]
        }
    },
    {
        "type": "Feature",
        "id": "2",
        "geometry": {
            "type": "Point",
            "coordinates": [
                5.709426,
                50.855798
            ]
        }
    }
]
}

This JSON file is constructed in a php script:

$ret = array();
$ret['type'] = "FeautureCollection";
$ret['features'] = array();

$f = array();
$f['type'] = 'Feature';
$f['id'] = $p['id'];
$f['geometry'] = array();
$f['geometry']['type'] = 'Point';
$f['geometry']['coordinates'] = array(floatval($p['lat']), floatval($p['lon']));
  $ret['features'][] = $f;

echo json_encode($ret);

When i try to load it through the polymaps.org framework none of the points are displayed. besides the standard stuff to load the map I use this javascript to parse the geoJSON.

map.add(po.geoJson()
.url('geojson/c.geo.php')
.id('test')
);

The CSS is the following, so that the points should look like a red-circle:

#test {
      fill: lightcoral;
      fill-opacity: .5;
      stroke: brown;
    }

The strange thing is, that when I alter the geojson file pointer to one constructed by a GIS application it works. So I bet my geoJSON is corrupted. But when I run it through http://jsonlint.com/ it validates.

Does anybody know how this is possible?

stUrb
  • 6,612
  • 8
  • 43
  • 71

1 Answers1

0

Not sure, but I think I have ever face the same problem with another framework:http://leaflet.cloudmade.com/

In my case, it is a matter of view position (e.g: you feature is on America, but your map show Africa). Also in cloudmade-leaflet, they use latitude-longitude instead of longitude-latitude.

You can check if your map view the correct area.

goFrendiAsgard
  • 4,016
  • 8
  • 38
  • 64