You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello
if i use the function "featureselected" the string feature.attributes.id_test; is undefined
how can i get this value or another one from "attributes" of a feature ?
for (var i=0; i<data.length; i++) {
var lon = data[i].x;
var lat = data[i].y;
var id_poi = data[i].id_poi; // --> i have the value
var f = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point( lon, lat ).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()),
{
"id_test":data[i].id_poi // --> i add the value
}
);
features.push(f);
}
couche_markers.addFeatures(features); // add POI
// active control
click = new OpenLayers.Control.SelectFeature( [couche_markers], { clickout: false, toggle: false});
map.addControl(click);
couche_markers.events.on({
"featureselected": function(e) {
var feature = e.feature;
id_poi = feature.attributes.id_test;
console.log("show id poi"+id_poi"; //--> ERROR the variable is undefined
}
});
The text was updated successfully, but these errors were encountered:
Once clustered each cluster is a feature wich contains the set of features near to that point.
"Original" features are stored withint the feature.cluster attribute. Take a look on that.
ok thanks
i can access my value like this
couche_markers.events.on({
"featureselected": function(e) {
var feature = e.feature.cluster[0].data;
var cpt_cluster = e.feature.cluster.length;
if(cpt_cluster == 1)id_poi = e.feature.cluster[0].data.id_test;
}
});
now i want to have a specific external graphic when there is only one poi
so i have created this rule but i don't know how to get one of the feature.cluster value here
externalGraphic: "/drawable-hdpi/theme/${cat_poi}_poi.png",
instead of
externalGraphic: "/drawable-hdpi/theme/Cat_20_02_poi.png",
thanks :)
// Define three rules to style the cluster features.
var oneRule = new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LESS_THAN,
property: "count",
value: 2
}),
symbolizer: {
fillOpacity: 1,
opacity : 1,
externalGraphic: "/drawable-hdpi/theme/Cat_20_02_poi.png",
graphicHeight: 50, graphicWidth: 50, graphicXOffset:-25, graphicYOffset:-25
}
});
hello
if i use the function "featureselected" the string feature.attributes.id_test; is undefined
how can i get this value or another one from "attributes" of a feature ?
The text was updated successfully, but these errors were encountered: