Select to view content in your preferred language

Is it possible to use a hosted feature layer from Portal in an AGOL notebook?

204
3
Jump to solution
4 weeks ago
GregKeith
Occasional Contributor III

Is it possible, and if so how, to use a hosted feature layer from our Enterprise Portal in an AGOL notebook? We don't have the Notebook Server Extension for Portal, so hoping to run a simple script from AGOL. Thanks!

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Absolutely! We used to do that for nightly scripts. All you have to do is connect to your Portal in the notebook.

from arcgis.gis import GIS

gis = GIS('your portal url', 'user', 'password')

# do your stuff here
- Josh Carlson
Kendall County GIS

View solution in original post

3 Replies
jcarlson
MVP Esteemed Contributor

Absolutely! We used to do that for nightly scripts. All you have to do is connect to your Portal in the notebook.

from arcgis.gis import GIS

gis = GIS('your portal url', 'user', 'password')

# do your stuff here
- Josh Carlson
Kendall County GIS
GregKeith
Occasional Contributor III

Thanks @jcarlson ! 

0 Kudos
jcarlson
MVP Esteemed Contributor

Of course!

I know you didn't ask about this, but some advice: if you're using the AGOL notebook env, you may run into situations where you really need some other module that's not part of the default environment. If that happens, don't forget about throwing terminal commands into a cell with a "!" prefix.

If it's a small one-off, you can have the notebook install modules ad-hoc.

import sys
!{sys.executable} -m pip install some_other_module

 

- Josh Carlson
Kendall County GIS
0 Kudos