In my scenario, Arcgis map server is need to log in by use token as the query parameter to access.
My graphic layer is contain the overlapping polyline on the street,
then the demand is when user click the colored-polyline, while user doesn't know about where is overlapping,
if there is, we'll show all the map object over the click map point.
While I use the graphiclayer.on("click") function, it only could get the top object on the map.
The under object overlapped by top object won't be choosed.
Then I found "IdentifyTask" could search by location.
by in my use, the line below will report a error call "Cannot read property 'path' of undefined".
the problem on the IdentifyTask.js be liked:
constructor: function(d, a) {
this._url.path += "/identify"; //←the _url is null in "this"
this._handler = e.hitch(this, this._handler);
this.gdbVersion = a && a.gdbVersion;
this.registerConnectEvents()
},
should it be any wrong?
or in my case, how can I select all the object overlapping on same map point,
thanks for advanced.
Is this question about 4.x or 3.x API?
When attempting to use the IdentifyTask are you giving it a map service url like below (i.e. no specific layer id in the url)?
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer
Hello!
Excuse, it's on API 3.24 version.
And the url is like that right without the layer id, I also use the sampleserver url to test,and it's failed.
My code is put on the graphiclayers.on("click", function( ){ }) function block.
Then I found that map service I use is not support the identifyTask query.. so it may have to try another solution!
The identifyTask is only for a whole map service and not a individual layer of a map service.
Wow! Thanks so much.
So would you have any idea to solve the overlapping object in same layer?
I have an idea about create a small cricle buffer where mouse click, then get the extent to put on query.geometry to query again by querytask.
I have an idea about create a small circle buffer where mouse click, then get the extent to put on query.geometry to query again by querytask.
This is the right path. I normally use a extent instead though. I have a helper function I use all the time for this to convert the point to an extent based on a specified number of screen pixels (not map units).
function pointToExtent(objPoint, pixels, map){
var clickOffset = pixels || 6;
var scrnPnt = map.toScreen(objPoint);
scrnPnt.update(scrnPnt.x + clickOffset, scrnPnt.y + clickOffset);
var nPnt = map.toMap(scrnPnt);
var queryExtent = new Extent(
Math.min(objPoint.x, nPnt.x),
Math.min(objPoint.y, nPnt.y),
Math.max(objPoint.x, nPnt.x),
Math.max(objPoint.y, nPnt.y),
objPoint.spatialReference);
return queryExtent.centerAt(objPoint);
}
Then I use the extent for the query geometry.
It's really awesome. I feel confidence to fill my work.
May I ask what the parameters do you send into this function?
I think the 'map' could be an Arcgis Map Object, then I guess 'pixels' was the screen point catch from mouse click event.
But I'm confused at which values should I got from the clicked object.
Let me confirm your function with you, it is fired when user click on the symbol object, then the function return the extent to ready for querytask method.
Thank you for your kindness and patience.
Chia-Jui Liu,
The pixel parameter is the number of screen pixels to add to the point when converting it to an extent (you should notice from the code that 6 is the default if nothing is specified). Map is a map object class, and objPoint is a point object class that you are wanting to convert to an extent (i.e the clicked point in your case).