POST
|
YES! I was comparing graphics instead of comparing geometries. Had to change both feature.geometry and also touchPoint to touchCircle and it worked beautifully. This should resolve my issue. Thanks Thomas!
... View more
10-24-2017
11:14 AM
|
1
|
0
|
1377
|
POST
|
So after some frustrating testing without errors, I think I've realized that the Query functions only work for FeatureLayers that are not client-side -only services on a server- and the graphics I am working with are all stored local inside the source attribute of the FeatureLayer (in my code it's named displayRoutesLayer). So I tried to use the second option of your first post and came up with something like this: var touchCircle = new Circle({
center: event.mapPoint,
radius: 10 * view.extent.width / view.width
});
var touchPoint = new Graphic({
geometry: touchCircle,
symbol: polygonStyle
});
view.graphics.add(touchPoint);
var features = displayRoutesLayer.source.items;
console.log("features", features);
for (i = 0, il = features.length; i < il; i++) {
console.log("comparing:", features[i].attributes.ZIP_CRID);
console.log("intersects:", geometryEngine.intersects(features[i], touchPoint));
} I was trying to use the geometryEngine's intersects() function using each of the polyline graphics and the circle polygon, but its giving me back "Uncaught TypeError: d.getCacheValue is not a function" when it tries to run that. Am I using this the right way? I can't immediately see where the issue is... I like the idea of your rasterized hitTest calls, but I'd prefer to use this intersects function because I may be using it later as I develop the application for improved processes.
... View more
10-24-2017
10:56 AM
|
0
|
2
|
1377
|
POST
|
These both sound like great solutions! I'll do some testing on it tomorrow. Thanks!
... View more
10-23-2017
01:14 PM
|
0
|
0
|
1377
|
POST
|
Hi all, I've just started using the ArcGIS Javascript API over the past month or two and it's been great. Most issues I've managed to solve myself or with the help of this forum but I'm stuck on this one: I'm developing an iPad application for my company that requires users to click on polyline graphics, but it's really difficult for people to do this on the iPad screen because fingers are not mouse pointers, and selecting a precise polyline graphic out of a haystack of them is challenging for some. Is there any way of adjusting how the hitTest function works to look a bit wider for any intersecting graphics? Such that if someone tapped on a x,y coordinate that was just 5 pixels away from another graphic, it could return that graphic in the array? Or maybe somehow trick the polyline graphics to think they are larger than they are, without giving them an ugly large size? Or maybe there is another solution using Query... but I haven't yet explored that function. I'm using a FeatureLayer for the polylines and a view.on "click" listener which does the hitTest. Attached is a preview of what I'm dealing with:
... View more
10-23-2017
08:18 AM
|
0
|
6
|
1773
|
Title | Kudos | Posted |
---|---|---|
1 | 10-24-2017 11:14 AM |
Online Status |
Offline
|
Date Last Visited |
12-22-2021
07:17 AM
|