[OpenLayers-Users] problem consuming escaped single quotes in GeoJSON with a clustered vector layer

Eric Lemoine eric.lemoine at camptocamp.com
Thu Jun 10 03:10:57 EDT 2010


On Thu, Jun 10, 2010 at 4:28 AM, Zac Spitzer <zac.spitzer at gmail.com> wrote:
> I have having a problem consuming some GeoJSON,
> basically the name value in the sample below is causing
> my vector layer to silently abort rendering.
>
> i believe it's valid json, as i can load it into a javascript variable
> and dump it to the firebug console
>
> I'm using trunk Revision: 10300
>
> {
> "type": "FeatureCollection",
> "features": [
> { "type": "Feature",
> "fid": 14583,
> "geometry": {"type": "Point", "coordinates": [135.4092, -26.461317 ]},
> "properties": {
> "name": "3 O\'Clock Creek camping area",
> "fid": 14583,
> "icon": "openlayers/23"}
> }
> ]}
>
>
> any ideas?

Hi. I just tried with
<http://openlayers.org/dev/examples/vector-features.html> and it
worked. Here is what I did:

- open <http://openlayers.org/dev/examples/vector-features.html> in FireFox
- open the FireBug console and enter:

>>> var format = new OpenLayers.Format.GeoJSON();
>>> var features = format.read('{"type": "FeatureCollection","features":[{"type": "Feature","fid": 14583,"geometry": {"type": "Point","coordinates": [135.4092, -26.461317 ]},"properties": {"name": "3 O\'Clock Creek camping area","fid": 14583,"icon":"openlayers/23"}}]}');
>>> map.layers[1].addFeatures(features);

- unzoom to see the Australia, and the point is displayed

So at this point I don't know why you're having problem with this
GeoJSON string.

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list