Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from arcgis.gis import GIS
- from arcgis.features import Feature, FeatureCollection, FeatureLayer, FeatureSet
- from arcgis.features.use_proximity import find_nearest
- from arcgis.geocoding import Geocoder
- import logging, os, requests
- if __name__ == "__main__":
- username = ************
- passwrd = *************
- log_filename = "log/open_spaces_log"
- try:
- os.remove(log_filename)
- except OSError:
- pass
- logging.basicConfig(filename=log_filename, level=logging.DEBUG)
- my_address = "94 Sawyer Ave., Boston, MA, 02125"
- g = GIS(username = username, password=passwrd)
- logging.debug("Using address: %s" % my_address)
- logging.debug("getting open spaces feature layer")
- near_layer = _get_open_spaces()
- assert near_layer, "something went wrong with the near_layer"
- logging.debug("now we're trying to get the address into its on feature_layer")
- coded_address = Geocoder(my_address, g)
- address_as_feature = Feature('point', coded_address)
- analysis_layer = FeatureCollection(address_as_feature.as_dict)
- find_nearest(analysis_layer, near_layer)
Add Comment
Please, Sign In to add comment