{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Import Data ArcGIS DevLab\n", "This is the completed solution for the [Import data](https://developers.arcgis.com/labs/data/python/import-data/) ArcGIS DevLab. [ArcGIS DevLabs](https://developers.arcgis.com/labs/) are short introductory tutorials to guide you through the three phases of building geospatial apps: Data, Design, Develop" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Important note\n", "\n", "If you have not completed the [Download data lab](https://developers.arcgis.com/labs/python/download-data), the code in the **The Download Data Lab** cell immediately below must be run before the **Import Data Lab** cells will run. These cells contain the code in the ArcGIS API for Python [Download data lab solution](download_data.ipynb). The LA_Hub_Datasets.zip directory from which you import data is only available in a single notebooks.esri.com session.\n", "\n", "If you have completed the [Download data lab](https://developers.arcgis.com/labs/python/download-data) and are still in that notebook, skip to [The Import Data Lab](#import_section) section of this lab." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### The Import Data Lab\n", "" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Enter password, please: ········\n" ] } ], "source": [ "import getpass\n", "\n", "password = getpass.getpass(\"Enter password, please: \")\n", "gis = GIS('https://arcgis.com', 'username', password)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": true }, "outputs": [], "source": [ "parks_properties = {'title': 'Parks and Open Space',\n", " 'tags': 'parks, open data, devlabs',\n", " 'type': 'Shapefile'}\n", "parks_shp = gis.content.add(parks_properties,\n", " data='./LA_Hub_datasets/Parks_and_Open_Space.zip')" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "
\n", " \n", " \n", " \n", "
\n", "\n", "
\n", " Parks and Open Space\n", " \n", "
Shapefile by johnnyDev\n", "
Last Modified: September 28, 2017\n", "
0 comments, 0 views\n", "
\n", "
\n", " " ], "text/plain": [ "" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "parks_shp" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": true }, "outputs": [], "source": [ "parks_feature_layer = parks_shp.publish()" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'https://services1.arcgis.com/uRIm5IkWjDXybgFb/arcgis/rest/services/Parks_and_Open_Space/FeatureServer'" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "parks_feature_layer.url" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [default]", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.3" } }, "nbformat": 4, "nbformat_minor": 2 }