|
POST
|
I don't think you can combine a definition query and visible scale range with Python like that. You could use that definition query but it would never change the visible scale range in the MXD on its own. I recommend you try using layer files. When you create a layer file, it will save the visible scale range you set (as well as definition queries, symbology, labels, etc). So instead of adding the feature class from a geodatabase, just add it from the layer file and it will already have all that stuff set up. If you want your visible scale range to change, you'd have to save over the layer file with the new visible scale range set. Your other option would be to run a Python script that checks for a vscale field in all (or certain) layers in the map and sets the visible scale range; it would have nothing to do with a definition query.
... View more
03-23-2015
12:01 PM
|
0
|
2
|
5669
|
|
POST
|
Is this a duplicate of your other thread? Changing of python code If so, please delete one to avoid confusion.
... View more
03-23-2015
10:51 AM
|
0
|
0
|
564
|
|
POST
|
One of the first things you should know about Python is that indentation matters. The code you posted has some strange indentation and I'm not confident I'm interpreting it correctly. Do you have a link to the original Python file or can you just upload it here?
... View more
03-23-2015
10:49 AM
|
0
|
5
|
1810
|
|
POST
|
I tried clearing the display cache in ArcMap. Rebooting the server is not an option at this moment. To troubleshoot, I created a new test map service with the same aerial and created a (small) new cache for it. The only difference is that I created the cache in the new location right away (no moving). The new test map service cache displays fine in ArcMap.
... View more
03-20-2015
11:17 AM
|
0
|
0
|
1725
|
|
POST
|
I think you're on the right track. If you've got discrete categories like that with only a few categories, a choropleth map is probably your best bet. If you already have those impact descriptions attributed in your data, you can symbolize using categories and pick the field. If you've got a range of impact values and want to group them into those impact categories, symbolize by quantity and classify the categories however you see fit (just be careful not to lie with statistics).
... View more
03-20-2015
10:58 AM
|
1
|
0
|
596
|
|
POST
|
I haven't tried using table join with a selection, but my guess would be that you need to create your table view from the selection instead of creating a selection from the table view. To make it easier, you could just use a where clause when creating the table view; then do the join. Also, the way you call the joined table in CopyFeatures might be wrong. Try this instead: arcpy.CopyFeatures_management(ALK_Flurstueck_Merge1, "zwErgebnis_" + i, "", "0", "0", "0") EDIT: Maybe try this and see what it does. I got rid of the fields you had listed in the join so it will bring back everything from Meka; not sure if that's what you want. I also got rid of the optional parameters on copy features. Did you intend to use the spatial grid parameters? # Import arcpy module
import arcpy
arcpy.env.workspace = r"R:\Karto\Bierer2014\FFH_MEKA\data.gdb"
# Local variables:
ALK_Flurstueck_Merge1 = r"R:\Daten\geo_daten\Basisgeometrien\Basisgeometrien_2014_03_21.gdb\data\ALK_Flurstueck_Merge1"
Meka = r"R:\Karto\Bierer2014\FFH_MEKA\Meka.mdb\Meka"
Count_Lines = arcpy.GetCount_management(Meka)
print Count_Lines
for i in range(0, 18000, 100):
print i
y = i + 99
print y
z = i
where_clause = "[ID] < {} AND [ID] > {}".format(y, z)
MekaLyr = arcpy.MakeTableView_management(Meka, where_clause)
# Process: Feld verbinden
arcpy.JoinField_management(ALK_Flurstueck_Merge1, "FLSKZ", MekaLyr, "FLRSTKZ")
# Process: Features kopieren
zwErgebnis = "zwErgebnis_{}".format(i)
arcpy.CopyFeatures_management(ALK_Flurstueck_Merge1, zwErgebnis)
... View more
03-19-2015
11:13 AM
|
0
|
0
|
373
|
|
POST
|
I don't have a solution right away, but maybe you can find something helpful from this blog post? Split into equal length features | ArcPy Café Looks like you need ArcGIS 10.3 for the segmentAlongLine method of a geometry object.
... View more
03-18-2015
04:54 PM
|
1
|
0
|
2376
|
|
POST
|
Good suggestions. It looks like all of the config files and stuff are there in the folder that was copied. I tried stopping and starting the service but the issue remains. ArcCatalog Preview doesn't show anything either. The view in ArcGIS.com Map also works.
... View more
03-18-2015
04:51 PM
|
0
|
1
|
1725
|
|
POST
|
So I just finished getting this all set up. I checked the Javascript viewer and the cached map service works fine. I tried adding the service to ArcMap and nothing shows up. The layer is in the table of contents but there is nothing in the map data view. Any ideas?
... View more
03-18-2015
04:21 PM
|
0
|
4
|
1725
|
|
POST
|
Haha! Well, you did post in the Python section so I thought I would go for it. It's not as complicated as it looks. Create Near table Add two new fields for in and near key fields Join the original feature classes to field calc the in and near key field values Export final near table
... View more
03-18-2015
03:51 PM
|
1
|
0
|
2153
|
|
POST
|
I haven't used Wing, but it looks like the Auto-Completion and Source Assistant is what you need. In some cases you may need add to the Python Path in Wing's Project Properties, accessed from the Project menu.
... View more
03-18-2015
03:16 PM
|
0
|
0
|
2511
|
|
POST
|
I've done something similar and the Near table worked for me. When I was doing this, I also found it frustrating that the Near table would only show the ObjectID of the features, requiring additional joins to actually see what features the OIDs were for. I created this Python script that will create a Near table with a key field of your choice in the output. I haven't tested it much but maybe you can get some use out of it. import arcpy
import os
try:
# Set local variables
sourceGDB = r"C:\temp\mytempsource.gdb"
outputGDB = r"C:\temp\mytempoutput.gdb"
## IN and NEAR features can be the same
in_fc = "FeatureClassIn_Name"
in_fc_keyfield_name = "KeyField_Name"
in_fc_keyfield_type = "Long"
in_fc_path = os.path.join(sourceGDB, in_fc)
near_fc = "FeatureClassNear_Name"
near_fc_keyfield_name = "KeyField_Name"
near_fc_keyfield_type = "Long"
near_fc_path = os.path.join(sourceGDB, near_fc)
search_radius = "25 Feet"
# Create near table and make as TableView
neartable_inmem = os.path.join("in_memory", "neartable_inmem")
arcpy.GenerateNearTable_analysis(
in_fc_path, ## in_features
near_fc_path, ## near_features
neartable_inmem, ## out_table
search_radius, ## search_radius
"NO_LOCATION", ## location
"NO_ANGLE", ## angle
"ALL", ## closest
"0", ## closest_count
"PLANAR" ## method
)
arcpy.MakeTableView_management(neartable_inmem, "neartable_view")
print "Near table view created"
# Add new IN and NEAR key fields to near table
in_kf = "IN_{}".format(in_fc_keyfield_name)
arcpy.AddField_management(
"neartable_view", ## in_table
in_kf, ## field_name
in_fc_keyfield_type, ## field_type
)
near_kf = "NEAR_{}".format(near_fc_keyfield_name)
arcpy.AddField_management(
"neartable_view", ## in_table
near_kf, ## field_name
near_fc_keyfield_type, ## field_type
)
print "Key fields added"
# Join and calc IN key field
arcpy.AddJoin_management(
"neartable_view", ## in_layer_or_view
"IN_FID", ## in_field
in_fc_path, ## join_table
"OBJECTID", ## join_field
"KEEP_COMMON" ## join_type
)
arcpy.CalculateField_management(
"neartable_view", ## in_table
in_kf, ## field
"!{}!".format(in_fc_keyfield_name), ## expression
"PYTHON_9.3" ## expression_type
)
arcpy.RemoveJoin_management("neartable_view")
print "{} field populated".format(in_kf)
# Join and calc NEAR key field
arcpy.AddJoin_management(
"neartable_view", ## in_layer_or_view
"NEAR_FID", ## in_field
near_fc_path, ## join_table
"OBJECTID", ## join_field
"KEEP_COMMON" ## join_type
)
arcpy.CalculateField_management(
"neartable_view", ## in_table
near_kf, ## field
"!{}!".format(near_fc_keyfield_name), ## expression
"PYTHON_9.3" ## expression_type
)
arcpy.RemoveJoin_management("neartable_view")
print "{} field populated".format(near_kf)
# Export final near table
kf_near_table = "{}_NEAR".format(in_fc.replace('.', '_')) ## Replace any dot with underscore and add _NEAR suffix
kf_near_table_path = os.path.join(outputGDB, kf_near_table)
arcpy.CopyRows_management(
"neartable_view", ## in_rows
kf_near_table_path ## out_table
)
print "Final near table output at {}".format(kf_near_table_path)
except Exception as err:
print err
## If there was an ArcPy error, write all of the messages returned by the last tool
if arcpy.GetMessages(2):
print arcpy.GetMessages()
finally:
# Cleanup
arcpy.Delete_management("in_memory")
arcpy.ClearWorkspaceCache_management()
... View more
03-18-2015
03:07 PM
|
1
|
2
|
2153
|
|
POST
|
Psst! Posting your code with syntax highlighting is appreciated! Posting Code blocks in the new GeoNet
... View more
03-18-2015
02:33 PM
|
2
|
1
|
1768
|
|
POST
|
You can do this in PyScripter. Go to Tools ---> Options ---> IDE Options Then in the Code Completion part add arcpy to the Special Packages list. It does have a noticeable impact on performance though. It will hang for a few moments sometimes on the first load but once it gets the special packages read, it works fine.
... View more
03-18-2015
02:25 PM
|
0
|
4
|
2511
|
|
POST
|
Thanks Jake, that was very helpful. The only extra step I needed was to add a new directory (of type Cache) in ArcGIS Server Manager (not just the data store registered folders). That allowed me to choose the new cache directory in step 4 you described. And an extra note on that, the cache directory that you add needs to be the folder containing the cache folder, not the folder that contains the cache file. The first time I added the directory in Server Manager, I went all the way down to the last folder that contained the cache file, but it actually needs to be one folder up from that.
... View more
03-18-2015
02:17 PM
|
1
|
0
|
1725
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 1 | 07-31-2025 11:59 AM | |
| 1 | 07-31-2025 09:12 AM | |
| 2 | 06-18-2025 03:00 PM | |
| 1 | 06-18-2025 02:50 PM |