POST
|
I need to change the way my labels are displayed in ArcMap using ArcPy. I want to replace underscores with spaces in label strings with using string.replace("_"," "). I have SHOWLABELS set to True, but I'm having trouble accessing the label values themselves in ArcPy. Looking in the LabelClass documentation, I can't find any method to print out or alter the label values. city_layer = arcpy.mapping.ListLayers(mxd, "cities")[0]
countries_layer = arcpy.mapping.ListLayers(mxd, "countries")[0]
if city_layer.supports("SHOWLABELS"):
city_layer.showLabels = True
if countries_layer.supports("SHOWLABELS"):
countries_layer.showLabels = True
... View more
05-16-2017
09:15 AM
|
0
|
4
|
832
|
POST
|
We're upgrading to Enterprise 10.5 soon. Hopefully this will have been fixed. It has caused us endless headaches and time wasted trying to make our PDFs smaller.
... View more
05-16-2017
08:45 AM
|
0
|
1
|
515
|
POST
|
Not sure exactly what you're trying to accomplish here. This is the simplest way to pull XY values from a mouse click: map.on("click", function(evt){
var mp = webMercatorUtils.webMercatorToGeographic(evt);
var x = mp.x.toFixed(3);
var y = mp.y.toFixed(3);
}) If you console.log(); x and y, you'll get latitude and longitude coordinates to three digits.
... View more
05-09-2017
02:10 PM
|
0
|
1
|
1091
|
POST
|
You were right about the parenthesis. This works: query = "\"{0}\" in ({1})".format(field, top_cities[0]) Now I just need to add an if statement to check if there is only one city, use this query. Otherwise use the tuple query.
... View more
05-08-2017
07:53 AM
|
0
|
0
|
692
|
POST
|
This returns "Pop_MAX" IN ([328585]) as above and I still get the SQL error.
... View more
05-08-2017
07:43 AM
|
0
|
0
|
105
|
POST
|
It returns this for me, "Pop_MAX" in ([328585]) and I still get the SQL error
... View more
05-04-2017
02:56 PM
|
0
|
2
|
692
|
POST
|
I tried taking out the tuple function and just using this query and it returns a single value list. I still get the SQL error. Would it be possible to put in a second value of zero in the tuple? query = "\"{0}\" in {1}".format(field,top_cities)
... View more
05-04-2017
02:27 PM
|
0
|
5
|
692
|
POST
|
I figured as much. But the output of this short test script is this: (328585,) which is a true tuple, no? import os
import arcpy
cities = "R:\\temp\\reno\\cities.shp"
field = "POP_MAX"
values = [row[0] for row in arcpy.da.SearchCursor(cities, field)]
top_cities = sorted(values)[-15:] #adjust max rows count
query = "\"{0}\" in {1}".format(field, tuple(top_cities))
print tuple(top_cities)
... View more
05-04-2017
02:02 PM
|
0
|
7
|
692
|
POST
|
I have a Python GP tool on our Arc GIS Server that generates a report based on a polygon drawn on a web map. I have a query that sorts up to the top 15 cities in the region by population and creates a temporary shapefile of these cities. Everything works fine until I have a small enough region that only has one populated city. I get this error from the server logs: An invalid SQL statement was used. An invalid SQL statement was used. The Project method cannot do a datum transformation. Failed to execute (FeatureClassToFeatureClass). I do not get this error if there are two or more populated cites in the region. Here is the Python snippet with the query. It's set to skip the temporary shapefile creation if there are no cities in the region. cities = temp_path + region_name + "\\" + "cities.shp"
values = [row[0] for row in arcpy.da.SearchCursor(cities, field)]
top_cities = sorted(values)[-15:] #adjust max rows count
query = "\"{0}\" in {1}".format(field, tuple(top_cities))
check_list = [cities,]
for shapefile in check_list:
if arcpy.GetCount_management(shapefile)[0] != 0:
arcpy.FeatureClassToFeatureClass_conversion(cities,temp_path + region_name,"pop.shp",query)
else:
continue
... View more
05-04-2017
01:02 PM
|
0
|
12
|
1601
|
POST
|
Just updated Chrome on Windows 10 to Version 58.0.3029.81. Still not working. It works on Chrome for Windows 7 and Mac OS El Capitan.
... View more
04-25-2017
12:50 PM
|
0
|
2
|
753
|
POST
|
I get this error in the console. js.arcgis.com/3.20/init.js:594 Uncaught TypeError: Cannot read property '_surface' of undefined It also shows up at zoom 3, even though the zoom is set to 2. Bugs?
... View more
04-25-2017
10:43 AM
|
0
|
4
|
753
|
POST
|
Strange. It doesn't work in Chrome on the Windows 10 server machine I'm working on, but it works on Chrome on my Mac.
... View more
04-25-2017
10:40 AM
|
0
|
6
|
753
|
Title | Kudos | Posted |
---|---|---|
1 | 02-09-2017 11:44 AM | |
1 | 06-12-2017 12:18 PM | |
1 | 02-07-2017 09:09 AM | |
1 | 02-08-2017 02:52 PM | |
1 | 01-25-2017 11:00 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|