Hi all,

in my mapping applications I make extensive use of getURL() to load map data to the current map extent. I don't load complete XML files, but just chunks of SVG or XML.

It worked fine in the Batik 1.5.1 official release, but does not work in the current CVS version. I don't know why. Using the debugger, I see that in the callback function of getURL() it returns data.success with "false" which was not the case in the 1.5.1 release (there it returned "true").

Here is my JS code:

function getLayers() {
myMainMap.nrLayerToLoad = 0;
for (i=0;i<myMainMap.dynamicLayers.length;i++) {
if (myMainMap.dynamicLayers[i].value == "yes") {
myMainMap.nrLayerToLoad++;
if (myMainMap.nrLayerToLoad == 1) {
document.getElementById("loadingData").setAttributeNS(null,"visibility","visible");
}
var myUrlString = "sendGeom.php?layername="+myMainMap.dynamicLayers[i].key+"&xmin="+myMainMap.curxOrig+"&ymin="+((myMainMap.curyOrig + myMainMap.curHeight)* -1)+"&xmax="+(myMainMap.curxOrig+myMainMap.curWidth)+"&ymax="+(myMainMap.curyOrig * -1);
getURL(myUrlString,addGeom);
}
}
}


//add the geometry to the application
//note that empty groups in the main-map have to exist
function addGeom(data) {
if(data.success) {
var node = parseXML(data.content, document);
var curDynLayer = node.firstChild.getAttributeNS(null,"id").replace(/_tempGeometry/,"");
var myGeometryToAdd = document.getElementById(curDynLayer);
if (myMainMap.dynamicLayers[curDynLayer].loaded == "yes") {
var tempGeometry = document.getElementById(curDynLayer+"_tempGeometry");
myGeometryToAdd.removeChild(tempGeometry);
}
myGeometryToAdd.appendChild(node);
//call function to place names
if (curDynLayer == "elevation") {
placeLabels(curDynLayer);
}
myMainMap.dynamicLayers[curDynLayer].loaded = "yes";
myMainMap.nrLayerToLoad--;
if (myMainMap.nrLayerToLoad < 0) {
alert("error: this shouldn't be happening...! layercontext: "+curDynLayer);
}
if (myMainMap.nrLayerToLoad == 0) {
document.getElementById("loadingData").setAttributeNS(null,"visibility","hidden");
}
var myStatusString = document.getElementById(curDynLayer+".Data").getAttributeNS(cartoNS,"nrRecs");
statusChange("loaded "+myStatusString+" elements for layer "+curDynLayer+"!");
window.setTimeout("statusChange('map ready')",3000);
}
else {
alert("something went wrong with dynamic loading of geometry!");
}
}


The full code is available at http://www.carto.net/williams/yosemite/loaddata.js - the application is available at http://www.carto.net/williams/yosemite/loaddata.js - if you use the debugger, you'll see that in the file "loaddata.js" in the function "addGeom(data)" that "data.success" evaluates to false.

Did something in Batik change or is it a matter of wrong document encoding? Do I need to load full XML documents including a valid XML header instead of just "chunks"?

Thanks for any idea what might be wrong here.

Andreas

--
--
---------------------------------------------- Andreas Neumann - Department of Cartography Swiss Federal Institute of Technology (ETH) ETH Hoenggerberg, CH-8093 Zurich, Switzerland Phone: ++41-1-633 3031, Fax: ++41-1-633 1153 e-mail: [EMAIL PROTECTED] www: http://www.carto.net/neumann/ SVG.Open: http://www.svgopen.org/ Carto.net: http://www.carto.net/



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to