Updating Address Locator in Portal

667
3
03-31-2020 05:40 PM
JimLugosi
New Contributor III

Hey folks,

Got a question regarding updating of data within my Address Locator that I have shared to our Portal Env.  The data within our Address Locator is referencing a file geodatabase that resides on our ArcGIS Server.  The file geodatabase has been registered with our Datastore so we don't have data copied to the managed Datastore (PostgreSQL).  The file geodatabase is updated on a weekly basis.  Will I also need to update the Address Locator in Portal?  Since the source data is updated I'm thinking I will most likely need to run a rebuild and overwrite the existing Locator Service in Portal.

Any thoughts or suggestions would be appreciated.

UPDATE: Looks like I might have found my answer

Rebuilding address locators using a geoprocessing tool—Help | Documentation 

"When you make edits to your geocoding reference data, either by adding or deleting features or rows or by editing the address attributes they contain, you must rebuild your address locator if you want to geocode addresses against the current version of the reference data. "

So, I wrote a Python script to stop the locator service, rebuild the locator service and start the service back up.  Easy as py.

Thanks

0 Kudos
3 Replies
PaulDavidson1
Regular Contributor

We rebuild the locators weekly, just after updating the file.gdbs

Logically it seems to make sense

-Paul Davidson

0 Kudos
JonPainter
New Contributor II

Hello Jim,

Do you mind sharing your code? This is something I would like to do.

Thanks

Jon

0 Kudos
JimLugosi
New Contributor III

import arcpy,os,sys,time
from arcpy import env
env.workspace = "<location_of_data>"

# Set local variables:
address_locator = "Parcel_Maptaxlot_Gazetteer_Locator"

try:
   # Stop the locator service on ArcGIS Server
   print "Stopping " + address_locator

   # Another Python script to stop services
   os.system("agsserver_service_start_stop.py STOP")
   print "Finished stopping service"
   time.sleep(15)

   # Rebuild locator
   print "Start rebuilding: " + address_locator
   arcpy.RebuildAddressLocator_geocoding(address_locator)
   print "Finished rebuilding: " + address_locator
   time.sleep(15)

   # Start the locator service on ArcGIS Server
   print "Starting " + address_locator
   os.system("agsserver_service_start_stop.py START")
   print "Finished starting service"

except:

   print "There was a problem"
   print os.sys.exc_info()[1]

0 Kudos