You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Andreas Neumann <ne...@karto.baug.ethz.ch> on 2005/02/11 12:26:53 UTC

problems with getURL in CVS build

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: neumann@karto.baug.ethz.ch 
www: http://www.carto.net/neumann/ 
SVG.Open: http://www.svgopen.org/ 
Carto.net: http://www.carto.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: problems with getURL in CVS build

Posted by Andreas Neumann <ne...@karto.baug.ethz.ch>.
>
>    The problem was with the gziped content. I'll commit a
> fix either tonight or over the weekend.


yes, the content sent back was gziped with Apache mod_gzip - that 
explains it!

>    BTW there is some totally untested postURL support in the
> current CVS build.
>
thank you! it's not that urgent - enjoy your weekend!

I'll try the postURL support with my digitizing app

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: neumann@karto.baug.ethz.ch 
www: http://www.carto.net/neumann/ 
SVG.Open: http://www.svgopen.org/ 
Carto.net: http://www.carto.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: problems with getURL in CVS build

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Andreas,

Andreas Neumann wrote:
> sorry, in my previous mail - the link to the app is at 
> http://www.carto.net/williams/yosemite/index.svg instead of 
> http://www.carto.net/williams/yosemite/loaddata.js

    The problem was with the gziped content. I'll commit a
fix either tonight or over the weekend.

    BTW there is some totally untested postURL support in the
current CVS build.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: problems with getURL in CVS build

Posted by Andreas Neumann <ne...@karto.baug.ethz.ch>.
sorry, in my previous mail - the link to the app is at 
http://www.carto.net/williams/yosemite/index.svg instead of 
http://www.carto.net/williams/yosemite/loaddata.js

> 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.


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: neumann@karto.baug.ethz.ch 
www: http://www.carto.net/neumann/ 
SVG.Open: http://www.svgopen.org/ 
Carto.net: http://www.carto.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org