|
POST
|
In that case I think SQL isn't liking the extraneous comma in the expression and is causing the expression to fail.
... View more
05-04-2017
02:24 PM
|
0
|
6
|
1710
|
|
POST
|
It has to do with how tuples function. If you put only a single string inside your tuple(), it will return a tuple of the string broken up into its individual characters. https://docs.python.org/2/library/functions.html#tuple To have a tuple with a single string in it, you would need to have a comma in the parathenses after your string. http://stackoverflow.com/questions/12876177/why-do-tuples-with-only-one-element-get-converted-to-strings I would find a way to make sure your list of values ends in a comma, regardless of the number of values in it, that way even with a single value it would end up a true tuple https://wiki.python.org/moin/TupleSyntax
... View more
05-04-2017
01:39 PM
|
1
|
8
|
1710
|
|
POST
|
I'd recommend adding a print statement to see what value pt[0] and pt[1]is pulling for each point. The error is clearly receiving a non-numeric value which is causing it to crash(maybe a NaN, have you tried to check the geometry for errors or repair it?). Instead of: for pt in centroid_coords: point.X = pt[0] point.Y = pt[1] just do for pt in centroid_coords: print str(pt[0]) print str(pt[1]) That should print to your screen each pair of values, and you should be able to determine which is a non-numeric value. I hope your polygon dataset isn't to big
... View more
05-04-2017
01:20 PM
|
1
|
10
|
2196
|
|
POST
|
You can turn the labels on to label the features under the layer properties, using the field of choice that you want to be the text label. If you don't want the points symbolized themselves, you can set them to display no color so they won't appear on your map.
... View more
05-03-2017
07:34 AM
|
1
|
1
|
860
|
|
POST
|
Thanks for the extra code, I wasn't aware what you posted earlier was part of a larger piece of code. I think the most important thing you are missing is what I mentioned first, and ends up being important for the 5th point I made. You are double assigning your j and k variable which is going to cause alot of issues. As you can see above, when you used j as a placeholder variable for your loop, it assigns the variable j to the value the file name (or whatever value is in your list) in the list you are iterating over. j is now no longer equal to 0, and the subsequent j += 1 will not do what you planned it to do. This is why I recommended you use a different variable for the placeholder, so you your variable j to continue to function as a counter as you want, as well as getting the file name as a seperate variable if you need it. As for my fourth point its not a critical thing, but its more correct pythonicly to use the value that already in your placeholder then to redundantly use an index to call that same value from the list. The crux of your issue was the double assigning of your variables j and k, fix that and you should be fine. Hope this helps
... View more
05-03-2017
06:57 AM
|
2
|
5
|
1794
|
|
POST
|
Your last sentence seems to contradict itself, could you be a little clearer? The Camera is the only thing now that controls extents and scales, since there is no longer a dataframe, so it seems like changing the Camera would be to go about this. From the help: import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Projects\YosemiteNP\Yosemite.aprx")
m = aprx.listMaps("Yose*")[0]
lyr = m.listLayers("Ranger Stations")[0]
lyt = aprx.listLayouts("Main Attr*")[0]
mf = lyt.listElements("mapframe_element", "Yosemite National Park")[0]
mf.camera.setExtent(mf.getLayerExtent(lyr, False, True))
aprx.saveACopy(r"C:\Projects\YosemiteNP\Yosemite_Updated.aprx")
del aprx Have you tried setting the camera of both the map frame and map? Also would you mind posting your code ths far you've been trying? bixb0012
... View more
05-02-2017
02:12 PM
|
0
|
0
|
16416
|
|
POST
|
I don't use ArcGIS Pro yet, but looking at the various helps, I would guess you would need to get the extent object of your layer and then apply that extent a Camera Object, which you can use to overwrite the default Camera object in your Map or Mapframe. The Example on the Camera Help my point you in the right direction. http://pro.arcgis.com/en/pro-app/arcpy/mapping/camera-class.htm http://pro.arcgis.com/en/pro-app/arcpy/mapping/mapframe-class.htm http://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm
... View more
05-02-2017
01:45 PM
|
2
|
2
|
16416
|
|
POST
|
Hi Steven, Your nomenclature is a little off and I want to make sure its understood what the issue is. You say you have multiple "LiDAR Datasets", but LiDAR data is not a raster format, rather a point cloud usually in the form of a .las or .laz. I'm guessing what you are working with are raster Digital Elevation Models, Intensity Images, or something similar raster file that is generated from the LiDAR point cloud, not the "LiDAR Datasets" themselves. According to this stackexchange thread, sometimes ArcMap cannot render all of a raster image at its full extent and zooming into a smaller than full extent would fix the issue(so the tool works correctly, but display incorrectly). It also has suggestions for working around to build a mosaic in a more manual fashion. You could run cell statistics or something similar on your output to make sure there are not a large number of no data cells that would be indicative that the tool ran incorrectly. It would be helpful to know what file format your raster data is currently in, as well as what the export file type you are trying to create. Also have you tried to create the output to just a regular folder instead of a FGDB to see if that changes results? Hope this helps, Ian
... View more
05-02-2017
12:21 PM
|
1
|
2
|
1451
|
|
POST
|
A few things. First, you are using both j and k as a variable twice, once as a number, once as a placeholder for the item in the list you are iterating over. I suggest leaving j and k as the numbers you are using as a counter and use something like n_list and c_list as the placeholder in your loops. Second, you have several variables that you are using that have never been defined(layerName for example). Third, you haven't set an environment variable so it won't recognize some of your variables unless you set a environment for it to look for them or use a fully qualified file path(outFeature for example). Fourth, for your j_joinTable and k_joinTable variables, you are redundant using a index to get the file name from the list. The placeholder variable you are using to iterator is the value of that filename and use can just use the placeholder as the input for j_joinTable and K_joinTable. If you follow my suggestion from above it would look like the following. j_joinTable = n_list k_joinTable = c_list This is also a little redundant but fits your convention for assigning variables. Fifth be consistent in your variable naming, you have J_joinField when you declare a variable, with the rest using a lowercase j, but then when you call it later, it uses the lower case j like I think you meant to. Ditto with the uppercase k at the end of your script, its not a variable thats been declared before.
... View more
05-02-2017
09:35 AM
|
1
|
7
|
1794
|
|
POST
|
Well what level is "appropriate" is highly subjective and would depend greatly on the dataset(Dense small scale datasets would have very different parameters for zooming to a single point, than a large diffuse point dataset). A solution for you if you were unhappy with the current zoom to selected features for a single point would be to make a make a new tool that would select to a certain scale on a selected point based on your needs. As I find it now, I don't see that much need for it, since doing a manual select isn't that time consuming, and I already mentioned the options for adjusting within python.
... View more
04-19-2017
02:07 PM
|
0
|
2
|
3287
|
|
POST
|
Funny this is something I've obviously witnessed many times but never really considered a bug. If I zoomed to single points alot with arcpy scripts then I bet I would notice, but I use polygons mainly as input for tools and zooming to single polygons. Since they do have actual extents its never a problem.
... View more
04-19-2017
10:51 AM
|
2
|
4
|
3287
|
|
POST
|
Did it actually add the layers to the map once you added the environment variable I mentioned before? I wasn't saying create a new layer, but once the group layer is created in the map document, you should be able to list all the layers in the map document in arcpy and create a layer object in python referencing that layer in the map. I'm not 100% sure but you should then be able to use that Layer object as the input for Feature to Vertices. That doesn't answer the larger question of why a perfectly valid python tool was working with a one dataset and not another though.
... View more
04-19-2017
10:47 AM
|
1
|
1
|
2038
|
|
POST
|
I would guess since a single point doesn't have a true extent, it default to zooming in to a fractional subset of the original features extent. If you have more than a single point that it can create an extent object that encompasses multiple points and returns a logical seeming zoom for the multiple objects. In arcpy you can always manually reset the scale to a scale that makes sense using the maps dataframe properties.
... View more
04-19-2017
10:40 AM
|
2
|
5
|
3287
|
|
POST
|
That would be the first place I would go since it was not adding the output to your map document when run as a python tool(which I'm assuming you are running within the MXD in questions). Once we know for sure that the group layer is added to the map document, and if python still cannot recognize the local path within the map document for that layer within the group layer, then you will likely need to create a layer object for that layer and use that for the input for the tool. http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/layer-class.htm
... View more
04-19-2017
10:25 AM
|
0
|
3
|
2038
|
|
POST
|
Have you set your environmental variables so it auto adds the output of Geoprocessing operations to the map? http://pro.arcgis.com/en/pro-app/arcpy/classes/env.htm arcpy.env.addOutputsToMap = True
... View more
04-19-2017
10:04 AM
|
0
|
7
|
2038
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-22-2017 08:58 AM | |
| 1 | 10-05-2015 05:43 AM | |
| 1 | 05-08-2015 07:03 AM | |
| 1 | 10-20-2015 02:20 PM | |
| 1 | 10-05-2015 05:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|