Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Image service uses GET even though url is more than 2000 characters? #574

Closed
dodriscoll opened this issue Jul 7, 2015 · 15 comments
Labels

Comments

@dodriscoll
Copy link

Hi There,
Firstly this is a great plugin, and has allowed me to pull in and manipulate bathymetry imagery data in a way that will greatly enhance how our users interact with the data.

My only issue is this all works fine internally using internal services. When I try make the site available external one of the layers fails. I've applied several raster functions to this layer and the url is exceptionally long. If I apply less functions and keep the url under 2000 characters it works ok but if it is above approximately this value then it doesn't display. I'm not a programmer but from what I've read in the esri-leaflet.js code this should be allowed for and if the url is more than 200 characters a POST call is applied, Is there a setting I need to apply on the server or in my code for this to be enabled?

Any help gratefully received,

@jgravois
Copy link
Contributor

jgravois commented Jul 7, 2015

@dodriscoll please share an example request and I'll take a look.

also, are you using a tagged release of esri-leaflet in your app or are you building from master?

@dodriscoll
Copy link
Author

I downloaded the esri-leaflet source code and am using a local copy of it (esri-leaflet - v1.0.0-rc.8 - 2015-06-01) but I don't think the issue is related to the code now.

I suspect that it is more to do with CORS support on my server. It appears that CORS is supported and it does give the response Access-Control-Allow-Origin: * but it still will not display layers with URL longer then 2000 characters. Here is an example of a request url....it's very long I realise! If I reduce the number of colours applied to 25 (applying 100 here) then it works because the url is reduced generally to ~1800-1900 characters.

http://my_server/arcgis/rest/services/Infomar/All_BathySurveys/ImageServer/exportImage?bbox=-4525072.0744824335%2C5513249.976153191%2C2519364.452279409%2C8091318.066155617&size=1440%2C527&format=jpgpng&transparent=true&bboxSR=3857&imageSR=3857&renderingRule=%7B%22rasterFunction%22%3A%22Colormap%22%2C%22rasterFunctionArguments%22%3A%7B%22Colormap%22%3A%5B%5B100%2C253%2C107%2C0%5D%2C%5B99%2C252%2C111%2C0%5D%2C%5B98%2C252%2C115%2C0%5D%2C%5B97%2C252%2C120%2C0%5D%2C%5B96%2C251%2C124%2C0%5D%2C%5B95%2C251%2C129%2C0%5D%2C%5B94%2C251%2C133%2C0%5D%2C%5B93%2C250%2C137%2C0%5D%2C%5B92%2C250%2C142%2C0%5D%2C%5B91%2C250%2C146%2C0%5D%2C%5B90%2C249%2C151%2C0%5D%2C%5B89%2C249%2C155%2C0%5D%2C%5B88%2C249%2C159%2C0%5D%2C%5B87%2C248%2C164%2C0%5D%2C%5B86%2C248%2C168%2C0%5D%2C%5B85%2C248%2C173%2C0%5D%2C%5B84%2C247%2C177%2C0%5D%2C%5B83%2C247%2C181%2C0%5D%2C%5B82%2C247%2C186%2C0%5D%2C%5B81%2C246%2C190%2C0%5D%2C%5B80%2C246%2C195%2C0%5D%2C%5B79%2C246%2C199%2C0%5D%2C%5B78%2C245%2C203%2C0%5D%2C%5B77%2C245%2C208%2C0%5D%2C%5B76%2C245%2C212%2C0%5D%2C%5B75%2C245%2C217%2C1%5D%2C%5B74%2C235%2C218%2C5%5D%2C%5B73%2C226%2C219%2C10%5D%2C%5B72%2C217%2C220%2C15%5D%2C%5B71%2C208%2C221%2C19%5D%2C%5B70%2C199%2C222%2C24%5D%2C%5B69%2C190%2C223%2C29%5D%2C%5B68%2C181%2C224%2C33%5D%2C%5B67%2C172%2C225%2C38%5D%2C%5B66%2C163%2C226%2C43%5D%2C%5B65%2C154%2C227%2C47%5D%2C%5B64%2C145%2C228%2C52%5D%2C%5B63%2C136%2C229%2C57%5D%2C%5B62%2C126%2C231%2C61%5D%2C%5B61%2C117%2C232%2C66%5D%2C%5B60%2C108%2C233%2C71%5D%2C%5B59%2C99%2C234%2C75%5D%2C%5B58%2C90%2C235%2C80%5D%2C%5B57%2C81%2C236%2C85%5D%2C%5B56%2C72%2C237%2C89%5D%2C%5B55%2C63%2C238%2C94%5D%2C%5B54%2C54%2C239%2C99%5D%2C%5B53%2C45%2C240%2C103%5D%2C%5B52%2C36%2C241%2C108%5D%2C%5B51%2C27%2C242%2C113%5D%2C%5B50%2C18%2C244%2C118%5D%2C%5B49%2C17%2C234%2C123%5D%2C%5B48%2C16%2C224%2C128%5D%2C%5B47%2C15%2C214%2C134%5D%2C%5B46%2C15%2C204%2C139%5D%2C%5B45%2C14%2C195%2C145%5D%2C%5B44%2C13%2C185%2C150%5D%2C%5B43%2C12%2C175%2C156%5D%2C%5B42%2C12%2C165%2C161%5D%2C%5B41%2C11%2C156%2C167%5D%2C%5B40%2C10%2C146%2C172%5D%2C%5B39%2C10%2C136%2C178%5D%2C%5B38%2C9%2C126%2C183%5D%2C%5B37%2C8%2C117%2C189%5D%2C%5B36%2C7%2C107%2C194%5D%2C%5B35%2C7%2C97%2C200%5D%2C%5B34%2C6%2C87%2C205%5D%2C%5B33%2C5%2C78%2C211%5D%2C%5B32%2C5%2C68%2C216%5D%2C%5B31%2C4%2C58%2C222%5D%2C%5B30%2C3%2C48%2C227%5D%2C%5B29%2C2%2C39%2C233%5D%2C%5B28%2C2%2C29%2C238%5D%2C%5B27%2C1%2C19%2C244%5D%2C%5B26%2C0%2C9%2C249%5D%2C%5B25%2C0%2C0%2C255%5D%2C%5B24%2C3%2C0%2C250%5D%2C%5B23%2C7%2C1%2C245%5D%2C%5B22%2C11%2C2%2C240%5D%2C%5B21%2C15%2C3%2C235%5D%2C%5B20%2C19%2C4%2C230%5D%2C%5B19%2C22%2C5%2C225%5D%2C%5B18%2C26%2C5%2C220%5D%2C%5B17%2C30%2C6%2C215%5D%2C%5B16%2C34%2C7%2C210%5D%2C%5B15%2C38%2C8%2C205%5D%2C%5B14%2C41%2C9%2C200%5D%2C%5B13%2C45%2C10%2C195%5D%2C%5B12%2C49%2C11%2C190%5D%2C%5B11%2C53%2C11%2C185%5D%2C%5B10%2C57%2C12%2C180%5D%2C%5B9%2C60%2C13%2C175%5D%2C%5B8%2C64%2C14%2C170%5D%2C%5B7%2C68%2C15%2C165%5D%2C%5B6%2C72%2C16%2C160%5D%2C%5B5%2C76%2C16%2C155%5D%2C%5B4%2C79%2C17%2C150%5D%2C%5B3%2C83%2C18%2C145%5D%2C%5B2%2C87%2C19%2C140%5D%2C%5B1%2C91%2C20%2C135%5D%5D%2C%22Raster%22%3A%7B%22rasterFunction%22%3A%22Remap%22%2C%22rasterFunctionArguments%22%3A%7B%22InputRanges%22%3A%5B-5223%2C-5170.27%2C-5170.27%2C-5117.54%2C-5117.54%2C-5064.81%2C-5064.81%2C-5012.08%2C-5012.08%2C-4959.35%2C-4959.35%2C-4906.62%2C-4906.62%2C-4853.89%2C-4853.89%2C-4801.16%2C-4801.16%2C-4748.43%2C-4748.43%2C-4695.7%2C-4695.7%2C-4642.97%2C-4642.97%2C-4590.24%2C-4590.24%2C-4537.51%2C-4537.51%2C-4484.78%2C-4484.78%2C-4432.05%2C-4432.05%2C-4379.32%2C-4379.32%2C-4326.59%2C-4326.59%2C-4273.86%2C-4273.86%2C-4221.13%2C-4221.13%2C-4168.4%2C-4168.4%2C-4115.67%2C-4115.67%2C-4062.94%2C-4062.94%2C-4010.21%2C-4010.21%2C-3957.48%2C-3957.48%2C-3904.75%2C-3904.75%2C-3852.02%2C-3852.02%2C-3799.29%2C-3799.29%2C-3746.56%2C-3746.56%2C-3693.83%2C-3693.83%2C-3641.1%2C-3641.1%2C-3588.37%2C-3588.37%2C-3535.64%2C-3535.64%2C-3482.91%2C-3482.91%2C-3430.18%2C-3430.18%2C-3377.45%2C-3377.45%2C-3324.72%2C-3324.72%2C-3271.99%2C-3271.99%2C-3219.26%2C-3219.26%2C-3166.53%2C-3166.53%2C-3113.8%2C-3113.8%2C-3061.07%2C-3061.07%2C-3008.34%2C-3008.34%2C-2955.61%2C-2955.61%2C-2902.88%2C-2902.88%2C-2850.15%2C-2850.15%2C-2797.42%2C-2797.42%2C-2744.69%2C-2744.69%2C-2691.96%2C-2691.96%2C-2639.23%2C-2639.23%2C-2586.5%2C-2586.5%2C-2533.77%2C-2533.77%2C-2481.04%2C-2481.04%2C-2428.31%2C-2428.31%2C-2375.58%2C-2375.58%2C-2322.85%2C-2322.85%2C-2270.12%2C-2270.12%2C-2217.39%2C-2217.39%2C-2164.66%2C-2164.66%2C-2111.93%2C-2111.93%2C-2059.2%2C-2059.2%2C-2006.47%2C-2006.47%2C-1953.74%2C-1953.74%2C-1901.01%2C-1901.01%2C-1848.28%2C-1848.28%2C-1795.55%2C-1795.55%2C-1742.82%2C-1742.82%2C-1690.09%2C-1690.09%2C-1637.36%2C-1637.36%2C-1584.63%2C-1584.63%2C-1531.9%2C-1531.9%2C-1479.17%2C-1479.17%2C-1426.44%2C-1426.44%2C-1373.71%2C-1373.71%2C-1320.98%2C-1320.98%2C-1268.25%2C-1268.25%2C-1215.52%2C-1215.52%2C-1162.79%2C-1162.79%2C-1110.06%2C-1110.06%2C-1057.33%2C-1057.33%2C-1004.6%2C-1004.6%2C-951.87%2C-951.87%2C-899.14%2C-899.14%2C-846.41%2C-846.41%2C-793.68%2C-793.68%2C-740.95%2C-740.95%2C-688.22%2C-688.22%2C-635.49%2C-635.49%2C-582.76%2C-582.76%2C-530.03%2C-530.03%2C-477.3%2C-477.3%2C-424.57%2C-424.57%2C-371.84%2C-371.84%2C-319.11%2C-319.11%2C-266.38%2C-266.38%2C-213.65%2C-213.65%2C-160.92%2C-160.92%2C-108.19%2C-108.19%2C-55.46%2C-55.46%2C-2.73%2C-2.73%2C50%5D%2C%22OutputValues%22%3A

@patrickarlt
Copy link
Contributor

@dodriscoll it looks like your rendering renderingRule is invalid. It simply ends with "OutputValues": which is not a valid JSON object. The other thing to do would be to try adding f:json to your ImageMapLayer to enable to fallover to POST for longer URLs by default ImageMapLayer always uses GET to request the image directly although I think I'll change this in the next version since we did it for DymanicMapLayer recently.

@patrickarlt
Copy link
Contributor

@dodriscoll this will also dump all the request params to the console so you can copy/paste them here.

layer.on('requeststart', function(e){
  console.log(JSON.stringify(e.params));
});

@dodriscoll
Copy link
Author

Thanks for coming back to me, I'll look into the suggestions here now and see if anything jumps out. I've pasted my code for setting up the map document below. I'm not sure if there's anything wrong with the renderingrule as it works fine internally. I tried the f:json yesterday but it didn't work, I'll look into it again though as maybe the error message will give me more information on whats happening.

var map = L.map('map', {
    layersControl: true 
}).setView([52, -9], 5);
map.attributionControl.addAttribution("&copy; <a href=http://www.infomar.ie>INFOMAR Project</a>");


var OrangeGreenBlue = [
[100, 253, 107, 0],
[99, 252, 111, 0],
[98, 252, 115, 0],
[97, 252, 120, 0],
[96, 251, 124, 0],
[95, 251, 129, 0],
[94, 251, 133, 0],
[93, 250, 137, 0],
[92, 250, 142, 0],
[91, 250, 146, 0],
[90, 249, 151, 0],
[89, 249, 155, 0],
[88, 249, 159, 0],
[87, 248, 164, 0],
[86, 248, 168, 0],
[85, 248, 173, 0],
[84, 247, 177, 0],
[83, 247, 181, 0],
[82, 247, 186, 0],
[81, 246, 190, 0],
[80, 246, 195, 0],
[79, 246, 199, 0],
[78, 245, 203, 0],
[77, 245, 208, 0],
[76, 245, 212, 0],
[75, 245, 217, 1],
[74, 235, 218, 5],
[73, 226, 219, 10],
[72, 217, 220, 15],
[71, 208, 221, 19],
[70, 199, 222, 24],
[69, 190, 223, 29],
[68, 181, 224, 33],
[67, 172, 225, 38],
[66, 163, 226, 43],
[65, 154, 227, 47],
[64, 145, 228, 52],
[63, 136, 229, 57],
[62, 126, 231, 61],
[61, 117, 232, 66],
[60, 108, 233, 71],
[59, 99, 234, 75],
[58, 90, 235, 80],
[57, 81, 236, 85],
[56, 72, 237, 89],
[55, 63, 238, 94],
[54, 54, 239, 99],
[53, 45, 240, 103],
[52, 36, 241, 108],
[51, 27, 242, 113],
[50, 18, 244, 118],
[49, 17, 234, 123],
[48, 16, 224, 128],
[47, 15, 214, 134],
[46, 15, 204, 139],
[45, 14, 195, 145],
[44, 13, 185, 150],
[43, 12, 175, 156],
[42, 12, 165, 161],
[41, 11, 156, 167],
[40, 10, 146, 172],
[39, 10, 136, 178],
[38, 9, 126, 183],
[37, 8, 117, 189],
[36, 7, 107, 194],
[35, 7, 97, 200],
[34, 6, 87, 205],
[33, 5, 78, 211],
[32, 5, 68, 216],
[31, 4, 58, 222],
[30, 3, 48, 227],
[29, 2, 39, 233],
[28, 2, 29, 238],
[27, 1, 19, 244],
[26, 0, 9, 249],
[25, 0, 0, 255],
[24, 3, 0, 250],
[23, 7, 1, 245],
[22, 11, 2, 240],
[21, 15, 3, 235],
[20, 19, 4, 230],
[19, 22, 5, 225],
[18, 26, 5, 220],
[17, 30, 6, 215],
[16, 34, 7, 210],
[15, 38, 8, 205],
[14, 41, 9, 200],
[13, 45, 10, 195],
[12, 49, 11, 190],
[11, 53, 11, 185],
[10, 57, 12, 180],
[9, 60, 13, 175],
[8, 64, 14, 170],
[7, 68, 15, 165],
[6, 72, 16, 160],
[5, 76, 16, 155],
[4, 79, 17, 150],
[3, 83, 18, 145],
[2, 87, 19, 140],
[1, 91, 20, 135]
];

var outValues = [];
for (var i = 1; i < 101; i++) {
    outValues.push(
        i
    );
}

var inpRange = [];
var maxDepth = -5223;
var minDepth = 50;
var interval = (maxDepth - minDepth) / 100;

inpRange.push(
 Math.round((maxDepth + 0.000001) * 1000)/1000
  );
for (var i = 1; i < 100; i++) {
    inpRange.push(
         Math.round(((maxDepth - (interval * i)) + 0.000001) * 1000)/1000,Math.round(((maxDepth - (interval * i)) + 0.000001) * 1000)/1000
     );
}
inpRange.push(
 Math.round((minDepth + 0.000001) * 1000)/1000
);

var colourRendering = {
    "rasterFunction": "Colormap",
    "rasterFunctionArguments": {
        "Colormap": OrangeGreenBlue,
        "Raster": {
            "rasterFunction": "Remap",
            "rasterFunctionArguments": {
                "InputRanges": inpRange,
                "OutputValues": outValues,
                "Raster": "$$"
            },
           "outputPixelType": "U8"
        },
    },
    "outputPixelType": "U8"
};


var renderingRule = {
    "rasterFunction": "Hillshade",
    "rasterFunctionArguments": {
        "Azimuth": 315.0,
        "Altitude": 45.0,
        "ZFactor": 1 * (15)
    },
    "variableName": "DEM"
};

var InfomarURL = "http://my_server/arcgis/rest/services/Infomar/All_BathySurveys/ImageServer"

var Bathy = L.esri.imageMapLayer(InfomarURL, {
 renderingRule: colourRendering,
   opacity: 0.75,
     zIndex: 5,
}).addTo(map);

console.log(Bathy)

var BathyShaded = L.esri.imageMapLayer(InfomarURL, {
    renderingRule: renderingRule,
    zIndex: 1
}).addTo(map);

@dodriscoll
Copy link
Author

In relation to the service call, I'm just copying it here again as it is truncated in the above post but I must have just missed part of it when copying/pasting. Below is the full call which includes Output values also:
http://my_server/arcgis/rest/services/Infomar/All_BathySurveys/ImageServer/exportImage?bbox=-4525072.0744824335%2C5513249.976153191%2C2519364.452279409%2C8091318.066155617&size=1440%2C527&format=jpgpng&transparent=true&bboxSR=3857&imageSR=3857&renderingRule=%7B%22rasterFunction%22%3A%22Colormap%22%2C%22rasterFunctionArguments%22%3A%7B%22Colormap%22%3A%5B%5B100%2C253%2C107%2C0%5D%2C%5B99%2C252%2C111%2C0%5D%2C%5B98%2C252%2C115%2C0%5D%2C%5B97%2C252%2C120%2C0%5D%2C%5B96%2C251%2C124%2C0%5D%2C%5B95%2C251%2C129%2C0%5D%2C%5B94%2C251%2C133%2C0%5D%2C%5B93%2C250%2C137%2C0%5D%2C%5B92%2C250%2C142%2C0%5D%2C%5B91%2C250%2C146%2C0%5D%2C%5B90%2C249%2C151%2C0%5D%2C%5B89%2C249%2C155%2C0%5D%2C%5B88%2C249%2C159%2C0%5D%2C%5B87%2C248%2C164%2C0%5D%2C%5B86%2C248%2C168%2C0%5D%2C%5B85%2C248%2C173%2C0%5D%2C%5B84%2C247%2C177%2C0%5D%2C%5B83%2C247%2C181%2C0%5D%2C%5B82%2C247%2C186%2C0%5D%2C%5B81%2C246%2C190%2C0%5D%2C%5B80%2C246%2C195%2C0%5D%2C%5B79%2C246%2C199%2C0%5D%2C%5B78%2C245%2C203%2C0%5D%2C%5B77%2C245%2C208%2C0%5D%2C%5B76%2C245%2C212%2C0%5D%2C%5B75%2C245%2C217%2C1%5D%2C%5B74%2C235%2C218%2C5%5D%2C%5B73%2C226%2C219%2C10%5D%2C%5B72%2C217%2C220%2C15%5D%2C%5B71%2C208%2C221%2C19%5D%2C%5B70%2C199%2C222%2C24%5D%2C%5B69%2C190%2C223%2C29%5D%2C%5B68%2C181%2C224%2C33%5D%2C%5B67%2C172%2C225%2C38%5D%2C%5B66%2C163%2C226%2C43%5D%2C%5B65%2C154%2C227%2C47%5D%2C%5B64%2C145%2C228%2C52%5D%2C%5B63%2C136%2C229%2C57%5D%2C%5B62%2C126%2C231%2C61%5D%2C%5B61%2C117%2C232%2C66%5D%2C%5B60%2C108%2C233%2C71%5D%2C%5B59%2C99%2C234%2C75%5D%2C%5B58%2C90%2C235%2C80%5D%2C%5B57%2C81%2C236%2C85%5D%2C%5B56%2C72%2C237%2C89%5D%2C%5B55%2C63%2C238%2C94%5D%2C%5B54%2C54%2C239%2C99%5D%2C%5B53%2C45%2C240%2C103%5D%2C%5B52%2C36%2C241%2C108%5D%2C%5B51%2C27%2C242%2C113%5D%2C%5B50%2C18%2C244%2C118%5D%2C%5B49%2C17%2C234%2C123%5D%2C%5B48%2C16%2C224%2C128%5D%2C%5B47%2C15%2C214%2C134%5D%2C%5B46%2C15%2C204%2C139%5D%2C%5B45%2C14%2C195%2C145%5D%2C%5B44%2C13%2C185%2C150%5D%2C%5B43%2C12%2C175%2C156%5D%2C%5B42%2C12%2C165%2C161%5D%2C%5B41%2C11%2C156%2C167%5D%2C%5B40%2C10%2C146%2C172%5D%2C%5B39%2C10%2C136%2C178%5D%2C%5B38%2C9%2C126%2C183%5D%2C%5B37%2C8%2C117%2C189%5D%2C%5B36%2C7%2C107%2C194%5D%2C%5B35%2C7%2C97%2C200%5D%2C%5B34%2C6%2C87%2C205%5D%2C%5B33%2C5%2C78%2C211%5D%2C%5B32%2C5%2C68%2C216%5D%2C%5B31%2C4%2C58%2C222%5D%2C%5B30%2C3%2C48%2C227%5D%2C%5B29%2C2%2C39%2C233%5D%2C%5B28%2C2%2C29%2C238%5D%2C%5B27%2C1%2C19%2C244%5D%2C%5B26%2C0%2C9%2C249%5D%2C%5B25%2C0%2C0%2C255%5D%2C%5B24%2C3%2C0%2C250%5D%2C%5B23%2C7%2C1%2C245%5D%2C%5B22%2C11%2C2%2C240%5D%2C%5B21%2C15%2C3%2C235%5D%2C%5B20%2C19%2C4%2C230%5D%2C%5B19%2C22%2C5%2C225%5D%2C%5B18%2C26%2C5%2C220%5D%2C%5B17%2C30%2C6%2C215%5D%2C%5B16%2C34%2C7%2C210%5D%2C%5B15%2C38%2C8%2C205%5D%2C%5B14%2C41%2C9%2C200%5D%2C%5B13%2C45%2C10%2C195%5D%2C%5B12%2C49%2C11%2C190%5D%2C%5B11%2C53%2C11%2C185%5D%2C%5B10%2C57%2C12%2C180%5D%2C%5B9%2C60%2C13%2C175%5D%2C%5B8%2C64%2C14%2C170%5D%2C%5B7%2C68%2C15%2C165%5D%2C%5B6%2C72%2C16%2C160%5D%2C%5B5%2C76%2C16%2C155%5D%2C%5B4%2C79%2C17%2C150%5D%2C%5B3%2C83%2C18%2C145%5D%2C%5B2%2C87%2C19%2C140%5D%2C%5B1%2C91%2C20%2C135%5D%5D%2C%22Raster%22%3A%7B%22rasterFunction%22%3A%22Remap%22%2C%22rasterFunctionArguments%22%3A%7B%22InputRanges%22%3A%5B-5223%2C-5170%2C-5170%2C-5118%2C-5118%2C-5065%2C-5065%2C-5012%2C-5012%2C-4959%2C-4959%2C-4907%2C-4907%2C-4854%2C-4854%2C-4801%2C-4801%2C-4748%2C-4748%2C-4696%2C-4696%2C-4643%2C-4643%2C-4590%2C-4590%2C-4538%2C-4538%2C-4485%2C-4485%2C-4432%2C-4432%2C-4379%2C-4379%2C-4327%2C-4327%2C-4274%2C-4274%2C-4221%2C-4221%2C-4168%2C-4168%2C-4116%2C-4116%2C-4063%2C-4063%2C-4010%2C-4010%2C-3957%2C-3957%2C-3905%2C-3905%2C-3852%2C-3852%2C-3799%2C-3799%2C-3747%2C-3747%2C-3694%2C-3694%2C-3641%2C-3641%2C-3588%2C-3588%2C-3536%2C-3536%2C-3483%2C-3483%2C-3430%2C-3430%2C-3377%2C-3377%2C-3325%2C-3325%2C-3272%2C-3272%2C-3219%2C-3219%2C-3167%2C-3167%2C-3114%2C-3114%2C-3061%2C-3061%2C-3008%2C-3008%2C-2956%2C-2956%2C-2903%2C-2903%2C-2850%2C-2850%2C-2797%2C-2797%2C-2745%2C-2745%2C-2692%2C-2692%2C-2639%2C-2639%2C-2586%2C-2586%2C-2534%2C-2534%2C-2481%2C-2481%2C-2428%2C-2428%2C-2376%2C-2376%2C-2323%2C-2323%2C-2270%2C-2270%2C-2217%2C-2217%2C-2165%2C-2165%2C-2112%2C-2112%2C-2059%2C-2059%2C-2006%2C-2006%2C-1954%2C-1954%2C-1901%2C-1901%2C-1848%2C-1848%2C-1796%2C-1796%2C-1743%2C-1743%2C-1690%2C-1690%2C-1637%2C-1637%2C-1585%2C-1585%2C-1532%2C-1532%2C-1479%2C-1479%2C-1426%2C-1426%2C-1374%2C-1374%2C-1321%2C-1321%2C-1268%2C-1268%2C-1216%2C-1216%2C-1163%2C-1163%2C-1110%2C-1110%2C-1057%2C-1057%2C-1005%2C-1005%2C-952%2C-952%2C-899%2C-899%2C-846%2C-846%2C-794%2C-794%2C-741%2C-741%2C-688%2C-688%2C-635%2C-635%2C-583%2C-583%2C-530%2C-530%2C-477%2C-477%2C-425%2C-425%2C-372%2C-372%2C-319%2C-319%2C-266%2C-266%2C-214%2C-214%2C-161%2C-161%2C-108%2C-108%2C-55%2C-55%2C-3%2C-3%2C50%5D%2C%22OutputValues%22%3A%5B1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%2C44%2C45%2C46%2C47%2C48%2C49%2C50%2C51%2C52%2C53%2C54%2C55%2C56%2C57%2C58%2C59%2C60%2C61%2C62%2C63%2C64%2C65%2C66%2C67%2C68%2C69%2C70%2C71%2C72%2C73%2C74%2C75%2C76%2C77%2C78%2C79%2C80%2C81%2C82%2C83%2C84%2C85%2C86%2C87%2C88%2C89%2C90%2C91%2C92%2C93%2C94%2C95%2C96%2C97%2C98%2C99%2C100%5D%2C%22Raster%22%3A%22%24%24%22%7D%2C%22outputPixelType%22%3A%22U8%22%7D%7D%2C%22outputPixelType%22%3A%22U8%22%7D&f=image"

@jgravois
Copy link
Contributor

jgravois commented Jul 8, 2015

@patrickarlt looks like the f parameter is defined for DynamicMapLayer but not ImageMapLayer.

https://github.com/Esri/esri-leaflet/blob/master/src/Layers/ImageMapLayer.js

@dodriscoll
Copy link
Author

I defined f: for the ImageMapLayer with:

var Bathy = L.esri.imageMapLayer(serviceURL, {
renderingRule: colourRendering,
    f: 'json',
    zIndex: 5,
    opacity: 0.75
}).addTo(map);

Still can't find the resource.

I'm just wondering as we have our services hosted internally and use the ArcServer web adapter to push them out onto the web, would that cause an issue with CORS? do we need to specifically enable CORS in the web adapter?

@patrickarlt
Copy link
Contributor

@dodriscoll I still don't really know. I swapped in another service for the placeholder you provided and it still doesn't work http://jsbin.com/napisekuwa/edit?html,output. I expect that something in that massive request is just causing the server to freak out and it responded with a 404.

@tomwayson what do you think? You have much more experiance with Image Services then me or @jgravois.

{
   "rasterFunction":"Colormap",
   "rasterFunctionArguments":{
      "Colormap":[
         [
            100,
            253,
            107,
            0
         ],
         [
            99,
            252,
            111,
            0
         ],
         [
            98,
            252,
            115,
            0
         ],
         [
            97,
            252,
            120,
            0
         ],
         [
            96,
            251,
            124,
            0
         ],
         [
            95,
            251,
            129,
            0
         ],
         [
            94,
            251,
            133,
            0
         ],
         [
            93,
            250,
            137,
            0
         ],
         [
            92,
            250,
            142,
            0
         ],
         [
            91,
            250,
            146,
            0
         ],
         [
            90,
            249,
            151,
            0
         ],
         [
            89,
            249,
            155,
            0
         ],
         [
            88,
            249,
            159,
            0
         ],
         [
            87,
            248,
            164,
            0
         ],
         [
            86,
            248,
            168,
            0
         ],
         [
            85,
            248,
            173,
            0
         ],
         [
            84,
            247,
            177,
            0
         ],
         [
            83,
            247,
            181,
            0
         ],
         [
            82,
            247,
            186,
            0
         ],
         [
            81,
            246,
            190,
            0
         ],
         [
            80,
            246,
            195,
            0
         ],
         [
            79,
            246,
            199,
            0
         ],
         [
            78,
            245,
            203,
            0
         ],
         [
            77,
            245,
            208,
            0
         ],
         [
            76,
            245,
            212,
            0
         ],
         [
            75,
            245,
            217,
            1
         ],
         [
            74,
            235,
            218,
            5
         ],
         [
            73,
            226,
            219,
            10
         ],
         [
            72,
            217,
            220,
            15
         ],
         [
            71,
            208,
            221,
            19
         ],
         [
            70,
            199,
            222,
            24
         ],
         [
            69,
            190,
            223,
            29
         ],
         [
            68,
            181,
            224,
            33
         ],
         [
            67,
            172,
            225,
            38
         ],
         [
            66,
            163,
            226,
            43
         ],
         [
            65,
            154,
            227,
            47
         ],
         [
            64,
            145,
            228,
            52
         ],
         [
            63,
            136,
            229,
            57
         ],
         [
            62,
            126,
            231,
            61
         ],
         [
            61,
            117,
            232,
            66
         ],
         [
            60,
            108,
            233,
            71
         ],
         [
            59,
            99,
            234,
            75
         ],
         [
            58,
            90,
            235,
            80
         ],
         [
            57,
            81,
            236,
            85
         ],
         [
            56,
            72,
            237,
            89
         ],
         [
            55,
            63,
            238,
            94
         ],
         [
            54,
            54,
            239,
            99
         ],
         [
            53,
            45,
            240,
            103
         ],
         [
            52,
            36,
            241,
            108
         ],
         [
            51,
            27,
            242,
            113
         ],
         [
            50,
            18,
            244,
            118
         ],
         [
            49,
            17,
            234,
            123
         ],
         [
            48,
            16,
            224,
            128
         ],
         [
            47,
            15,
            214,
            134
         ],
         [
            46,
            15,
            204,
            139
         ],
         [
            45,
            14,
            195,
            145
         ],
         [
            44,
            13,
            185,
            150
         ],
         [
            43,
            12,
            175,
            156
         ],
         [
            42,
            12,
            165,
            161
         ],
         [
            41,
            11,
            156,
            167
         ],
         [
            40,
            10,
            146,
            172
         ],
         [
            39,
            10,
            136,
            178
         ],
         [
            38,
            9,
            126,
            183
         ],
         [
            37,
            8,
            117,
            189
         ],
         [
            36,
            7,
            107,
            194
         ],
         [
            35,
            7,
            97,
            200
         ],
         [
            34,
            6,
            87,
            205
         ],
         [
            33,
            5,
            78,
            211
         ],
         [
            32,
            5,
            68,
            216
         ],
         [
            31,
            4,
            58,
            222
         ],
         [
            30,
            3,
            48,
            227
         ],
         [
            29,
            2,
            39,
            233
         ],
         [
            28,
            2,
            29,
            238
         ],
         [
            27,
            1,
            19,
            244
         ],
         [
            26,
            0,
            9,
            249
         ],
         [
            25,
            0,
            0,
            255
         ],
         [
            24,
            3,
            0,
            250
         ],
         [
            23,
            7,
            1,
            245
         ],
         [
            22,
            11,
            2,
            240
         ],
         [
            21,
            15,
            3,
            235
         ],
         [
            20,
            19,
            4,
            230
         ],
         [
            19,
            22,
            5,
            225
         ],
         [
            18,
            26,
            5,
            220
         ],
         [
            17,
            30,
            6,
            215
         ],
         [
            16,
            34,
            7,
            210
         ],
         [
            15,
            38,
            8,
            205
         ],
         [
            14,
            41,
            9,
            200
         ],
         [
            13,
            45,
            10,
            195
         ],
         [
            12,
            49,
            11,
            190
         ],
         [
            11,
            53,
            11,
            185
         ],
         [
            10,
            57,
            12,
            180
         ],
         [
            9,
            60,
            13,
            175
         ],
         [
            8,
            64,
            14,
            170
         ],
         [
            7,
            68,
            15,
            165
         ],
         [
            6,
            72,
            16,
            160
         ],
         [
            5,
            76,
            16,
            155
         ],
         [
            4,
            79,
            17,
            150
         ],
         [
            3,
            83,
            18,
            145
         ],
         [
            2,
            87,
            19,
            140
         ],
         [
            1,
            91,
            20,
            135
         ]
      ],
      "Raster":{
         "rasterFunction":"Remap",
         "rasterFunctionArguments":{
            "InputRanges":[
               -5223,
               -5170.27,
               -5170.27,
               -5117.54,
               -5117.54,
               -5064.81,
               -5064.81,
               -5012.08,
               -5012.08,
               -4959.35,
               -4959.35,
               -4906.62,
               -4906.62,
               -4853.89,
               -4853.89,
               -4801.16,
               -4801.16,
               -4748.43,
               -4748.43,
               -4695.7,
               -4695.7,
               -4642.97,
               -4642.97,
               -4590.24,
               -4590.24,
               -4537.51,
               -4537.51,
               -4484.78,
               -4484.78,
               -4432.05,
               -4432.05,
               -4379.32,
               -4379.32,
               -4326.59,
               -4326.59,
               -4273.86,
               -4273.86,
               -4221.13,
               -4221.13,
               -4168.4,
               -4168.4,
               -4115.67,
               -4115.67,
               -4062.94,
               -4062.94,
               -4010.21,
               -4010.21,
               -3957.48,
               -3957.48,
               -3904.75,
               -3904.75,
               -3852.02,
               -3852.02,
               -3799.29,
               -3799.29,
               -3746.56,
               -3746.56,
               -3693.83,
               -3693.83,
               -3641.1,
               -3641.1,
               -3588.37,
               -3588.37,
               -3535.64,
               -3535.64,
               -3482.91,
               -3482.91,
               -3430.18,
               -3430.18,
               -3377.45,
               -3377.45,
               -3324.72,
               -3324.72,
               -3271.99,
               -3271.99,
               -3219.26,
               -3219.26,
               -3166.53,
               -3166.53,
               -3113.8,
               -3113.8,
               -3061.07,
               -3061.07,
               -3008.34,
               -3008.34,
               -2955.61,
               -2955.61,
               -2902.88,
               -2902.88,
               -2850.15,
               -2850.15,
               -2797.42,
               -2797.42,
               -2744.69,
               -2744.69,
               -2691.96,
               -2691.96,
               -2639.23,
               -2639.23,
               -2586.5,
               -2586.5,
               -2533.77,
               -2533.77,
               -2481.04,
               -2481.04,
               -2428.31,
               -2428.31,
               -2375.58,
               -2375.58,
               -2322.85,
               -2322.85,
               -2270.12,
               -2270.12,
               -2217.39,
               -2217.39,
               -2164.66,
               -2164.66,
               -2111.93,
               -2111.93,
               -2059.2,
               -2059.2,
               -2006.47,
               -2006.47,
               -1953.74,
               -1953.74,
               -1901.01,
               -1901.01,
               -1848.28,
               -1848.28,
               -1795.55,
               -1795.55,
               -1742.82,
               -1742.82,
               -1690.09,
               -1690.09,
               -1637.36,
               -1637.36,
               -1584.63,
               -1584.63,
               -1531.9,
               -1531.9,
               -1479.17,
               -1479.17,
               -1426.44,
               -1426.44,
               -1373.71,
               -1373.71,
               -1320.98,
               -1320.98,
               -1268.25,
               -1268.25,
               -1215.52,
               -1215.52,
               -1162.79,
               -1162.79,
               -1110.06,
               -1110.06,
               -1057.33,
               -1057.33,
               -1004.6,
               -1004.6,
               -951.87,
               -951.87,
               -899.14,
               -899.14,
               -846.41,
               -846.41,
               -793.68,
               -793.68,
               -740.95,
               -740.95,
               -688.22,
               -688.22,
               -635.49,
               -635.49,
               -582.76,
               -582.76,
               -530.03,
               -530.03,
               -477.3,
               -477.3,
               -424.57,
               -424.57,
               -371.84,
               -371.84,
               -319.11,
               -319.11,
               -266.38,
               -266.38,
               -213.65,
               -213.65,
               -160.92,
               -160.92,
               -108.19,
               -108.19,
               -55.46,
               -55.46,
               -2.73,
               -2.73,
               50
            ],
            "OutputValues":[
               1,
               2,
               3,
               4,
               5,
               6,
               7,
               8,
               9,
               10,
               11,
               12,
               13,
               14,
               15,
               16,
               17,
               18,
               19,
               20,
               21,
               22,
               23,
               24,
               25,
               26,
               27,
               28,
               29,
               30,
               31,
               32,
               33,
               34,
               35,
               36,
               37,
               38,
               39,
               40,
               41,
               42,
               43,
               44,
               45,
               46,
               47,
               48,
               49,
               50,
               51,
               52,
               53,
               54,
               55,
               56,
               57,
               58,
               59,
               60,
               61,
               62,
               63,
               64,
               65,
               66,
               67,
               68,
               69,
               70,
               71,
               72,
               73,
               74,
               75,
               76,
               77,
               78,
               79,
               80,
               81,
               82,
               83,
               84,
               85,
               86,
               87,
               88,
               89,
               90,
               91,
               92,
               93,
               94,
               95,
               96,
               97,
               98,
               99,
               100
            ],
            "Raster":"$$"
         },
         "outputPixelType":"U8"
      }
   },
   "outputPixelType":"U8"
}

@patrickarlt
Copy link
Contributor

@dodriscoll ok I figured it out. L.esri.imageMapLayer and L.esri.DynamicMapLayer never got updated to use request to automatically switch between GET and POST while using f:json. Furthermore L.esri.imageMapLayer still requests an image by default rather then a JSON payload.

If your service supports CORS (test it with the above sample) then your sample should work when I release the next version of Esri Leaflet later this week. If it doesn't support CORS then you will need to setup an instance of https://github.com/Esri/resource-proxy and pass the proxy option to your layers in Esri Leaflet.

@patrickarlt patrickarlt added the Bug label Jul 8, 2015
@dodriscoll
Copy link
Author

Great that would be brilliant thanks, I'm away next week so will test it when I come back and let you know. Thanks

@dodriscoll
Copy link
Author

Hi There,
I've tested this with the ESRI_Leaflet 1.0.0 release and it worked great, I could see the request for my layer with very long url was transmitted as a POST rather then GET.

I've just been testing out the new Leaflet-1.0.0 and ESRI-leaflet-v2.0.0-beta.3 and the issue is coming up again? If it is something I need to change in my code apologies I'll have another look I just wanted to check first if the fix was added to the ESRI-leaflet-v2.0.0-beta.3 release or not?

Thanks for your help.

@dodriscoll
Copy link
Author

Hi There,
Just wondering do I need to open a new call for this? I've tested with the ESRI-leaflet-v2.0.0-beta.5 and the issue is still there. The code is still using the GET to request my image service and the url is too long for the GET.

Thanks and regards

@jgravois
Copy link
Contributor

jgravois commented Aug 5, 2015

I'll take a look at this soon and let you know what I find.

@dodriscoll
Copy link
Author

Sorry I only needed to change the call for the imagemaplayer from GET to REQUEST in the code and I've done this. The issue is still there for you're own reference but it's working ok for me now as I only needed the change to request an imagemaplayer.

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants