Select to view content in your preferred language

proxy page does not return binary image but returning arcgis server url

1562
9
10-06-2011 03:03 PM
Vincent_ZFan
Emerging Contributor
javascript api proxy page does not return binary image but returning arcgis server url

I am using proxy page as it discribed in the online reference. All of the proxy works
except using FeatureLayer.setLayerDefinitions(layerDefintions).

But it works when calling FeatureLayer.setDefaultLayerDefinitions()

Any idea?
0 Kudos
9 Replies
derekswingley1
Deactivated User
Why are you expecting the server to return an image for a featureLayer? FeatureLayer's are a subclass of graphicsLayer and display vector features.

Can you post an example of what you're passing to setDefinitionExpression()?
0 Kudos
Vincent_ZFan
Emerging Contributor
Hi Derek,

Sorry, I did not say it clear, it is actaully a feature layer in ArcGISDynamicMapServiceLayer.
the setDefinitionExpression is or alike:
SEIS_LINE_ID in ('1311130936','1311161037','1311161036','1311132353','1311132354','1311132355','1311130937','1311130939','1311130938')

I have required all the requests using proxy as showing below.

It works with a very short layer definition but does not
work when a long layer definitions are submitted. The short one
is not more than 2048 characters which is Get request limit - 2048 character maximum
(http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/ags_proxy.htm).
But this should not be a reason for not working for a longer layer definitions because
all requests are required to go through proxy page as my code required as shown below.
       esri.config.defaults.io.proxyUrl = "/xxxxxxxx/map-proxy";  //it is a working proxy
       esri.config.defaults.io.alwaysUseProxy = true;

I am using JavaScript API 2.4 hosted by ESRI.
0 Kudos
Vincent_ZFan
Emerging Contributor
Here is the infomation in POST with FireBug/Net tab
You can see the LONG layer defintion there - I have deleted some of the layer definitions because it
is over the limit of this Forum's post character limit.
--------------------------------------
Parametersapplication/x-www-form-urlencoded
bbox -13434060.471454013,6502439.7425909685,-12406675.208245985,7611673.7723090295
bboxSR 102113
dpi 96
f json
format png8
imageSR 102113
layerDefs (Very Large Data)
layers show:2,4,6,8,12,20
size 841,908
transparent true
Source
dpi=96&transparent=true&format=png8&layers=show%3A2%2C4%2C6%2C8%2C12%2C20&bbox=-13434060.471454013%2C6502439.7425909685%2C-12406675.208245985%2C7611673.7723090295&bboxSR=102113&imageSR=102113&size=841%2C908&f=json&layerDefs=2%3ASEIS_LINE_ID%20in%20('1311121940'%2C'5000001920'%2C'1311183645'%2C'1311122665'%2C'1311167745'%2C'1311167153'%2C'1311146281'%2C'1311096625'%2C'1311096647'%2C'1311096624'%2C'1311096648'%2C'1311132253'%2C'1311088842'%2C'1311090637'%2C'1311088837'%2C'1311097239'%2C'1311088841'%2C'1311088844'%2C'1311088843'%2C'1311088840'%2C'1311088839'%2C'1311088838'%2C'1311088836'%2C'1311114028'%2C'1311090639'%2C'1311090646'%2C'1311090643'%2C'1311090642'%2C'1311090647'%2C'1311090638'%2C'1311090635'%2C'1311173032'%2C'1311116597'%2C'1311116596'%2C'1311123576'%2C'1311123577'%2C'1311167157'%2C'1311149343'%2C'1311168341'%2C'1311132104'%2C'1311150207'%2C'1311164314'%2C'1311140191'%2C'1311140960'%2C'1311140986'%2C'1311095478'%2C'1311095476'%2C'1311095477'%2C'1311095475'%2C'1311095474'%2C'1311095463'%2C'1311095464'%2C'1311095473'%2C'1311132257'%2C'1311185160'%2C'1311095438'%2C'1311095027'%2C'1311096182'%2C'1311096184'%2C'1311096187'%2C'1311096188'%2C'1311096186'%2C'1311096192'%2C'1311096185'%2C'1311096756'%2C'1311096755'%2C'1311096757'%2C'1311073095'%2C'1311073093'%2C'1311073094'%2C'1311073092'%2C'1311160489'%2C'1311132256'%2C'1311132254'%2C'1311090645'%2C'1311090644'%2C'1311090636'%2C'1311094441'%2C'1311082269'%2C'1311082275'%2C'1311082274'%2C'1311087163'%2C'1311090640'%2C'1311186227'%2C'1311163710'%2C'1311163564'%2C'1311138658'%2C'1311138121'%2C'1311138657'%2C'1311138556'%2C'1311138572'%2C'1311161937'%2C'1311161904'%2C'1311161938'%2C'1311161901'%2C'1311184388'%2C'1311137103'%2C'1311137105'%2C'1311137956'%2C'1311137361'%2C'1311137374'%2C'1311138545'%2C'1311137948'%2C'1311137955'%2C'1311137489'%2C'1311137876'%2C'1311159312'%2C'1311169260'%2C'1311169257'%2C'1311159518'%2C'1311184387'%2C'1311168127'%2C'1311130474'%2C'1311130476'%2C'1311130492'%2C'1311130993'%2C'1311130984'%2C'1311130978'%2C'1311130473'%2C'1311159307'%2C'1311130488'%2C'1311160490'%2C'1311132255'%2C'5000002024'%2C'5000002023'%2C'5000002022'%2C'5000002021'%2C'5000001960'%2C'5000001959'%2C'5000001958'%2C'5000002020'%2C'5000002019'%2C'5000002018'%2C'5000002017'%2C'5000001956'%2C'5000001954'%2C'5000002016'%2C'5000002015'%2C'5000002014'%2C'5000002013'%2C'5000001952'%2C'5000001950'%2C'5000001957'%2C'5000002012'%2C'5000002011'%2C'5000002010'%2C'5000002009'%2C'5000001948'%2C'5000001946'%2C'5000001955'%2C'5000001953'%2C'5000002008'%2C'5000002007'%2C'5000002006'%2C'5000002005'%2C'5000001943'%2C'5000001942'%2C'5000001951'%2C'5000001949'%2C'5000002004'%2C'5000002003'%2C'5000002002'%2C'5000002001'%2C'5000001940'%2C'5000001939'%2C'5000001947'%2C'5000001945'%2C'5000002000'%2C'5000001999'%2C'5000001998'%2C'5000001997'%2C'5000001938'%2C'5000001937'%2C'5000001935'%2C'5000001944'%2C'5000001936'%2C'5000001932'%2C'5000001996'%2C'5000001995'%2C'5000001994'%2C'5000001993'%2C'5000001934'%2C'5000001933'%2C'5000001931'%2C'5000001941'%2C'5000001992'%2C'5000001991'%2C'5000001990'%2C'5000001989'%2C'5000001988'%2C'5000001987'%2C'5000001986'%2C'5000001985'%2C'5000001984'%2C'5000001983'%2C'5000001982'%2C'5000001981'%2C'5000001980'%2C'5000001979'%2C'5000001978'%2C'5000001977'%2C'5000001976'%2C'5000001975'%2C'5000001974'%2C'5000001973'%2C'5000002034'%2C'5000002033'%2C'5000001972'%2C'5000001971'%2C'5000001970'%2C'5000001969'%2C'5000002032'%2C'5000002031'%2C'5000002030'%2C'5000002029'%2C'5000001968'%2C'5000001967'%2C'5000001966'%2C'5000001965'%2C'5000002028'%2C'5000002027'%2C'5000002026'%2C'5000002025'%2C'5000001964'%2C'5000001963'%2C'5000001962'%2C'5000001961'%2C'1311152657'%2C'1311152656'%2C'1311152658'%2C'1311152198'%2C'1311152199'%2C'1311152200'%2C'1311152201'%2C'1311152202'%2C'1311152203'%2C'1311152204'%2C'1311152205'%2C'1311152206'%2C'1311152214'%2C'1311152215'%2C'1311152216'%2C'1311187081'%2C'1311152207'%2C'1311187080'%2C'1311122542'%2C'1311122854'%2C'1311122677'%2C'1311122849'%2C'1311121594'%2C'1311126269'%2C'1311122862'%2C'1311122429'%2C'1311122428'%2C'1311122766'%2C'1311122561'%2C'1311122560'%2C'1311122559'%2C'1311122558'%2C'1311122557'%2C'1311122556'%2C'1311122555'%2C'1311122554'%2C'1311122553'%2C'1311122552'%2C'1311122551'%2C'1311122548'%2C'1311122546'%2C'1311122545'%2C'1311122544'%2C'1311122543'%2C'1311122541'%2C'1311122540'%2C'1311122539'%2C'1311122416'%2C'1311122841'%2C'1311122840'%2C'1311122839'%2C'1311122838'%2C'1311122836'%2C'1311122835'%2C'1311122834'%2C'1311122832'%2C'1311122831'%2C'1311122830'%2C'1311122626'%2C'1311122767'%2C'1311122855'%2C'1311122853'%2C'1311122852'%2C'1311122850'%2C'1311122848'%2C'1311122928'%2C'1311122861'%2C'1311122860'%2C'1311122859'%2C'1311122858'%2C'1311122857'%2C'1311122856'%2C'1311122697'%2C'1311121575'%2C'1311121574'%2C'1311121573'%2C'1311121572'%2C'1311121571'%2C'1311121570'%2C'1311121569'%2C'1311121568'%2C'1311121566'%2C'1311121565'%2C'1311121563'%2C'1311121562'%2C'1311121561'%2C'1311121560'%2C'1311122427'%2C'1311122426'%2C'1311122425'%2C'1311122424'%2C'1311122423'%2C'1311122421'%2C'1311122420'%2C'1311122419'%2C'1311122417'%2C'1311122415'%2C'13111224 ... Firebug request size limit has been reached by Firebug. ... 5'%2C'1311137948'%2C'1311137955'%2C'1311137489'%2C'1311137876'%2C'1311159312'%2C'1311169260'%2C'1311169257'%2C'1311159518'%2C'1311184387'%2C'1311168127'%2C'1311130474'%2C'1311130476'%2C'1311130492'%2C'1311130993'%2C'1311130984'%2C'1311130978'%2C'1311130473'%2C'1311159307'%2C'1311130488'%2C'1311160490'%2C'1311132255'%2C'5000002024'%2C'5000002023'%2C'5000002022'%2C'5000002021'%2C'5000001960'%2C'5000001959'%2C'5000001958'%2C'5000002020'%2C'5000002019'%2C'5000002018'%2C'5000002017'%2C'5000001956'%2C'5000001954'%2C'5000002016'%2C'5000002015'%2C'5000002014'%2C'5000002013'%2C'5000001952'%2C'5000001950'%2C'5000001957'%2C'5000002012'%2C'5000002011'%2C'5000002010'%2C'5000002009'%2C'5000001948'%2C'5000001946'%2C'5000001955'%2C'5000001953'%2C'5000002008'%2C'5000002007'%2C'5000002006'%2C'5000002005'%2C'5000001943'%2C'5000001942'%2C'5000001951'%2C'5000001949'%2C'5000002004'%2C'5000002003'%2C'5000002002'%2C'5000002001'%2C'5000001940'%2C'5000001939'%2C'5000001947'%2C'5000001945'%2C'5000002000'%2C'5000001999'%2C'5000001998'%2C'5000001997'%2C'5000001938'%2C'5000001937'%2C'5000001935'%2C'5000001944'%2C'5000001936'%2C'5000001932'%2C'5000001996'%2C'5000001995'%2C'5000001994'%2C'5000001993'%2C'5000001934'%2C'5000001933'%2C'5000001931'%2C'5000001941'%2C'5000001992'%2C'5000001991'%2C'5000001990'%2C'5000001989'%2C'5000001988'%2C'5000001987'%2C'5000001986'%2C'5000001985'%2C'5000001984'%2C'5000001983'%2C'5000001982'%2C'5000001981'%2C'5000001980'%2C'5000001979'%2C'5000001978'%2C'5000001977'%2C'5000001976'%2C'5000001975'%2C'5000001974'%2C'5000001973'%2C'5000002034'%2C'5000002033'%2C'5000001972'%2C'5000001971'%2C'5000001970'%2C'5000001969'%2C'5000002032'%2C'5000002031'%2C'5000002030'%2C'5000002029'%2C'5000001968'%2C'5000001967'%2C'5000001966'%2C'5000001965'%2C'5000002028'%2C'5000002027'%2C'5000002026'%2C'5000002025'%2C'5000001964'%2C'5000001963'%2C'5000001962'%2C'5000001961'%2C'1311152657'%2C'1311152656'%2C'1311152658'%2C'1311152198'%2C'1311152199'%2C'1311152200'%2C'1311152201'%2C'1311152202'%2C'1311152203'%2C'1311152204'%2C'1311152205'%2C'1311152206'%2C'1311152214'%2C'1311152215'%2C'1311152216'%2C'1311187081'%2C'1311152207'%2C'1311187080'%2C'1311122542'%2C'1311122854'%2C'1311122677'%2C'1311122849'%2C'1311121594'%2C'1311126269'%2C'1311122862'%2C'1311122429'%2C'1311122428'%2C'1311122766'%2C'1311122561'%2C'1311122560'%2C'1311122559'%2C'1311122558'%2C'1311122557'%2C'1311122556'%2C'1311122555'%2C'1311122554'%2C'1311122553'%2C'1311122552'%2C'1311122551'%2C'1311122548'%2C'1311122546'%2C'1311122545'%2C'1311122544'%2C'1311122543'%2C'1311122541'%2C'1311122540'%2C'1311122539'%2C'1311122416'%2C'1311122841'%2C'1311122840'%2C'1311122839'%2C'1311122838'%2C'1311122836'%2C'1311122835'%2C'1311122834'%2C'1311122832'%2C'1311122831'%2C'1311122830'%2C'1311122626'%2C'1311122767'%2C'1311122855'%2C'1311122853'%2C'1311122852'%2C'1311122850'%2C'1311122848'%2C'1311122928'%2C'1311122861'%2C'1311122860'%2C'1311122859'%2C'1311122858'%2C'1311122857'%2C'1311122856')
0 Kudos
Vincent_ZFan
Emerging Contributor
This is shown under Prams in FireBug/Net
- a SHORT layer definitions.
---------------------------------------------------


ParamsHeadersPostPutResponseCacheHTML
/iglass-editor/map/seismi... 96
bbox -12853870.136710677,7044645.723493148,-12597023.932166185,7321954.110801589
bboxSR 102113
f image
format png8
imageSR 102113
layerDefs 2:SEIS_LINE_ID in ('1311130936','1311161037','1311161036','1311132353','1311132354','1311132355','1311130937','1311130939','1311130938');4:SEIS_LINE_ID in ('1311130936','1311161037','1311161036','1311132353','1311132354','1311132355','1311130937','1311130939','1311130938');6:SEIS_LINE_ID in ('1311130936','1311161037','1311161036','1311132353','1311132354','1311132355','1311130937','1311130939','1311130938');8:SEIS_LINE_ID in ('1311130936','1311161037','1311161036','1311132353','1311132354','1311132355','1311130937','1311130939','1311130938')
layers show:2,4,6,8
size 841,908
transparent true
0 Kudos
Vincent_ZFan
Emerging Contributor
Here is what I found today:
if the layerdefinition is more than 1472 characters, it will have the problem.
But works with the layerdefinition of 1368 length.
0 Kudos
derekswingley1
Deactivated User
Right, it's all about URL length. If the URL is over 2k characters, you have to do a POST. If the app is not on the same domain as the map service, this requires a proxy. Once you go to a proxy, the JS API works with JSON so the map service will return a URL to an image (which the JS API then inserts into the page) rather than the image itself.

Why do you want the image to be returned from the server rather than a URL to the image?
0 Kudos
Vincent_ZFan
Emerging Contributor
Got it!

I can see the image url (in fireBug) passed back from ArcGIS server.
With proxy, user should not see it right?

In our case, the application is in the same domain as the map server.
But we want to use the proxy all the time.

The proxy was set up by other people, I am wonder whether the proxy setup
is right or not, how can I test it out? I did see "404 Not Found" error in Firebug.

Thanks a lot!
0 Kudos
JeffPace
MVP Alum
Got it!

I can see the image url (in fireBug) passed back from ArcGIS server.
With proxy, user should not see it right?

In our case, the application is in the same domain as the map server.
But we want to use the proxy all the time.

The proxy was set up by other people, I am wonder whether the proxy setup
is right or not, how can I test it out? I did see "404 Not Found" error in Firebug.

Thanks a lot!


have you tried

esri.config.defaults.io.alwaysUseProxy = true;
0 Kudos
Vincent_ZFan
Emerging Contributor
have you tried

esri.config.defaults.io.alwaysUseProxy = true;


Yes, Jeff. I did that.
0 Kudos