I have a ushahidi deployment and i am using Openlayers + ushahidi api to show the reports in a separate map along with other features.
i have queried the data from ushahidi api and made a vector layer. the layer has data but it not showing up.
This part gets the data from ushahidi
var roadreportrequest = OpenLayers.Request.GET({
url: '../roadreport/api/?task=incidents',
async: false,
success: function(Request) {
// alert("success");
roadreportjson = JSON.parse(Request.responseText);
},
failure: function() {
alert("failed to load data from roadrepoter");
roadreportjson = {}
}
});
and this part converts it to vector layer
var roadreport_vector = new OpenLayers.Layer.Vector('RoadReporter Reports');
for (incident_index in roadreportjson.payload.incidents) {
// console.log(incident_index, roadreportjson.payload.incidents[incident_index]);
incident = roadreportjson.payload.incidents[incident_index];
roadreport_vector.addFeatures([
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(incident.incident.locationlongitude, incident.incident.locationlatitude),
incident)
])
}
map.addLayer(roadreport_vector);
There is data in the layer, i have checked the console and this code to pan the map also works.
map.panTo(new OpenLayers.LonLat(roadreport_vector.features[2].geometry.x, roadreport_vector.features[2].geometry.y))
My issue is that i am expecting the data to be shown up as on the map(the default orange circles), but it is not showing up.