Select to view content in your preferred language

NetworkError : 404 'bboxSR' parameter is invalid

803
3
06-28-2011 10:12 AM
JasonFoster
Emerging Contributor
I am getting the following error

"NetworkError: 404 'bboxSR' parameter is invalid .../MapServer/export?dpi=96&transparent=true&format=png8&bbox=-10804893.560439762%2C3860291.8999301037%2C-10803276.439560238%2C3861092.1000698963&bboxSR=%5Bobject%20Object%5D&imageSR=%5Bobject%20Object%5D&size=1354%2C670&f=image"


// Get Map Extent 
    var mapExtent = eval("(" + document.getElementById("MapExtent").value + ")");
    extent = new esri.geometry.Extent({
        "xmin":mapExtent.xmin,
        "ymin":mapExtent.ymin,
        "xmax":mapExtent.xmax,
        "ymax":mapExtent.ymax,  "spatialReference": { "wkid":mapExtent.spatialReference }
    });

    // Create Map
    map = new esri.Map("Map");
    map.setExtent(extent);

    // base layer
    baseUrl = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";
    baseLayer = new esri.layers.ArcGISTiledMapServiceLayer(baseUrl);
    baseLayer.id = "BaseLayer";

    // Data layer
    dataUrl = document.getElementById("dataUrl").value;
    dataLayer = new esri.layers.ArcGISDynamicMapServiceLayer(dataUrl);
    dataLayer.id = "DataLayer";

    // Add Layers
    map.addLayers([baseLayer, dataLayer]);
    window.onresize = resizeMap;

    dojo.connect(map, "onLoad", function () {
        // Do other stuff                           
    });
0 Kudos
3 Replies
derekswingley1
Deactivated User
Can you elaborate on what this line does:
var mapExtent = eval("(" + document.getElementById("MapExtent").value + ")");
0 Kudos
JasonFoster
Emerging Contributor
Thanks, you helped me find the answer.

It was was grabbing the following


<input id="MapExtent" type="hidden" value="{ &quot;xmin&quot;:-10804667, &quot;ymin&quot;:3860339,&quot;xmax&quot;:-10803503,&quot;ymax&quot;:3861045,&quot;spatialReference&quot;: { &quot;wkid&quot;:102100 } }" /><input id="dataUrl" type="hidden" value=".../MapServer" /></div>
so I needed to change :
    extent = new esri.geometry.Extent({
        "xmin":mapExtent.xmin,
        "ymin":mapExtent.ymin,
        "xmax":mapExtent.xmax,
        "ymax":mapExtent.ymax,  "spatialReference": { "wkid":mapExtent.spatialReference}
    });
to...

    extent = new esri.geometry.Extent({
        "xmin":mapExtent.xmin,
        "ymin":mapExtent.ymin,
        "xmax":mapExtent.xmax,
        "ymax":mapExtent.ymax,  "spatialReference": { "wkid":mapExtent.spatialReference.wkid }
    });
0 Kudos
derekswingley1
Deactivated User
That seems kind of convoluted, but if it works for you then OK. Are populating the hidden input tag on the server to serve a map with a different extent for different pages?
0 Kudos