Guest User

Untitled

a guest
Apr 6th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. from arcgis.gis import GIS
  2. from arcgis.features import Feature, FeatureCollection, FeatureLayer, FeatureSet
  3. from arcgis.features.use_proximity import find_nearest
  4. from arcgis.geocoding import Geocoder
  5. import logging, os, requests
  6.  
  7.  
  8. if __name__ == "__main__":
  9. username = ************
  10. passwrd = *************
  11. log_filename = "log/open_spaces_log"
  12. try:
  13. os.remove(log_filename)
  14. except OSError:
  15. pass
  16. logging.basicConfig(filename=log_filename, level=logging.DEBUG)
  17. my_address = "94 Sawyer Ave., Boston, MA, 02125"
  18. g = GIS(username = username, password=passwrd)
  19. logging.debug("Using address: %s" % my_address)
  20. logging.debug("getting open spaces feature layer")
  21. near_layer = _get_open_spaces()
  22. assert near_layer, "something went wrong with the near_layer"
  23. logging.debug("now we're trying to get the address into its on feature_layer")
  24. coded_address = Geocoder(my_address, g)
  25. address_as_feature = Feature('point', coded_address)
  26. analysis_layer = FeatureCollection(address_as_feature.as_dict)
  27. find_nearest(analysis_layer, near_layer)
Add Comment
Please, Sign In to add comment