A more detailed initial background to this issue is here:<br><a href="http://chitraswiki.blogspot.com/2009/11/getting-attributes-of.html">http://chitraswiki.blogspot.com/2009/11/getting-attributes-of.html</a><br><br><br><div class="gmail_quote">
On Mon, Nov 2, 2009 at 2:35 PM, Chitraleka Appalanaidu <span dir="ltr"><<a href="mailto:achitraleka@gmail.com">achitraleka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Tim,<br><br>Thank you very much for your help. feature.cluster solved the problem.<br><br>For other users who come across this problem, try to get the attributes of a point (specified in the geojson file in the 'properties' list) by using <br>

feature.cluster[0].attributes.<name_of_attribute_key><br><br>{<br>
    "type": "FeatureCollection",<br>
    "features": [<br>    
   {"type":"Feature", "id":"computer1", "properties":{"trial":"test"},
"geometry":{"type":"Point", "coordinates":[143, -35.91]}},<br>
       {"type":"Feature", "id":"computer2",
"properties":{"trial":"test"}, "geometry":{"type":"Point",
"coordinates":[144, -37.81667]}}<br>
    ]<br>
}<br><br>Basically, this is what happens when the geojson fileabove is parsed by OpenLayers.Format.GeoJSON parser and added as OpenLayers.Vector.Feature objects into a OpenLayers Vector layer (that performs the clustering strategy):<br>

1. GeoJSON file is read by the GeoJSON parser.<br>2. Parser creates OpenLayers.Vector.Feature objects for each string.<br>3. These OpenLayers.Vector.Feature objects are then added to the OpenLayers Vector layer<br>4. OpenLayers Vector layer performs clustering strategy<br>

5. Each feature point that appears on the map is the top-level feature point (for a group of clusters). The attributes for this feature point is:<br><br>undefinedlayer value :[object Object]<br> lonlat value :null<br> data value :[object Object]<br>

 id value :OpenLayers.Feature.Vector_201<br> geometry value :POINT(15918687.18122222 -4288244.5663272375)<br> state value :null<br> attributes value :[object Object]<br> style value :null<br> cluster value :[object Object],[object Object],[object Object]          //this indicates that this cluster point has three feature objects underneath it<br>

 renderIntent value :select<br> marker value :null<br><br>6. As it can be seen above, there is a 'cluster' property that holds 3 objects (being the three points). Hence, if you drill down to the 'cluster' property (i.e. feature.cluster[0]), it will give you the attributes of the first object in the cluster (being the point):<br>

<br>undefined0 value :[object Object] <br> layer value :null<br> lonlat value :null<br> data value :[object Object]<br> id value :OpenLayers.Feature.Vector_197<br> geometry value :POINT(8218510.393273033 -2699238.272071229)<br>

 state value :null<br> attributes value :[object Object]<br> style value :null<br> fid value :computer14<br> marker value :null<br><br>7. From the above, it can be seen that the 'id' property from the geojson file has been mapped to the 'fid' key of the feature point object. You can also see that the 'attributes' key holds an [object Object]. If you do feature.cluster[0].attributes.trial , it will display the 'trial' property and value that you specified in the geojson file (i.e. 'test').<br>

<br><br>Hence, adding as many property-value pairs in the GeoJSON file is easy as the GeoJSON parser just parsers the property-value pairs and enters the data into feature point object attributes that are beneath the top-level cluster point.<br>

<br>Kind regards,<br>Chitra<br><br><br><br><div class="gmail_quote"><div class="im">On Mon, Nov 2, 2009 at 12:56 PM, Tim Schaub <span dir="ltr"><<a href="mailto:tschaub@opengeo.org" target="_blank">tschaub@opengeo.org</a>></span> wrote:<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hey-<div><div></div><div><br>
<br>
Chitraleka Appalanaidu wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
Hi all,<br>
<br>
I have a geojson file that I pass to the penLayers.Format.GeoJSON parser. This parser converts the a geojson string (as below) to a OpenLayers.Vector.Feature object and adds it into an OpenLayers Vector layer (that performs clustering)<br>


<br>
{<br>
    "type": "FeatureCollection",<br>
    "features": [<br></div>
        {"type":"Feature", "id":"computer1", "properties":{"trial":"test"}, "geometry":{"type":"Point", "coordinates":[143, -35.91]}},<br>


        {"type":"Feature", "id":"computer2", "properties":{"trial":"test"}, "geometry":{"type":"Point", "coordinates":[144, -37.81667]}}<div class="im">
<br>

    ]<br>
}<br>
<br>
<br>
The problem with adding it into a clustering layer is that any properties I add into the "properties":{} field in the above geojson file will get overriden (because clustering will cause a count value to be entered into the properties list).<br>


<br>
I would like to add other information about a point in the geojson file above. Is there any other key-value pair i can use to do this? I have tried the 'fid' and 'style' key-value pairs but the parser does not seem to parse them out into a OpenLayers.Vector.Feature object.<br>


<br>
</div></blockquote>
<br></div></div><div class="im">
In terms of what you can do in GeoJSON, any other members (with non-reserved names) are allowed on feature objects.<br>
<br>
I think your issue is exclusively an OpenLayers issue.  OpenLayers will parse whatever you put in the properties member and make this available at feature.attributes (as you've seen).  When you use the cluster strategy, you can get at the original features in the cluster via feature.cluster.<br>


<br>
If you haven't already, you could write an email to the OpenLayers dev list with more specific questions.<br>
<br>
Tim<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>
Thank you.<br>
<br>
Kind regards,<br>
Chitra<br>
<br>
<br></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Geojson mailing list<br>
<a href="mailto:Geojson@lists.geojson.org" target="_blank">Geojson@lists.geojson.org</a><br>
<a href="http://lists.geojson.org/listinfo.cgi/geojson-geojson.org" target="_blank">http://lists.geojson.org/listinfo.cgi/geojson-geojson.org</a><br>
</blockquote>
<br>
<br>
-- <br>
Tim Schaub<br>
OpenGeo - <a href="http://opengeo.org" target="_blank">http://opengeo.org</a><br>
Expert service straight from the developers.<br>
_______________________________________________<br>
Geojson mailing list<br>
<a href="mailto:Geojson@lists.geojson.org" target="_blank">Geojson@lists.geojson.org</a><br>
<a href="http://lists.geojson.org/listinfo.cgi/geojson-geojson.org" target="_blank">http://lists.geojson.org/listinfo.cgi/geojson-geojson.org</a><br>
</div></blockquote></div><br>
</blockquote></div><br>