conda create -n py36 python=3.6
activate py36
conda install -c esri arcgis
from arcgis.gis import GIS
my_gis = GIS()
my_gis.map()
MapView(layout=Layout(height='400px', width='100%'))
from arcgis.gis import GIS
gis = GIS()
public_content = gis.content.search("Fire", item_type="Feature Layer", max_items=5)
public_content
[<Item title:"מיפוי שריפה חדש" type:Feature Layer Collection owner:kkl_arcgis_10>, <Item title:"Intact Forest Landscapes (2000)" type:Feature Layer Collection owner:GlobalForestWatch>, <Item title:"WRI_BeforeAndAfterPhotos" type:Feature Layer Collection owner:FireFFSL>, <Item title:"Social Vulnerability 2010" type:Feature Layer Collection owner:AtlasPublisher>, <Item title:"GIS_Export" type:Feature Layer Collection owner:baszlera>]
from IPython.display import display
for item in public_content:
display(item)
map1 = gis.map('Collier County, FL')
map1
MapView(layout=Layout(height='400px', width='100%'))
#get the first item
fire = public_content[0]
#add to map
map1.add_layer(fire)
from arcgis.gis import GIS
from arcgis.raster.functions import *
gis = GIS()
landsat_item = gis.content.search('"Landsat Multispectral"', 'Imagery Layer')[0]
landsat_item
landsat = landsat_item.layers[0]
def extract_stretch(bandids):
return stretch(extract_band(landsat, bandids),
stretch_type='PercentClip',
min_percent=2,
max_percent=2,
dra=True,
gamma=[0.8,0.8,0.8])
from arcgis.geocoding import geocode
area = geocode('Cambridge Gulf')[0]
m = gis.map(area, 10)
m
MapView(layout=Layout(height='400px', width='100%'), zoom=10.0)
m.add_layer(extract_stretch([5, 4, 1]))
m2 = gis.map("Guelb Er Richat", 11)
m2
MapView(layout=Layout(height='400px', width='100%'), zoom=11.0)
m2.add_layer(extract_stretch([6, 3, 1]))
m3 = gis.map("Gosses Bluff", 10)
m3
MapView(layout=Layout(height='400px', width='100%'), zoom=10.0)
m3.add_layer(extract_stretch([6, 3, 0]))
m4 = gis.map("Great Exumas, Bahamas", 11)
m4
MapView(layout=Layout(height='400px', width='100%'), zoom=11.0)
m4.add_layer(extract_stretch([5, 3, 0]))
m5 = gis.map("Mexico City", 10)
m5
MapView(layout=Layout(height='400px', width='100%'), zoom=10.0)
m5.add_layer(extract_stretch([6, 5, 3]))
m6 = gis.map("Ash Simasiyah, Saudi Arabia", 12)
m6
MapView(layout=Layout(height='400px', width='100%'), zoom=12.0)
m6.add_layer(extract_stretch([5, 4, 1]))