|
POST
|
One reason I've seen this occur is if the computer has essentially run out of memory (though it seems to be running normally). For example, if it has been on for several hours while several programs were open. Rebooting the computer resolves it. Chris Donohue, GISP
... View more
02-03-2015
10:06 AM
|
0
|
0
|
2282
|
|
POST
|
Coolness - that worked! Thanks for your expertise, Darren. This is not only helped me solve a specific issue but has given me more understanding on how Python can be used. Here's the final code that worked: def StreetSuffix(FacilityAddress): list = FacilityAddress.split() for item in range(len(list)): if list[item] == 'ALLEY': list[item] = list[item].replace("ALLEY", "AL") if list[item] == 'AL.': list[item] = list[item].replace("AL.", "AL") if list[item] == 'AVENUE': list[item] = list[item].replace("AVENUE", "AV") if list[item] == 'AVNUE': list[item] = list[item].replace("AVNUE", "AV") if list[item] == 'AVE.': list[item] = list[item].replace("AVE.", "AV") if list[item] == 'AVE': list[item] = list[item].replace("AVE", "AV") if list[item] == 'BOULEVARD': list[item] = list[item].replace("BOULEVARD", "BL") if list[item] == 'BLVD': list[item] = list[item].replace("BLVD", "BL") if list[item] == 'BL.': list[item] = list[item].replace("BL.", "BL") if list[item] == 'CIRCLE': list[item] = list[item].replace("CIRCLE", "CI") if list[item] == 'CI.': list[item] = list[item].replace("CI.", "CI") if list[item] == 'COURT': list[item] = list[item].replace("COURT", "CT") if list[item] == 'CT.': list[item] = list[item].replace("CT.", "CT") if list[item] == 'DRIVE': list[item] = list[item].replace("DRIVE", "DR") if list[item] == 'DR.': list[item] = list[item].replace("DR.", "DR") if list[item] == 'HILL': list[item] = list[item].replace("HILL", "HL") if list[item] == 'HL.': list[item] = list[item].replace("HL.", "HL") if list[item] == 'LANE': list[item] = list[item].replace("LANE", "LN") if list[item] == 'LN.': list[item] = list[item].replace("LN.", "LN") if list[item] == 'LOOP': list[item] = list[item].replace("LOOP", "LP") if list[item] == 'PLACE': list[item] = list[item].replace("PLACE", "PL") if list[item] == 'PL.': list[item] = list[item].replace("PL.", "PL") if list[item] == 'PARKWAY': list[item] = list[item].replace("PARKWAY", "PW") if list[item] == 'PKWY': list[item] = list[item].replace("PKWY", "PW") if list[item] == 'PLAZA': list[item] = list[item].replace("PLAZA", "PZ") if list[item] == 'PZ.': list[item] = list[item].replace("PZ.", "PZ") if list[item] == 'ROAD': list[item] = list[item].replace("ROAD", "RD") if list[item] == 'RD.': list[item] = list[item].replace("RD.", "RD") if list[item] == 'SQUARE': list[item] = list[item].replace("SQUARE", "SQ") if list[item] == 'SQ.': list[item] = list[item].replace("SQ.", "SQ") if list[item] == 'STREET': list[item] = list[item].replace("STREET", "ST") if list[item] == 'STR.': list[item] = list[item].replace("STR.", "ST") if list[item] == 'ST.': list[item] = list[item].replace("ST.", "ST") if list[item] == 'WAY': list[item] = list[item].replace("WAY", "WY") if list[item] == 'WY.': list[item] = list[item].replace("WY.", "WY") return " ".join(list) Chris Donohue, GISP
... View more
01-29-2015
02:28 PM
|
0
|
0
|
4552
|
|
POST
|
I modified the code to Darren's List/Split idea [EDIT2] and it ran without error, but no changes appear to made to the suffixes. Here's the Python code: def StreetSuffix(FacilityAddress): list = FacilityAddress.split() for item in list: item.replace('ALLEY', 'AL') item.replace('AL.', 'AL') item.replace('AVENUE', 'AV') item.replace('AVE.', 'AV') item.replace('AVE', 'AV') item.replace('AV.', 'AV') item.replace('BOULEVARD', 'BL') item.replace('BLVD', 'BL') item.replace('BL.', 'BL') item.replace('CIRCLE', 'CI') item.replace('CI.', 'CI') item.replace('COURT', 'CT') item.replace('CT.', 'CT') item.replace('DRIVE', 'DR') item.replace('DR.', 'DR') item.replace('HILL', 'HL') item.replace('HL.', 'HL') item.replace('LANE', 'LN') item.replace('LN.', 'LN') item.replace('LOOP', 'LP') item.replace('PLACE', 'PL') item.replace('PL.', 'PL') item.replace('PARKWAY', 'PW') item.replace('PKWY', 'PW') item.replace('PLAZA', 'PZ') item.replace('PZ.', 'PZ') item.replace('RD.', 'RD') item.replace('SQ.', 'SQ') item.replace('STREET', 'ST') item.replace('ST.', 'ST') item.replace('WAY', 'WY') item.replace('WY.', 'WY') return " ".join(list) Did I forget something? Is there a way to tell if the issue is that it didn't detect anything to replace, or that it did try to replace stuff but the process is not finalizing that correctly? Chris Donohue, GISP
... View more
01-29-2015
10:55 AM
|
0
|
2
|
4552
|
|
POST
|
In regards to the splitting the string idea [EDIT 2], how are individual strings recognized? Does the "split" see the spaces as limits of a string? Chris Donohue, GISP
... View more
01-29-2015
10:37 AM
|
0
|
3
|
4552
|
|
POST
|
DOH! Now I see it - of course after I posted it. Typo in "newString" - I have it in the code block as "newSting" (r missing). Let me fix that and try it again. Chris Donohue, GISP
... View more
01-29-2015
10:27 AM
|
0
|
0
|
4552
|
|
POST
|
Here's the code: def StreetSuffix(FacilityAddress): newSting = FacilityAddress.replace(' ALLEY', ' AL') newSting = FacilityAddress.replace(' AL.', ' AL') newSting = FacilityAddress.replace(' AVENUE', ' AV') newSting = FacilityAddress.replace(' AVE.', ' AV') newSting = FacilityAddress.replace(' AVE', ' AV') newSting = FacilityAddress.replace(' AV.', ' AV') newSting = FacilityAddress.replace(' BOULEVARD', ' BL') newSting = FacilityAddress.replace(' BLVD', ' BL') newSting = FacilityAddress.replace(' BL.', ' BL') newSting = FacilityAddress.replace(' CIRCLE', ' CI') newSting = FacilityAddress.replace(' CI.', ' CI') newSting = FacilityAddress.replace(' COURT', ' CT') newSting = FacilityAddress.replace(' CT.', ' CT') newSting = FacilityAddress.replace(' DRIVE', ' DR') newSting = FacilityAddress.replace(' DR.', ' DR') newSting = FacilityAddress.replace(' HILL', ' HL') newSting = FacilityAddress.replace(' HL.', ' HL') newSting = FacilityAddress.replace(' LANE', ' LN') newSting = FacilityAddress.replace(' LN.', ' LN') newSting = FacilityAddress.replace(' LOOP', ' LP') newSting = FacilityAddress.replace(' LP.', ' LP') newSting = FacilityAddress.replace(' PLACE', ' PL') newSting = FacilityAddress.replace(' PL.', ' PL') newSting = FacilityAddress.replace(' PARKWAY', ' PW') newSting = FacilityAddress.replace(' PKWY', ' PW') newSting = FacilityAddress.replace(' PLAZA', ' PZ') newSting = FacilityAddress.replace(' PZ.', ' PZ') newSting = FacilityAddress.replace(' ROAD', ' RD') newSting = FacilityAddress.replace(' RD.', ' RD') newSting = FacilityAddress.replace(' SQUARE', ' SQ') newSting = FacilityAddress.replace(' SQ.', ' SQ') newSting = FacilityAddress.replace(' STREET', ' ST') newSting = FacilityAddress.replace(' ST.', ' ST') newSting = FacilityAddress.replace(' WAY', ' WY') newSting = FacilityAddress.replace(' WY.', ' WY') return newString
... View more
01-29-2015
10:25 AM
|
0
|
1
|
4552
|
|
POST
|
I edited the code to change the double-quotes to single quotes and removed the ! ! from around the FacilityAddress in the code block. In an attempt to refine the replacement to not replace non-Suffixes by accident, I compromised on the spacing for the strings by using a space in front of the suffix but not behind it. However, when I run it, I get an error: Does 'newString' need to be defined as a variable? How does Python handle that? Chris Donohue, GISP
... View more
01-29-2015
10:20 AM
|
0
|
2
|
4552
|
|
POST
|
Thanks for the input Darren. Let me edit the code and give it a try. Chris Donohue, GISP
... View more
01-29-2015
09:40 AM
|
0
|
0
|
4552
|
|
POST
|
I have a beginning Python question I was hoping could be answered. I'm trying to use Replace to change out street suffixes in a field [FacilityAddress] as there are many inconsistencies with how they were entered in a dataset that we need to clean up. For example, there can be address entries with "STREET", "ST.", and "ST", and we need them all to be standardized to "ST". While I can individually make each Replace work by doing one statement at a time in Field Calculator, I am hoping to find a way to run them all at once. However, when I try to run them all at once, I get an "Invalid Syntax in Line 1" error. So my questions are this: 1. I'm assuming the code to run all the replaces at once needs to go in the "Pre-logic Script Code" area, correct? 2. Do I need the "def" (definition statement) when using Replace? 3. Do I need to add "If Then Else" branching? 3. Is the import.re (import regexes) necessary? 4. Do I need to change the code to prevent the replacement from changing out non-suffixes? For example, I have an address of "699 SHASTA ST RM 1,2,3" (see image above). Will the replacement see the "ST" in the street name "SHASTA and operate on it. I know it's probably moot in this specific case, but I would like to know should we do a diffferent suffix selection. For example, if we want to change all the streets to "STREET", would "SHASTA" become "SHASTREETTA"? 5. What is causing the syntax error in line 1? Here's the code I came up with so far: ---------------- def StreetSuffix(!FacilityAddress!): import re !FacilityAddress!.replace("ALLEY", "AL") !FacilityAddress!.replace("AL.", "AL") !FacilityAddress!.replace("AVENUE", "AV") !FacilityAddress!.replace("AVE.", "AV") !FacilityAddress!.replace("AVE", "AV") !FacilityAddress!.replace("AV.", "AV") !FacilityAddress!.replace("BOULEVARD", "BL") !FacilityAddress!.replace("BLVD", "BL") !FacilityAddress!.replace("BL.", "BL") !FacilityAddress!.replace("CIRCLE", "CI") !FacilityAddress!.replace("CI., "CI") !FacilityAddress!.replace("COURT", "CT") !FacilityAddress!.replace("CT.", "CT") !FacilityAddress!.replace("DRIVE", "DR") !FacilityAddress!.replace("DR.", "DR") !FacilityAddress!.replace("HILL", "HL") !FacilityAddress!.replace("HL.", "HL") !FacilityAddress!.replace("LANE", "LN") !FacilityAddress!.replace("LN.", "LN") !FacilityAddress!.replace("LOOP", "LP") !FacilityAddress!.replace("LP.", "LP") !FacilityAddress!.replace("PLACE", "PL") !FacilityAddress!.replace("PL.", "PL") !FacilityAddress!.replace("PARKWAY", "PW") !FacilityAddress!.replace("PKWY", "PW") !FacilityAddress!.replace("PLAZA", "PZ") !FacilityAddress!.replace("PZ.", "PZ") !FacilityAddress!.replace("ROAD", "RD") !FacilityAddress!.replace("RD.", "RD") !FacilityAddress!.replace("SQUARE", "SQ") !FacilityAddress!.replace("SQ.", "SQ") !FacilityAddress!.replace("STREET", "ST") !FacilityAddress!.replace("ST.", "ST") !FacilityAddress!.replace("WAY", "WY") !FacilityAddress!.replace("WY.", "WY") return StreetSuffix ---------- FacilityAddress = StreetSuffix(!FacilityAddress!) -------- Thanks in advance, Chris Donohue, GISP
... View more
01-29-2015
08:53 AM
|
0
|
9
|
10709
|
|
POST
|
To elaborate on Saul's suggestion, it may also help to use the specific Copy function in Excel instead of the generic Copy/Paste. Specifically - use the "Copy" button and choose "Copy as Picture". Resist the urge to automatically use the Right-click Copy/Paste or the Control-C/Control-V. In the next screen, you can choose from two "Appearances". Usually the "As shown when printed" works best, but not always. Then try Pasting this in to your layout or adding it as a picture. Chris Donohue, GISP
... View more
01-28-2015
12:04 PM
|
1
|
2
|
6627
|
|
POST
|
The files you saw are a shapefile, which is usually just one dataset of many that go into a typical map. I suspect what you really want to see is the full map layout. That would be file with the extension .mxd, or if you have older ESRI software, .avl. Check to see if you have these, and if so, open them. These Layouts combine the shapefiles (and other data sources) with symbology to produce the final presented map. Chris Donohue, GISP
... View more
01-27-2015
02:18 PM
|
0
|
0
|
1872
|
|
POST
|
Another option if you have either the Spatial Analyst Extension or the 3D Analyst Extension is to derive contours so you can get a visual sense of the elevations. ArcGIS Help (10.2, 10.2.1, and 10.2.2) Chris Donohue, GISP
... View more
01-27-2015
08:05 AM
|
0
|
0
|
765
|
|
POST
|
Xander has a good point. Check that your data meets all the requirements. For example, to use this tool, one needs to have topology with all the layers participating: Align Edge uses a topology to determine the edges and which features will be updated, so you need to have either a map or geodatabase topology in your map to use this tool. Click Select Topology on the Topology toolbar to set up the topology. You can only use this tool to align edges that are in layers you are currently editing and that are currently participating in the active topology. Chris Donohue, GISP
... View more
01-22-2015
10:18 AM
|
0
|
2
|
2134
|
|
POST
|
Another troubleshooting idea/process: Copy the data from your assets management to a File Geodatabase. If it is too massive, just grab the road data near your problem areas. Then try Network Analysis on that data. When your issue reccurs (likely), try some of the solutions people have posted here. The goal here is to determine the specific issue, knowing that it may not immediately be correctable in your "real" data. Having a dataset that you can play with and modify will go a long way in terms of finding the issue. Chris Donohue, GISP
... View more
01-21-2015
11:00 AM
|
2
|
0
|
2764
|
|
POST
|
I know what you mean about not being able to replace the data. I recently started working for a mid-sized city and have found that some of the data sets I need to work with are not as clean or complete as needed for what is expected. But those datasets are owned in SDE by other departments, so I can't change them directly. And those departments are shorthanded and have other priorities than fixing their data. So I'm having to do workarounds to address or bypass issues their data has so I can then do the analysis' my department needs done. Frustrating..... Chris Donohue, GISP
... View more
01-21-2015
08:13 AM
|
2
|
0
|
2764
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-18-2015 12:04 PM | |
| 1 | 09-29-2015 12:41 PM | |
| 1 | 11-29-2018 07:51 AM | |
| 1 | 05-08-2018 02:07 PM | |
| 1 | 07-26-2016 07:53 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-03-2022
01:39 PM
|