You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
??? danger "Unprotected data only; SSI coming soon:"
5
+
At this time, our Geospatial server can only host and provide access to non-sensitive statistical information.
6
+
7
+
## Getting Started
8
+
9
+
<!-- prettier-ignore -->
10
+
??? success "Prerequisites"
11
+
1. An onboarded project with access to DAS GAE ArcGIS Portal
12
+
2. An ArcGIS Portal Client Id (API Key)
13
+
14
+
The ArcGIS Enterprise Portal can be accessed in either the AAW or CAE using the API, from any service which leverages the Python programming language.
15
+
16
+
For example, in AAW and the use of [Jupyter Notebooks](https://statcan.github.io/daaas/en/1-Experiments/Jupyter/) within the space, or in CAE the use of [Databricks](https://statcan.github.io/cae-eac/en/DataBricks/), DataFactory, etc.
17
+
18
+
[The DAS GAE ArcGIS Enterprise Portal can be accessed directly here](https://geoanalytics.cloud.statcan.ca/portal)
19
+
20
+
[For help with self-registering as a DAS Geospatial Portal user](https://statcan.github.io/daaas-dads-geo/english/portal/)
21
+
22
+
<hr>
23
+
24
+
## Using the ArcGIS API for Python
25
+
26
+
### Connecting to ArcGIS Enterprise Portal using ArcGIS API
print("Successfully logged in as: " + gis.properties.user.username)
52
+
```
53
+
54
+
4.- The output will redirect you to a login Portal.
55
+
- Use the StatCan Azure Login option, and your Cloud ID
56
+
- After successful login, you will receive a code to sign in using SAML.
57
+
- Paste this code into the output.
58
+
59
+
60
+

61
+
62
+
<hr>
63
+
64
+
### Display user information
65
+
Using the 'me' function, we can display various information about the user logged in.
66
+
```python
67
+
me = gis.users.me
68
+
username = me.username
69
+
description = me.description
70
+
display(me)
71
+
```
72
+
73
+
<hr>
74
+
75
+
### Search for Content
76
+
Search for the content you have hosted on the DAaaS Geo Portal. Using the 'me' function we can search for all of the hosted content on the account. There are multiple ways to search for content. Two different methods are outlined below.
77
+
78
+
**Search all of your hosted itmes in the DAaaS Geo Portal.**
79
+
```python
80
+
my_content = me.items()
81
+
my_content
82
+
```
83
+
**Search for specific content you own in the DAaaS Geo Portal.**
84
+
85
+
This is similar to the example above, however if you know the title of they layer you want to use, you can save it as a function.
86
+
```python
87
+
my_items = me.items()
88
+
for items in my_items:
89
+
print(items.title, " | ", items.type)
90
+
if items.title =="Flood in Sorel-Tracy":
91
+
flood_item = items
92
+
93
+
else:
94
+
continue
95
+
print(flood_item)
96
+
```
97
+
98
+
**Search all content you have access to, not just your own.**
We need to get the item from the DAaaS Geo Portal in order to use it in the Jupyter Notebook. This is done by providing the unique identification number of the item you want to use. Three examples are outlined below, all accessing the identical layer.
109
+
```python
110
+
item1 = gis.content.get(my_content[5].id) #from searching your content above
111
+
display(item1)
112
+
113
+
item2 = gis.content.get(flood_item.id) #from example above -searching for specific content
114
+
display(item2)
115
+
116
+
item3 = gis.content.get('edebfe03764b497f90cda5f0bfe727e2') #the actual content id number
117
+
display(item3)
118
+
```
119
+
120
+
<hr>
121
+
122
+
### Perform Analysis
123
+
Once the layers are brought into the Jupyter notebook, we are able to perform similar types of analysis you would expect to find in a GIS software such as ArcGIS. There are many modules containing many sub-modules of which can perform multiple types of analyses.
124
+
<br/>
125
+
126
+
Using the arcgis.features module, import the use_proximity submodule ```from arcgis.features import use_proximity```. This submodule allows us to '.create_buffers' - areas of equal distance from features. Here, we specify the layer we want to use, distance, units, and output name (you may also specify other characteristics such as field, ring type, end type, and others). By specifying an output name, after running the buffer command, a new layer will be automatically uploaded into the DAaaS GEO Portal containing the new feature you just created.
By getting the item as we did similar to the example above, we can use the '.update' function to update exisiting item within the DAaaS GEO Portal. We can update item properties, data, thumbnails, and metadata.
In this example we will use the library 'ipyleaflet' to create an interactive map. This map will be centered around Toronto, ON. The data being used will be outlined below.
169
+
Begin by pasting ```conda install -c conda-forge ipyleaflet``` allowing you to install ipyleaflet libraries in the Python environment.
170
+
<br/>
171
+
Import the necessary libraries.
172
+
```python
173
+
import ipyleaflet
174
+
from ipyleaflet import*
175
+
```
176
+
Now that we have imported the ipyleaflet module, we can create a simple map by specifying the latitude and longitude of the location we want, zoom level, and basemap [(more basemaps)](https://ipyleaflet.readthedocs.io/en/latest/map_and_basemaps/basemaps.html). Extra controls have been added such as layers and scale.
0 commit comments