[OpenLayers-Users] rendering vector geoJSON source

spTX spowell at cityofelcampo.org
Thu Feb 28 07:45:05 PST 2013


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. /       // 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);      }/



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/rendering-vector-geoJSON-source-tp5037538.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130228/45022c97/attachment.html>


More information about the Users mailing list