|
POST
|
NAH that did not work....but at least the polygon state layer is WGS84 and the point being geocoded is output in WGS 84 so thats on the same page but I never return any features.....
... View more
09-02-2020
05:00 AM
|
0
|
0
|
4237
|
|
POST
|
Woke up at 3am and it dawned on my that I might be having issues with the projection of the Feature Class and the Point created from the Geocode...think once I fix that it might work....testing that this morning.
... View more
09-02-2020
03:56 AM
|
0
|
1
|
4237
|
|
POST
|
OK that removed the error and an oversight by me.....thanks for the eyes.... For some reason I am getting true for any address....I think my code to test if its in or not is not working correctly. If I put in an address for Wyoming it returns true....I set the variable to false at the beginning but for some reason I get a count from the results variable either way.... Any ideas where this test for the result is wrong? # TEST TO SEE IF POINT IS INSIDE THE BUFFERED GEOMETRY
results = arcpy.SelectLayerByLocation_management("point_lyr", 'INTERSECT', 'IN_MEMORY/BufferGeom')
#Test if there are any polygons points:
if int(arcpy.GetCount_management(results).getOutput(0))==0:
#raise Exception("Selected points do not overlap any polygons.")
print "Selected points do not overlap any polygons."
varResult = "true"
... View more
09-01-2020
03:32 PM
|
0
|
0
|
4237
|
|
POST
|
Im trying to do this and stuck Take a JSON string with address and distance set those to variables Geocode the Address to get an XY and set those to Variables Buffer a polygon of the state using the distance variable created from the DataInput JSON Define the State Boundary Buffer the State Boundary and set into memory Test ot see if the point is within that Buffered State Boundary Return True if its within and False if Outside the Buffered State Boundary ERROR: Traceback (most recent call last): File "E:\ArcGIS Server\ArcGIS\xxxxxxxx.py", line 87, in <module> results = arcpy.SelectLayerByLocation_management(ptGeometry, 'INTERSECT', 'IN_MEMORY/BufferGeom') File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\management.py", line 7891, in SelectLayerByLocation raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000368: Invalid input data. Failed to execute (SelectLayerByLocation). Can Anyone see anything obvious as to why I am tripping this error? import arcpy
import requests
import json
import uuid
#dataInputParameter1 = arcpy.GetParameterAsText(0)
dataInputParameter1 = '{"Location":[{"address":"6188 Maddox Blvd, Chincoteague, VA, 23336","distance":"12" }]}'
# ADD ADDITIONAL VARIABLE FOR RETURN RESULT
varResult = "true"
textDict = json.loads(dataInputParameter1)
langs = []
for SpecificLocation in textDict['Location']:
varsearchAddress = SpecificLocation["address"]
varsearchDistance = SpecificLocation["distance"]
print ("address: " + varsearchAddress)
print ("distance: " + varsearchDistance)
print ""
# LOCAL VARIABLES
coordinates = ""
countList = []
countyField = "FIPS2"
countList2 = []
finalList = []
txt_list = ""
txt_list2 = ""
data = ""
# GEOCODERS
geoCodeUrl = r"https://gismaps.vita.virginia.gov/arcgis/rest/services/Geocoding/VGIN_Composite_Locator/GeocodeServer/findAddressCandidates"
searchAddress = varsearchAddress
searchDistance = varsearchDistance
# CONVERT MILE TO METERS FOR SPATIAL BUFFER
distanceMeters = int(varsearchDistance) * 1609.34
def singleAdressGeocode(address, geoCodeUrl, outSR = "4326"):
#def singleAdressGeocode(address, geoCodeUrl, outSR = "26917"):
##clean up the address for url encoding
address = address.replace(" ", "+")
address = address.replace(",", "%3B")
#send address to geocode service
lookup = requests.get(geoCodeUrl + "?SingleLine=" + address + "&outSR=" + outSR + "&maxLocations=1&f=pjson")
data = lookup.json()
if data["candidates"]:
##coords = data["candidates"][0]["location"]
##return coords
return data
else:
##no results
return "Address not geocoded: " + address
# DEFINE VARIABLES FOR THE ADDRESS AND X AND Y VALUES
geocodeResult = singleAdressGeocode(searchAddress, geoCodeUrl)
addressResult = geocodeResult["candidates"][0]["address"]
coordinateX = geocodeResult["candidates"][0]["location"]["x"]
coordinateY = geocodeResult["candidates"][0]["location"]["y"]
strcoordinateX = str(coordinateX)
strcoordinateY = str(coordinateY)
arcpy.env.workspace = r"E:/ArcGISProjects/CountySelection/xxxxx.sde"
# CREATE THE POINT FROM THE X AND Y
point = arcpy.Point(coordinateX, coordinateY)
ptGeometry = arcpy.PointGeometry(point)
# DEFINE THE STATE FEATURE CLASS
arcpy.MakeFeatureLayer_management(r"E:/ArcGISProjects/CountySelection/xxxxx.sde/Boundary", "state_lyr")
# BUFFER THE STATE LAYER AND PUT IT IN MEMORY
arcpy.Buffer_analysis('state_lyr', 'IN_MEMORY/BufferGeom', distanceMeters)
# TEST TO SEE IF POINT IS INSIDE THE BUFFERED GEOMETRY
results = arcpy.SelectLayerByLocation_management(ptGeometry, 'INTERSECT', 'IN_MEMORY/BufferGeom')
#Test if there are any polygons points:
if int(arcpy.GetCount_management('IN_MEMORY/BufferGeom').getOutput(0))==0:
raise Exception("Selected points do not overlap any polygons.")
print "Selected points do not overlap any polygons."
varResult = "true"
... View more
09-01-2020
03:05 PM
|
0
|
25
|
9075
|
|
POST
|
The Near Me widget comes with additional features such as FILTER settings My problem is that I need these FILTER settings to be handled FIRST and then the NEAR ME geocoded search. Is there a way to specify that the FILTER has to happen FIRST??? I am looking to get the FILTER Selections to be moved to the top of this side window so it seems natural to define those FIRST. As seen in the image below move the FILTER choices above the NEAR ME inputs parameters
... View more
08-07-2020
09:05 AM
|
0
|
0
|
519
|
|
POST
|
The Find Near Me widget natively has ESRI Geocoder defined with it. My question refers to the "County or Region Code" that can be used to define a search area for geocoding addresses. Can you specify a more granular search? Say a specific US state - Say I just want the Geocoder to search Ohio address and not the rest of the Unites States.
... View more
08-07-2020
08:51 AM
|
0
|
0
|
394
|
|
POST
|
I am trying to find a solution for a large dataset. I have a polygon Feature Service. It has about 1000 records that consist of a boundaries of large swaths of the state. Each polygon could be 1/4 to 1/2 the size of the state. Each polygon in the FC is made up of many counties which are then dissolved into a single geometries. To even render these polygons at one time in AGOL is almost laughable. But I still need to find a way to enter an address or do a map click that drills down into this layer and returns information on the many polygons that is will locate. Does anyone know how to NOT render the features in AGOL but still run a query against the Feature Service in AGOL. It then needs to return a list with information, AND also be able to click on the results to highlight that locations boundary. I would like to use the Query Widget and return a list and be able to highlight the record clicked on in the list...BUT I think the only way to get this to work is to render the geometries in the map...which will not happen do to their size and complexity. How does the GP Tool Widget work....Can I set it up to allow a user to click on the map and pass the GP Tool an XY and then handle the selection on the server side and return a list. But then I would have to call the Server side again if I click the list to show its geometry????
... View more
07-15-2020
10:06 AM
|
0
|
1
|
1255
|
|
POST
|
I have a scenario where: Feature Class I have Event Data - Feature Class with point locations etc. Tables 1 to 1 - Citizen Info (this data could be added to the event data FC) 1 to Many - Species present Table (need to add multiple species associated with the Event FC) 1 to 1 - Bear Info Table 1 to 1 - Sick Dead Table 1 to 1 - Hemorrhagic Info Table The three last tables above are categories that may or may not be populated. But they will be related back to the Event Data Feature Class. Is there a way that I can trigger a connection to one of the 3 tables (Bear, Sick, Hemorrhagic) from the Event Data FC. User Story A user adds and Event The form will have options to add data to the related table "Citizen Info" (again I think this can be added to the FC) The form will have options to add data (1 or many) to the related Species Table If there is a bear present the form will present the option to add data to the related Bear Info Table OR If there is a sick or dead animals present the form will present the option to add data to the related Sick Dead Table OR If there is a hemorrhagic present the form will present the option to add data to the related Hemorrhagic Info Table Please see attachment I am trying to find a solution that will allow me to add data to the Event Table, Citizen Info, and Species Info in the same fashion BUT I then want three other RELATED tables there that can be selected to enter data to 1 or all of the Bear, Sick Dead or Hemorrhagic tables. I am not sure if this can be done with Survey123 Can I add data to a FC and have 3 different Related Tables and be able to choose which one I want to add data to?
... View more
06-02-2020
01:12 PM
|
0
|
1
|
1255
|
|
POST
|
Thanks once again .... didnt know I had to grab the geometries first....CHEERS
... View more
05-19-2020
01:10 PM
|
0
|
0
|
2032
|
|
POST
|
Looking to zoom to the graphics layer which works but want to zoom back just a bit....it zooms to the actual geometry but to close for my liking so maybe an expand? and use a duration to zoom to those features var opts = {
duration: 5000 // Duration of animation will be 5 seconds
};
viewright.goTo({
target: features2,
zoom: 7
}, opts)
.catch(function (error) {
if (error.name !== "AbortError") {
console.error(error);
}
});
... View more
05-19-2020
12:15 PM
|
0
|
2
|
2032
|
|
POST
|
If I want to do something like this how to I define the graphics Layer...this does not seem to work viewright.goTo({
target: features2,
zoom: 7
}, opts)
.catch(function (error) {
if (error.name !== "AbortError") {
console.error(error);
}
});
... View more
05-19-2020
11:49 AM
|
0
|
4
|
2032
|
|
POST
|
This is all the code that is relevant I think var PolygonsUrl = "https://xxxx/arcgis/rest/services/Test/Poly/FeatureServer/0";
window.PolygonsLayer = new FeatureLayer({
url: PolygonsUrl,
outFields: ["*"],
visible: true
});
window.resultsLayer2 = new GraphicsLayer({
id: "resultsLayer2",
opacity: .5
});
var mapright = new Map({
basemap: "dark-gray",
layers: [resultsLayer2, resultsLayer4]
});
var viewright = new MapView({
container: "viewDivright",
map: mapright
});
function queryMultipartPolyongUniqueID4(feature) {
var str = feature;
//alert(str);
var query = "";
query = window.MultiPartPolygonsLayer.createQuery();
query.where = "ID = '" + str + "'"; // "1a35172e071f4a33b191172a9b4b02ae";
return window.PolygonsLayer.queryFeatures(query);
}
function displayResultsUniqueID(results) {
var features2 = results.features.map(function (graphic) {
graphic.symbol = {
type: "simple-fill", // autocasts as new SimpleFillSymbol()
color: [51, 51, 204, 0.9],
style: "solid",
outline: { // autocasts as new SimpleLineSymbol()
color: "white",
width: 1
}
};
return graphic;
});
window.resultsLayer2.addMany(features2);
viewright.goTo(features2.Extent);
}
... View more
05-19-2020
11:19 AM
|
0
|
6
|
2032
|
|
POST
|
Just looking for a simple zoom ... I don't think I need to query anything....I am adding a feature to a graphics layer....then want to zoom to that Graphics Layer Thoughts? var mapright = new Map({
basemap: "dark-gray",
layers: [resultsLayer2, resultsLayer4]
});
var viewright = new MapView({
container: "viewDivright",
map: mapright
});
function displayResultsUniqueID(results) {
var features2 = results.features.map(function (graphic) {
graphic.symbol = {
type: "simple-fill", // autocasts as new SimpleFillSymbol()
color: [51, 51, 204, 0.9],
style: "solid",
outline: { // autocasts as new SimpleLineSymbol()
color: "white",
width: 1
}
};
return graphic;
});
window.resultsLayer2.addMany(features2);
viewright.goTo(features2.Extent);
}
... View more
05-19-2020
11:14 AM
|
0
|
7
|
2136
|
|
POST
|
Changed to this and it worked. used MakeFeatureLayer_management and feed the results2 the variable ## SET THE TARGET FEATURE CLASS TO ADD THE FINAL MULTI PART GEOMETRY TO
inputFeatureclass = r"E:/ArcGISProjects/CountySelection/xxx.sde/FeaureClass"
arcpy.MakeFeatureLayer_management(r"E:/ArcGISProjects/County/xxx.sde/FeatureClass", "multiPart_lyr")
whereClause = "NWTLID = " + "'" + dataInputParameter2 + "'"
results2 = arcpy.SelectLayerByAttribute_management('multiPart_lyr', 'NEW_SELECTION', whereClause)
... View more
05-12-2020
10:03 AM
|
0
|
0
|
1069
|
|
POST
|
I am having issues with a a WHEREClause....anyone see anything wrong here. THIS WORKS FINE inputFeatureclass = r"E:/ArcGISProjects/County/xxx.sde/FeatureClassName"
dataInputParameter2 = "{9A35172E-071F-4A33-B191-172A9B4B02AE}"
whereClause = "FIELDNAME = " + "'" + dataInputParameter2 + "'"
fields = ['ID', 'FIELDNAME', 'UNIQUEID', 'OBJECTID']
with arcpy.da.SearchCursor(inputFeatureclass, fields, whereClause) as cursor:
for row in cursor:
print "--QUERY RESULT FROM MAIN FEATURE SERVICE ------"
print('{0}, {1}, {2}, {3}'.format(row[0], row[1], row[2], row[3]))
print "" BUT NOW TRYING TO USE -- SelectByAttrbute inputFeatureclass = r"E:/ArcGISProjects/County/xxx.sde/FeatureClassName"
dataInputParameter2 = "{9A35172E-071F-4A33-B191-172A9B4B02AE}"
whereClause = "FIELDNAME = " + "'" + dataInputParameter2 + "'"
results2 = arcpy.SelectLayerByAttribute_management(inputFeatureclass, 'NEW_SELECTION', whereClause) Now I get this error when trying SelectByAttrbute NOTE: This is a GUID field data type in SDE SQL Server db Traceback (most recent call last): File "E:\ArcGISProjects\County\Python\UpdateGeometryJSON.py", line 94, in <module> results2 = arcpy.SelectLayerByAttribute_management(inputFeatureclass, 'NEW_SELECTION', whereClause) File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\management.py", line 7744, in SelectLayerByAttribute raise e ExecuteError: Failed to execute. Parameters are not valid. The value cannot be a feature class ERROR 000840: The value is not a Raster Layer. ERROR 000840: The value is not a Mosaic Layer. Failed to execute (SelectLayerByAttribute).
... View more
05-12-2020
09:36 AM
|
0
|
2
|
1103
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|