|
156 | 156 | "\n",
|
157 | 157 | "You can setup an asyncronous callback using the `on_click()` or `on_draw_end()` to create dynamic, interactive 'apps'. You need to create a callback function like `function_name(map_inst, geometry)`, with `map_inst` being the `MapView` instance, and `geometry` being the geometry instance that the user clicked.\n",
|
158 | 158 | "\n",
|
159 |
| - "The below example takes a point a user clicks on the map, reverse geocodes from the geometry, and prints out the resultant location." |
| 159 | + "The below example takes a point a user clicks on the map, reverse geocodes from the geometry, and prints out the resultant location. Also to note here, you can either create the GIS connection using existing profile, or by simply entering the username and password, e.g. `gis = GIS(\"https://www.arcgis.com\", \"arcgis_python\", \"P@ssword123\")`." |
160 | 160 | ]
|
161 | 161 | },
|
162 | 162 | {
|
|
181 | 181 | "source": [
|
182 | 182 | "from arcgis.gis import GIS\n",
|
183 | 183 | "import arcgis.geocoding as geocoding\n",
|
184 |
| - "gis = GIS()\n", |
| 184 | + "gis = GIS(profile = \"your_online_profile\")\n", |
185 | 185 | "callback_map = gis.map('San Diego convention center, San Diego, CA', 16)\n",
|
186 | 186 | "def find_addr(callback_map, g):\n",
|
187 | 187 | " try:\n",
|
|
495 | 495 | "metadata": {},
|
496 | 496 | "outputs": [],
|
497 | 497 | "source": [
|
498 |
| - "#Use this string unix based file systems\n", |
499 |
| - "file_path = \"/Users/username/myHurricaneMap.html\"\n", |
500 |
| - "#Use this string for Windows based file systems\n", |
501 |
| - "file_path = r\"C:\\Users\\username\\myHurricaneMap.html\"\n", |
502 |
| - "visual_var_map.export_to_html(file_path)" |
| 498 | + "import os\n", |
| 499 | + "\n", |
| 500 | + "file_dir = os.path.join(os.getcwd(), 'home')\n", |
| 501 | + "if not os.path.isdir(file_dir):\n", |
| 502 | + " os.mkdir(file_dir)\n", |
| 503 | + " \n", |
| 504 | + "file_path = os.path.join(file_dir, 'myHurricaneMap.html')\n", |
| 505 | + "\n", |
| 506 | + "visual_var_map.export_to_html(file_path)\n", |
| 507 | + "print(\"html saved as \" + file_path) # On Windows, path can be 'C:\\Users\\Username\\Documents\\home\\myHurricaneMap.html'" |
503 | 508 | ]
|
504 | 509 | }
|
505 | 510 | ],
|
|
519 | 524 | "name": "python",
|
520 | 525 | "nbconvert_exporter": "python",
|
521 | 526 | "pygments_lexer": "ipython3",
|
522 |
| - "version": "3.6.6" |
| 527 | + "version": "3.6.8" |
523 | 528 | }
|
524 | 529 | },
|
525 | 530 | "nbformat": 4,
|
|
0 commit comments