POST
|
This is pretty simple tool to use so i don't see where there could be an issue but here it is. Also it fails if i have something wrong here like i have the database name wrong. inOriginName = rec inSQLQueryRec = "Select * from PCPToRecipRatio.dbo." + rec print inSQLQueryRec inOriginFeatures = arcpy.MakeQueryLayer_management(inOriginRecipientsFilePath,rec,inSQLQueryRec,"UniqueID","POINT") inDestinationName = prov inSQLQueryProv = "Select * from PCPToRecipRatio.dbo." + prov print inSQLQueryProv inDestinationFeatures = arcpy.MakeQueryLayer_management(inDestinationProvidersFilePath,prov,inSQLQueryProv,"UniqueRecordID","POINT") Thanks, Matt
... View more
09-24-2015
10:18 AM
|
0
|
3
|
257
|
POST
|
Melinda, I will look into the syntax but that is the syntax that gets exported from model builder. If I am doing something with many options i will sometimes create a sample in modelbuilder to see what the syntax should be. I think I may have found the issue and I think it has to do with the query layers as my inputs. I exported my data as file geodatabase feature classes and ran them through both arcmap and my python code and I got the same result. I want to try and perform this on my full datasets to confirm my results. If this really is the case that query layers are causing the problem then this is going to add a bunch of processing time to my project. Any thoughts on why query layers would cause a problem. They visually look good and perform pretty well in arcmap. Thank you so much for looking into this with me. Thanks, Matt
... View more
09-24-2015
10:07 AM
|
0
|
5
|
257
|
POST
|
Melinda, At the end of the process i split the name at the dash and join up other data based on the ID. Then I take the first destination and find all records that were within 5, 15 miles and 12 and 35 minutes and get a count. These counts are different between python and ArcMap. If i input the same origins and destinations i would expect that the distances returned would be the same. Yes i get the same answer with different runs in python using the same data. I haven't checked this in ArcMap but based on past runs i believe i do. Also not sure if you caught that i wrote when i load the data in python there are some records that are not located on the network but when i load them in arcmap they are located. This leads me to lean towards there being something with the add locations but i am not sure. Thanks, Matt
... View more
09-24-2015
08:51 AM
|
0
|
7
|
652
|
POST
|
Hi Melinda, here is the make OD cost matrix code - /****************************/ #Sets the location of the network dataset and the name of the OD Cost Matrix inNetworkDataset = "Drive:\NetworkAnalysisTesting\Network_w_Time_NAD83.gdb\Updated_LenMin_ND\Streets_Updated_LenMin_ND_ND" outNALayerName = "OD_Cost_Matrix" impedanceAttribute = "Length_Miles_Recalc" searchTolerance = "5000 Meters" odOrigins = "Origins" #Create a new OD cost matrix analysis layer. For this scenario, the default #value for all the remaining parameters satisfies the analysis requirements print "I am about to make an OD Layer" outNALayer = arcpy.na.MakeODCostMatrixLayer(inNetworkDataset, outNALayerName, impedanceAttribute,"",3,"Length_Miles_Recalc;Minutes_recalc","ALLOW_UTURNS","Oneway") here is the load locations code /*******************************************/ #Load origins as destinations print "I am about to load the destinations - " + inDestinationName arcpy.na.AddLocations(outNALayer,destinationsLayerName,inDestinationFeatures,"Name UniqueRecordID #", searchTolerance,"UniqueRecordID","Streets_Updated_LenMin SHAPE;Streets_Updated_LenMin_ND_ND_Junctions NONE","MATCH_TO_CLOSEST","CLEAR","NO_SNAP","#","INCLUDE") print "Load Destinations complete" #Load origins print "I am about to load the Origins - " + inOriginName arcpy.na.AddLocations(outNALayer,originsLayerName,inOriginFeatures,"Name UniqueID #",searchTolerance,"UniqueID","Streets_Updated_LenMin SHAPE;Streets_Updated_LenMin_ND_ND_Junctions NONE","MATCH_TO_CLOSEST","CLEAR","NO_SNAP","#","INCLUDE") print "Load Origins complete" Thanks, Matt
... View more
09-24-2015
08:16 AM
|
0
|
9
|
652
|
POST
|
HI Freddie, I did as you suggested and ran the script standalone, in the python window and in arcmap and it seems it may not be the solver. ArcMap loads and finds a few more destinations then when the loading happens in python. Thanks, Matt
... View more
09-24-2015
08:00 AM
|
0
|
0
|
652
|
POST
|
I have never done python in the python window. Would what you are suggesting just be a copy paste and run? Thanks, Matt
... View more
09-24-2015
07:06 AM
|
0
|
1
|
652
|
POST
|
I am sorry but I can't for this data. The only other variable i can think if is the data is being run is a query layer.
... View more
09-24-2015
06:38 AM
|
0
|
0
|
652
|
POST
|
Hi, I am working on automating OD cost matrix runs and am trying to figure out why running the data in arcpy gives a significantly different result then when run in arcmap. I have checked every setting (i believe) and they all seem to be the same. It uses the same network and the same origins and destinations. At first i thought it might have been a projection issue and i have tested the runs with everything in the same projection and still the results are different. Does anyone have any idea on why this would be? Thanks, Matt
... View more
09-24-2015
06:07 AM
|
0
|
16
|
3721
|
POST
|
i figured out my own solution by building my ranges my self from the classBreakValues lower_range1 = "{:.1f}".format(lyr.symbology.classBreakValues[0]) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[1]) lower_range2 = "{:.1f}".format(lyr.symbology.classBreakValues[1] + .1) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[2]) lower_range3 = "{:.1f}".format(lyr.symbology.classBreakValues[2] + .1) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[3]) lower_range4 = "{:.1f}".format(lyr.symbology.classBreakValues[3] + .1) + " - " + "{:.1f}".format(lyr.symbology.classBreakValues[4]) output 15.4 - 24.6 24.7 - 28.5 28.6 - 34.6 34.7 - 60.3 I still say it would be much easier if these were settings of GRADUATED_COLORS symbology. Thanks all, Matt
... View more
03-26-2015
01:30 PM
|
0
|
0
|
594
|
POST
|
Hi, As stated above it seems to only allow you to add text to the ranges. Thanks, Matt
... View more
03-26-2015
11:23 AM
|
0
|
0
|
594
|
POST
|
Hi Keith, I looked into this before but all it seems to do is allow me to add more text to the range. Ex. 1.25-2.45 - without description 1.25-2.45 test - with description added. Thanks for the thought! Matt
... View more
03-26-2015
11:21 AM
|
0
|
0
|
594
|
POST
|
Hi All, I have been looking for about 2 days and I can't seem to figure out or find a work around for the symbology labels after a reclassify when trying to automate maps. I run the following code and it is almost doing exactly what i want it to do. After I change a data source path I run the following 2 lines of code. The layer is set to have the colors i want and the numbers match what should be there. The only issue is the display of the labels for the classification. arcpy.mapping.UpdateLayer(df, lyr, updateLayer, True) lyr.symbology.reclassify() The map is set to have 1 decimal place as is the layer file but after the reclass is set to 4 significant digits. Does anyone have any thoughts? This is the one thing i need to fully automate the maps i am working on. It seems crazy that after doing a change path and a reclass that i have to open the mxd reset the layer properties and then update notes that i have generated based on the new classes with the update ranges. Thanks Matt
... View more
03-26-2015
09:47 AM
|
0
|
5
|
3283
|
POST
|
Hi all, I have changed the way i am going about updating the layers symbology and reclassify still isn't doing what the help says it should (I have pasted the help below). sourceLayer = arcpy.mapping.Layer(r"M:\TestChangePath\ReclassTest\AsthmaPrevColorRampBlueSept_NoOutline.lyr") sourceLayer.symbology.valueField = "DiseaseFlags_SumByZCTA_Adult.Prev_COPD" My code below takes a layerfile and changes the classification value field. The Legend and TOC still show the layerfile's ranges from the origional field. The map draws with the new data but the old ranges. for lyr in arcpy.mapping.ListLayers(mxd):
print lyr.name
updateLayer = lyr
print updateLayer.name
if lyr.name == "Prevalence Rate per 1,000":
arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer, False)
updateLayer.symbology.reclassify()
lyr.symbology.reclassify() Any thoughts? Thanks, Matt "The reclassify method updates a layer's symbology properties based on the underlying source data. It is useful when a layer's symbology is updated using the UpdateLayer function with symbology stored in another layer or layer file (.lyr). For example, let's say you want to update the color properties of the symbology of a layer in a map document with the symbology stored in a layer file. However, the layer in the map document and the layer file have different data sources. The minimum and maximum values and class breaks in the layer file may be different than the layer in the map document. Updating the symbology of the layer in the map document with the symbology stored in the layer file may produce unintended results (for example, the class break values will match the layer file's data source statistics as opposed to the map document layer's data source statistics. However, if you follow UpdateLayer with the reclassify() method, the end result is like using the color properties from the symbology in the layer file, but other characteristics are based on the map document layer's underlying source data."
... View more
06-04-2014
07:16 AM
|
0
|
0
|
198
|
POST
|
Hi, I have written a script that updates all the datasources in an mxd. There are 2 layers that have a graduated color ramp classified by 4 classes Quartile and saves it as a new document. I am under the impression that the code below should show the data changes but when i open the mxd they haven't changed from the old data but when i go into classification the numbers will update. Any thoughts or am i not using reclassify properly? for lyr in arcpy.mapping.ListLayers(mxd):
if lyr.supports("symbologyType"):
if lyr.symbologyType == "GRADUATED_COLORS":
print lyr.name
lyr.symbology.reclassify()
else:
print layer.name + "Not a layer with GRADUATED_COLORS"
else:
print layer.name + "Doesn't support symbologyType" Thanks, Matt
... View more
06-03-2014
04:27 AM
|
0
|
1
|
884
|
POST
|
Well I got it to load in Chrome but not IE or Firefox. Very interesting! Matt
... View more
05-27-2014
04:43 AM
|
0
|
0
|
602
|
Title | Kudos | Posted |
---|---|---|
1 | 12-15-2015 10:40 AM | |
1 | 06-16-2016 05:51 AM | |
1 | 05-26-2014 11:46 AM | |
1 | 05-04-2016 10:20 AM | |
1 | 12-11-2015 10:02 AM |
Online Status |
Offline
|
Date Last Visited |
09-01-2023
03:16 PM
|