Solved! Go to Solution.
def makeLink(pID): return 'http://www.fbcad.org/Appraisal/PublicAccess/PropertyDetail.aspx?PropertyID=' + str(pID)
makeLink( !PropertyID!)
http://www.../parcels/1197.html
def makeLink(pID): return 'http://www.fbcad.org/Appraisal/PublicAccess/PropertyDetail.aspx?PropertyID=' + str(pID)
makeLink( !PropertyID!)
That worked perfectly Stacy! Thanks!
I did find, however, that ArcMap would time out trying to get the entire County done (about 250,000 parcels). Luckily that is fine because I already had to trim the data down in order to upload to ArcGIS Online and just used that Feature Class instead of the entire County.
I just got a good beginner Python book and this makes me more excited to start reading it.
Jonathan
Yes, the calculate field tool can be painfully slow. If you do need to work on larger datasets you can use UpdateCursor from a Python script (or maybe from the Python window in ArcMap although I have never tried it...).
Interestingly, this solution wasn't really Python at all - VB Script could have done it too. The biggest step is figuring out how the website is laid out and how that relates to the information you have.
Great news on the Python book! I am working on some blog posts at the moment which are intended to help GIS users learn Python and Arcpy programming, so keep an eye on that (link below) - keen to hear if you have any particular questions!
## pre-calculation here, i.e. adding fields... # note that fc is the feature class... with arcpy.da.UpdateCursor(fc, ['PropertyID', 'Webpage']) as cursor: for row in cursor: ## row is a list where PropertyID is row[0], Webpage is row[1] row[1] = 'http://www.fbcad.org/Appraisal/PublicAccess/PropertyDetail.aspx?PropertyID=' + str(row[0]) cursor.updateRow(row)
# Import Arcpy import arcpy from arcpy import env # Set the Workspace env.workspace = "J:\\GIS\\Parcel_Data\\Python_Data\\CAMASUMMARY.shp" # Define Variables inFeatures = "CAMASUMMARY" fieldName1 = "Webpage" fieldLength = 100 # Add the Webpage field to the parcel data arcpy.AddField_management (inFeatures, fieldName1, "TEXT", "", "", fieldLength) # Define the shapefile used below (CAMASUMMARY) fc = "J:\\GIS\\Parcel_Data\\Python_Data\\CAMASUMMARY.shp" # Update the Webpage field with arcpy.da.UpdateCursor(fc, ['QUICKREFID', 'Webpage']) as cursor: for row in cursor: ## row is a list where QUICKREFID is row[0], Webpage is row[1] row[1] = 'http://www.fbcad.org/Appraisal/PublicAccess/PropertyDetail.aspx?PropertyID=' + str(row[0]) cursor.updateRow(row)
Thanks Stacy! I did some minor tweaking but got it to work. I originally had a script just for adding fields but I think it will be easier if I just add the needed fields and do the required processing in one script (well 3 scripts total since there are 3 fields I need to add and manipulate).
Here is what worked for me:
# Import Arcpy import arcpy from arcpy import env # Set the Workspace env.workspace = "J:\\GIS\\Parcel_Data\\Python_Data\\CAMASUMMARY.shp" # Define Variables inFeatures = "CAMASUMMARY" fieldName1 = "Webpage" fieldLength = 100 # Add the Webpage field to the parcel data arcpy.AddField_management (inFeatures, fieldName1, "TEXT", "", "", fieldLength) # Define the shapefile used below (CAMASUMMARY) fc = "J:\\GIS\\Parcel_Data\\Python_Data\\CAMASUMMARY.shp" # Update the Webpage field with arcpy.da.UpdateCursor(fc, ['QUICKREFID', 'Webpage']) as cursor: for row in cursor: ## row is a list where QUICKREFID is row[0], Webpage is row[1] row[1] = 'http://www.fbcad.org/Appraisal/PublicAccess/PropertyDetail.aspx?PropertyID=' + str(row[0]) cursor.updateRow(row)
# Import Arcpy import arcpy from arcpy import env # Set the Workspace env.workspace = "J:\\GIS\\Parcel_Data\\Python_Data\\CAMASUMMARY.shp" # Define Variables inFeatures = "CAMASUMMARY" # Define the shapefile used below (CAMASUMMARY) fc = "J:\\GIS\\Parcel_Data\\Python_Data\\CAMASUMMARY.shp" fieldName1 = "Webpage" fieldLength = 100 # Add the Webpage field to the parcel data arcpy.AddField_management (fc, fieldName1, "TEXT", "", "", fieldLength) # Define the shapefile used below (CAMASUMMARY) fc = "J:\\GIS\\Parcel_Data\\Python_Data\\CAMASUMMARY.shp" # Update the Webpage field with arcpy.da.UpdateCursor(fc, ['QUICKREFID', fieldName1]) as cursor: for row in cursor: ## row is a list where QUICKREFID is row[0], Webpage is row[1] row[1] = 'http://www.fbcad.org/Appraisal/PublicAccess/PropertyDetail.aspx?PropertyID=' + str(row[0]) cursor.updateRow(row)