Users in our organization have asked to be able to add point features in Collector by typing in the coordinates of the point (rather than clicking on the map or adding at the device location).
Is there a way to set the coordinates of a feature, or a way to locate a coordinate on the map? I know that if you click on the map it will give the location, but we need a way to locate coordinates.
Any help appreciated.
Hi Will,
Doesn't look like this functionality is available just yet.
One thing you could do is have two fields where the user can enter the coordinates of the feature they would like to collect. The user can the collect a point in the general vicinity. You could have a script that runs on the backend to update the geometry of these points. Below is an example of a script that will update the geometry of a point feature service by reading values from a field called X and another called Y.
import urllib, urllib2, json #Parameters username = 'agolUser' password = '*****' baseURL = 'http://services.arcgis.com/dlFtlWFB4qUk/arcgis/rest/services/PA_Hydrants/FeatureServer/0' referer = 'http://countysandbox.maps.arcgis.com' #generate token for service tokenURL = 'https://www.arcgis.com/sharing/rest/generateToken' params = {'f': 'pjson', 'username': username, 'password': password, 'referer': referer} req = urllib2.Request(tokenURL, urllib.urlencode(params)) response = urllib2.urlopen(req) data = json.load(response) token = data['token'] #query service and return OID, X, & Y fields url = baseURL params = {'where': '1=1', 'outFields': "OBJECTID, X, Y", 'token': token, 'f': 'json'} req = urllib2.Request(url + "/query", urllib.urlencode(params)) response = urllib2.urlopen(req) data = json.load(response) #update geometry with X & Y values for value in data['features']: updateURL = baseURL + '/updateFeatures' X = value['attributes']['X'] Y = value['attributes']['Y'] OID = value['attributes']['OBJECTID'] updates = [{"geometry" : {"x" : X, "y" : Y}, "attributes" : {"OBJECTID" : OID}}] params = {'features': updates, 'token': token, 'f': 'json'} req = urllib2.Request(updateURL, urllib.urlencode(params)) response = urllib2.urlopen(req) data = json.load(response) print "ObjectID: " + str(data['updateResults'][0]['objectId']) + ", success: " + str(data['updateResults'][0]['success'])
Hi Will,
Doesn't look like this functionality is available just yet.
One thing you could do is have two fields where the user can enter the coordinates of the feature they would like to collect. The user can the collect a point in the general vicinity. You could have a script that runs on the backend to update the geometry of these points. Below is an example of a script that will update the geometry of a point feature service by reading values from a field called X and another called Y.
import urllib, urllib2, json #Parameters username = 'agolUser' password = '*****' baseURL = 'http://services.arcgis.com/dlFtlWFB4qUk/arcgis/rest/services/PA_Hydrants/FeatureServer/0' referer = 'http://countysandbox.maps.arcgis.com' #generate token for service tokenURL = 'https://www.arcgis.com/sharing/rest/generateToken' params = {'f': 'pjson', 'username': username, 'password': password, 'referer': referer} req = urllib2.Request(tokenURL, urllib.urlencode(params)) response = urllib2.urlopen(req) data = json.load(response) token = data['token'] #query service and return OID, X, & Y fields url = baseURL params = {'where': '1=1', 'outFields': "OBJECTID, X, Y", 'token': token, 'f': 'json'} req = urllib2.Request(url + "/query", urllib.urlencode(params)) response = urllib2.urlopen(req) data = json.load(response) #update geometry with X & Y values for value in data['features']: updateURL = baseURL + '/updateFeatures' X = value['attributes']['X'] Y = value['attributes']['Y'] OID = value['attributes']['OBJECTID'] updates = [{"geometry" : {"x" : X, "y" : Y}, "attributes" : {"OBJECTID" : OID}}] params = {'features': updates, 'token': token, 'f': 'json'} req = urllib2.Request(updateURL, urllib.urlencode(params)) response = urllib2.urlopen(req) data = json.load(response) print "ObjectID: " + str(data['updateResults'][0]['objectId']) + ", success: " + str(data['updateResults'][0]['success'])
This is a good option, thanks Jake.
Hey Will...I have had success using the search for Place or Address to search for a coordinate pair.
Thanks Kyle, this is useful. I was trying this with no luck, but I see now that long has to go first!
Unfortunately I just realized that this function will only work with a data connection, so it will not work when our crews are out in the field.
Hello Will,
This can be completed with the following workflow:
1) Open the Collector web map
2) Click the magnifying glass for the Search tool
3) Enter the long/lat in the search in that order (not lat / long)
4) This will find the location and show a nice little pin with a popup box. If it does not find it, you might not be using the World Geocode Service as your organization's default utility geocoder for the ArcGIS Online/Portal for ArcGIS organization.
5) You then click the three dots or action button in the top right corner of the popup > a menu appears > Collect here
6) This brings you to the menu to pick which layer or feature type you are trying to collect
7) Enter your attribute values and submit - all done!
Let me know if there are any questions! This was tested with Collector for Android 10.3.7 but same workflow for iOS except the ellipsis is replaced with the iOS action button.
I'm also trying to do this, but I can't get a result, I'm not sure why.
Hi Ren,
I just tested the workflow I had provided above again this morning and it still works fine on my end (Android). If it is failing on your end, we would likely want to proceed with a support case to investigate things like: