I'm having a random rendering issue, where one or both of the vector layers (mercury or sodium) render. If I refresh the browser it tends to render differently. Is this a synchronization issue or am I using openlayers incorrectly? I have verified that both the callback methods are not being called as expected with an alert() placement.
<i> // Mercury Lights
map.addLayer(vector_mercury);
var reqMercury = new OpenLayers.Protocol.HTTP({
url: "http://localhost:8080/elc/lights/mercury",
format: new OpenLayers.Format.GeoJSON(),
callback: addMercuryFromResponse
});
reqMercury.read();
vector_mercury.display(true);
// Sodium Lights
map.addLayer(vector_sodium);
var reqSodium = new OpenLayers.Protocol.HTTP({
url: "http://localhost:8080/elc/lights/sodium",
format: new OpenLayers.Format.GeoJSON(),
callback: addSodiumFromResponse
});
reqSodium.read();
vector_sodium.display(true);
...
function addSodiumFromResponse(response) {
for (var idx = 0; idx < response.features.length; ++idx) {
if (response.features[idx].geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
response.features[idx].geometry.transform(vector_sodium.projection, map.getProjectionObject());
vector_sodium.addFeatures([response.features[idx]]);
}
}
alert("Sodium Features " + response.features.length);
}
function addMercuryFromResponse(response) {
for (var idx = 0; idx < response.features.length; ++idx) {
if (response.features[idx].geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
response.features[idx].geometry.transform(vector_mercury.projection, map.getProjectionObject());
vector_mercury.addFeatures([response.features[idx]]);
}
}
alert("Mercury Features " + response.features.length);
}</i>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/rendering-vector-geoJSON-source-tp5037538.html">rendering vector geoJSON source</a><br/>
Sent from the <a href="http://osgeo-org.1560.n6.nabble.com/OpenLayers-Users-f3910695.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br/>