|
POST
|
Hello I am getting error to run this code with Python 2.7 Error invalid characters at this part f"{os.path.splitext(txtFileNameWithExt)[0]}_{datetime.datetime.now():%Y_%m_%d}" how can I fix this it? I need to run it on 2.7 . #rename shapefile
txtFileNameWithExt = "Ops.shp"
txtFileNameNoExt = f"{os.path.splitext(txtFileNameWithExt)[0]}_{datetime.datetime.now():%Y_%m_%d}"
arcpy.env.workspace = my_Path
arcpy.Rename_management(txtFileNameWithExt,f"{txtFileNameNoExt}.shp")
... View more
03-24-2023
09:54 AM
|
0
|
3
|
1014
|
|
POST
|
@MichelleMathias Please delete this questions thanks
... View more
03-08-2023
01:50 PM
|
0
|
0
|
729
|
|
POST
|
Hello I am trying to return Latitude and Longitude from table I have when users select values from select one question. I used get layer function but no luck this is what I have so far select_one question autocomplete search('store?url=https://xyz&units=esriSRUnit_StatuteMile&distance=0.25', 'intersects', '@geopoint', ${location}) return values I need to get decimal lat latitude decimal long Longitude
... View more
03-07-2023
07:24 AM
|
0
|
1
|
582
|
|
POST
|
Hello I looking for a way users can add Latitude and Longitude in survey and then map show the location? is it any way users can manually type lat and long to appear on map (geopoint)
... View more
02-27-2023
12:36 PM
|
0
|
2
|
2319
|
|
POST
|
Hello I have this code which sort values base on buffer 1320 feet and return First values. I want to return all values inside the buffer not just one. is it any way I can do this? Thanks // If the feature doesn't have a geometry, return null
if (IsEmpty(Geometry($feature))) { return null }
// Get the bus stops layer
// To customize, replace the layer name below
var busStops = FeatureSetByName($map,"RTD Active Bus Stops")
// Buffer the current location and intersect with the bus stops
var bufferedLocation = Buffer($feature, 1000, 'feet')
var candidateStops = Intersects(busStops, bufferedLocation)
// Calculate the distance between the bus stops and the current location
// Store the feature and distance as a dictionary and push it into an array
var featuresWithDistances = []
for (var f in candidateStops) {
Push(featuresWithDistances,
{
'distance': Distance($feature, f, 'feet'),
'feature': f
}
)
}
// Sort the candidate bus stops by distance using a custom function
function sortByDistance(a, b) {
return a['distance'] - b['distance']
}
var sorted = Sort(featuresWithDistances, sortByDistance)
// Get the closest bus stop
var closestFeatureWithDistance = First(sorted)
// If there was no bus stop, return null
if (IsEmpty(closestFeatureWithDistance)) { return null }
// Return the bus stop name attribute value
// To customize, replace the field name "STOPNAME" below
return `${closestFeatureWithDistance['feature']['STOPNAME']}`
... View more
02-14-2023
11:39 AM
|
0
|
1
|
1148
|
|
POST
|
Hello I have this code which sort values base on buffer 1000 feet and return First values. I want to return all values inside the buffer not just one. is it any way I can do this? Thanks // If the feature doesn't have a geometry, return null
if (IsEmpty(Geometry($feature))) { return null }
// Get the bus stops layer
// To customize, replace the layer name below
var busStops = FeatureSetByName($map,"RTD Active Bus Stops")
// Buffer the current location and intersect with the bus stops
var bufferedLocation = Buffer($feature, 1000, 'feet')
var candidateStops = Intersects(busStops, bufferedLocation)
// Calculate the distance between the bus stops and the current location
// Store the feature and distance as a dictionary and push it into an array
var featuresWithDistances = []
for (var f in candidateStops) {
Push(featuresWithDistances,
{
'distance': Distance($feature, f, 'feet'),
'feature': f
}
)
}
// Sort the candidate bus stops by distance using a custom function
function sortByDistance(a, b) {
return a['distance'] - b['distance']
}
var sorted = Sort(featuresWithDistances, sortByDistance)
// Get the closest bus stop
var closestFeatureWithDistance = First(sorted)
// If there was no bus stop, return null
if (IsEmpty(closestFeatureWithDistance)) { return null }
// Return the bus stop name attribute value
// To customize, replace the field name "STOPNAME" below
return `${closestFeatureWithDistance['feature']['STOPNAME']}`
... View more
02-14-2023
11:36 AM
|
0
|
0
|
568
|
|
POST
|
Hello Does creating View Layers (Feature Layer (hosted, view)) consume credit?
... View more
01-13-2023
12:03 PM
|
0
|
1
|
1166
|
|
POST
|
This is exact code on blog except I am running it on Notbook on arcgis online. Then I didn't provide password and a portal url just user name import arcgis
from arcgis.gis import GIS
user = "UserName" ##My User name
##for web maps
webmaps = gis.content.search("owner:" + user, item_type="Web Map", max_items=10)
webmaps
##for feature layers
fcs = gis.content.search("owner:" + user, item_type="Feature Layer", max_items=10)
fcs
##for feature layers
fcs.url
fc_layers = fcs.layers
fc_layers.url
##for web maps
web_map_obj = arcgis.mapping.WebMap(webmaps)
maplayers = web_map_obj['operationalLayers']
maplayers['url']
... View more
12-29-2022
09:13 AM
|
0
|
0
|
1159
|
|
POST
|
Hello I am running this code on AGOL Notebook but I am getting error. The code is from Esri website https://support.esri.com/en/technical-article/000016853 I don't know why I am getting this error:
... View more
12-29-2022
07:57 AM
|
0
|
3
|
1186
|
|
POST
|
Hello @ChrisWiebke @fklotz , I am looking for code which just go through each webmaps in my organization and give me url items inside of webmaps with title of urls. I want to create table like this: webmap title url title url NYC Crime map City Council Districts https:// Map PLUTO https:// police precincts https:// NYC Bike Share map School Districts https:// Subway Stops https:// note: some items are inside of group in webmap which I need to scan those to and return urls I have this code which I need to manually copy paste webmap id and also doesn't return url items inside group. from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
from arcgis.mapping import WebMap
from arcgis.widgets import MapView
gis = GIS('home')
wmItem = gis.content.search(query= 'YourWebMapID')
print(wmItem)
wmItemId = "YourWebMapID" #put the id of the webmap in here
wmItem = gis.content.get(wmItemId)
wm = WebMap(wmItem)
for lyr in wm.layers:
print(lyr.title)
print(lyr.url) I will appreciate if someone can help me with this. Thanks
... View more
12-28-2022
07:14 AM
|
0
|
0
|
9943
|
|
POST
|
@JoshuaSharp-Heward Thanks this is pretty good. sorry to bother you with this. Do you know how can I run this for my whole arcgis online webmaps? Instead of manually copy paste ItemId for each webmap. Thanks again for your help
... View more
12-20-2022
11:06 AM
|
0
|
1
|
1715
|
|
POST
|
Hello I have this code which is working with single item id. But I need to run this on all webmaps on my content or org. I am using notebook on AGOL any idea how can I do this? from arcgis.gis import GIS
from arcgis.mapping import WebMap
gis = GIS('home')# if running this from Notebook for ArcGIS in AGOL/Enterprise, replace this line with gis = GIS('home')
wmItemId = "myid" #put the id of the webmap in here
wmItem = gis.content.get(wmItemId)
wm = WebMap(wmItem)
for lyr in wm.layers:
print(lyr.title)
print(lyr.url)
... View more
12-15-2022
08:44 AM
|
0
|
0
|
1417
|
|
POST
|
Hello I have problem with new version of survey123 connect 3.16 and text question. I published text question and set bind::esri:fieldLength to 1000 but user can write over 1000 without getting error/hint like old version of survey123 connect 3.15 which give you error. I put screen shot of two versions below: new version old version as you can see we don't get error massage anymore. I know I can write constraint but why this bug happening.
... View more
12-13-2022
12:44 PM
|
0
|
1
|
846
|
|
POST
|
Thanks @JoshuaSharp-Heward sorry for late respond. I manually re-type it and it is working. Just one more question Do you know how can I modifie your code to get URL of each layers in webmap
... View more
12-12-2022
01:02 PM
|
0
|
4
|
1734
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-26-2023 07:59 AM | |
| 8 | 01-15-2025 08:56 AM | |
| 1 | 01-15-2025 08:57 AM | |
| 1 | 03-30-2022 08:49 AM | |
| 2 | 10-24-2024 06:53 AM |