|
67 | 67 | "outputs": [],
|
68 | 68 | "source": [
|
69 | 69 | "# Create a GIS Connection\n",
|
70 |
| - "gis = GIS(profile='your_online_profile')" |
| 70 | + "gis = GIS(profile=\"your_online_profile\")" |
71 | 71 | ]
|
72 | 72 | },
|
73 | 73 | {
|
|
88 | 88 | ],
|
89 | 89 | "source": [
|
90 | 90 | "# Get US as a country\n",
|
91 |
| - "usa = Country.get('US')\n", |
| 91 | + "usa = Country.get(\"US\")\n", |
92 | 92 | "type(usa)"
|
93 | 93 | ]
|
94 | 94 | },
|
|
309 | 309 | }
|
310 | 310 | ],
|
311 | 311 | "source": [
|
312 |
| - "df.loc['Age']['analysisVariable'].unique()" |
| 312 | + "df.loc[\"Age\"][\"analysisVariable\"].unique()" |
313 | 313 | ]
|
314 | 314 | },
|
315 | 315 | {
|
|
416 | 416 | ],
|
417 | 417 | "source": [
|
418 | 418 | "# View a sample of the `Age` data collection\n",
|
419 |
| - "df.loc['Age'].head()" |
| 419 | + "df.loc[\"Age\"].head()" |
420 | 420 | ]
|
421 | 421 | },
|
422 | 422 | {
|
|
458 | 458 | "outputs": [],
|
459 | 459 | "source": [
|
460 | 460 | "# Enriching single address as single line imput\n",
|
461 |
| - "single_address = enrich(study_areas=[\"380 New York St Redlands CA 92373\"], \n", |
462 |
| - " data_collections=['Age'])" |
| 461 | + "single_address = enrich(\n", |
| 462 | + " study_areas=[\"380 New York St Redlands CA 92373\"], data_collections=[\"Age\"]\n", |
| 463 | + ")" |
463 | 464 | ]
|
464 | 465 | },
|
465 | 466 | {
|
|
595 | 596 | "outputs": [],
|
596 | 597 | "source": [
|
597 | 598 | "# Plot on a map\n",
|
598 |
| - "address_map = gis.map('Redlands, CA')\n", |
| 599 | + "address_map = gis.map(\"Redlands, CA\")\n", |
599 | 600 | "address_map"
|
600 | 601 | ]
|
601 | 602 | },
|
|
775 | 776 | ],
|
776 | 777 | "source": [
|
777 | 778 | "# Enriching multiple addresses as single line input\n",
|
778 |
| - "enrich(study_areas=[{\"address\":{\"text\":\"12 Concorde Place Toronto ON M3C 3R8\",\"sourceCountry\":\"Canada\"}},\n", |
779 |
| - " {\"address\":{\"text\":\"380 New York St Redlands CA 92373\",\"sourceCountry\":\"USA\"}}], \n", |
780 |
| - " data_collections=['Age'])" |
| 779 | + "enrich(\n", |
| 780 | + " study_areas=[\n", |
| 781 | + " {\n", |
| 782 | + " \"address\": {\n", |
| 783 | + " \"text\": \"12 Concorde Place Toronto ON M3C 3R8\",\n", |
| 784 | + " \"sourceCountry\": \"Canada\",\n", |
| 785 | + " }\n", |
| 786 | + " },\n", |
| 787 | + " {\n", |
| 788 | + " \"address\": {\n", |
| 789 | + " \"text\": \"380 New York St Redlands CA 92373\",\n", |
| 790 | + " \"sourceCountry\": \"USA\",\n", |
| 791 | + " }\n", |
| 792 | + " },\n", |
| 793 | + " ],\n", |
| 794 | + " data_collections=[\"Age\"],\n", |
| 795 | + ")" |
781 | 796 | ]
|
782 | 797 | },
|
783 | 798 | {
|
|
894 | 909 | }
|
895 | 910 | ],
|
896 | 911 | "source": [
|
897 |
| - "enrich(study_areas=[{\"address\":{\"Address\":\"380 New York Street\", \n", |
898 |
| - " \"City\":\"Redlands\", \"Region\":\"CA\", \"Postal\":92373}}], \n", |
899 |
| - " data_collections=['Age'])" |
| 912 | + "enrich(\n", |
| 913 | + " study_areas=[\n", |
| 914 | + " {\n", |
| 915 | + " \"address\": {\n", |
| 916 | + " \"Address\": \"380 New York Street\",\n", |
| 917 | + " \"City\": \"Redlands\",\n", |
| 918 | + " \"Region\": \"CA\",\n", |
| 919 | + " \"Postal\": 92373,\n", |
| 920 | + " }\n", |
| 921 | + " }\n", |
| 922 | + " ],\n", |
| 923 | + " data_collections=[\"Age\"],\n", |
| 924 | + ")" |
900 | 925 | ]
|
901 | 926 | },
|
902 | 927 | {
|
|
995 | 1020 | }
|
996 | 1021 | ],
|
997 | 1022 | "source": [
|
998 |
| - "enrich(study_areas=[\"380 New York St Redlands CA 92373\"], \n", |
999 |
| - " analysis_variables=[\"Age.FEM45\",\"Age.FEM55\",\"Age.FEM65\"])" |
| 1023 | + "enrich(\n", |
| 1024 | + " study_areas=[\"380 New York St Redlands CA 92373\"],\n", |
| 1025 | + " analysis_variables=[\"Age.FEM45\", \"Age.FEM55\", \"Age.FEM65\"],\n", |
| 1026 | + ")" |
1000 | 1027 | ]
|
1001 | 1028 | },
|
1002 | 1029 | {
|
|
1128 | 1155 | }
|
1129 | 1156 | ],
|
1130 | 1157 | "source": [
|
1131 |
| - "pt = Point({\"x\" : -117.1956, \"y\" : 34.0572, \"spatialReference\" : {\"wkid\" : 4326}})\n", |
1132 |
| - "enrich(study_areas=[pt], data_collections=['Age'])" |
| 1158 | + "pt = Point({\"x\": -117.1956, \"y\": 34.0572, \"spatialReference\": {\"wkid\": 4326}})\n", |
| 1159 | + "enrich(study_areas=[pt], data_collections=[\"Age\"])" |
1133 | 1160 | ]
|
1134 | 1161 | },
|
1135 | 1162 | {
|
|
1272 | 1299 | }
|
1273 | 1300 | ],
|
1274 | 1301 | "source": [
|
1275 |
| - "pt1 = Point({\"x\" : -122.435, \"y\" : 37.785, \"spatialReference\" : {\"wkid\" : 4326}})\n", |
1276 |
| - "pt2 = Point({\"x\" : -122.433, \"y\" : 37.734, \"spatialReference\" : {\"wkid\" : 4326}})\n", |
| 1302 | + "pt1 = Point({\"x\": -122.435, \"y\": 37.785, \"spatialReference\": {\"wkid\": 4326}})\n", |
| 1303 | + "pt2 = Point({\"x\": -122.433, \"y\": 37.734, \"spatialReference\": {\"wkid\": 4326}})\n", |
1277 | 1304 | "\n",
|
1278 |
| - "enrich(study_areas=[pt1, pt2], data_collections=['Age'])" |
| 1305 | + "enrich(study_areas=[pt1, pt2], data_collections=[\"Age\"])" |
1279 | 1306 | ]
|
1280 | 1307 | },
|
1281 | 1308 | {
|
|
1300 | 1327 | "metadata": {},
|
1301 | 1328 | "outputs": [],
|
1302 | 1329 | "source": [
|
1303 |
| - "line = Polyline({\"paths\":[[[-13048580,4036370],[-13046151,4036366]]],\n", |
1304 |
| - " \"spatialReference\":{\"wkid\":102100}})\n", |
1305 |
| - "enriched_line_df = enrich(study_areas=[line], data_collections=['Age'])" |
| 1330 | + "line = Polyline(\n", |
| 1331 | + " {\n", |
| 1332 | + " \"paths\": [[[-13048580, 4036370], [-13046151, 4036366]]],\n", |
| 1333 | + " \"spatialReference\": {\"wkid\": 102100},\n", |
| 1334 | + " }\n", |
| 1335 | + ")\n", |
| 1336 | + "enriched_line_df = enrich(study_areas=[line], data_collections=[\"Age\"])" |
1306 | 1337 | ]
|
1307 | 1338 | },
|
1308 | 1339 | {
|
|
1428 | 1459 | "outputs": [],
|
1429 | 1460 | "source": [
|
1430 | 1461 | "# Plot on a map\n",
|
1431 |
| - "line_map = gis.map('Redlands, CA')\n", |
| 1462 | + "line_map = gis.map(\"Redlands, CA\")\n", |
1432 | 1463 | "line_map"
|
1433 | 1464 | ]
|
1434 | 1465 | },
|
|
1590 | 1621 | }
|
1591 | 1622 | ],
|
1592 | 1623 | "source": [
|
1593 |
| - "poly = Polygon({\"rings\":[[[-117.185412,34.063170],[-122.81,37.81],\n", |
1594 |
| - " [-117.200570,34.057196],[-117.185412,34.063170]]],\n", |
1595 |
| - " \"spatialReference\":{\"wkid\":4326}})\n", |
| 1624 | + "poly = Polygon(\n", |
| 1625 | + " {\n", |
| 1626 | + " \"rings\": [\n", |
| 1627 | + " [\n", |
| 1628 | + " [-117.185412, 34.063170],\n", |
| 1629 | + " [-122.81, 37.81],\n", |
| 1630 | + " [-117.200570, 34.057196],\n", |
| 1631 | + " [-117.185412, 34.063170],\n", |
| 1632 | + " ]\n", |
| 1633 | + " ],\n", |
| 1634 | + " \"spatialReference\": {\"wkid\": 4326},\n", |
| 1635 | + " }\n", |
| 1636 | + ")\n", |
1596 | 1637 | "\n",
|
1597 |
| - "enrich(study_areas=[poly], data_collections=['Age'])" |
| 1638 | + "enrich(study_areas=[poly], data_collections=[\"Age\"])" |
1598 | 1639 | ]
|
1599 | 1640 | },
|
1600 | 1641 | {
|
|
1637 | 1678 | },
|
1638 | 1679 | "outputs": [],
|
1639 | 1680 | "source": [
|
1640 |
| - "buffered = BufferStudyArea(area='380 New York St Redlands CA 92373',\n", |
1641 |
| - " radii=[1,3,5], units='Miles', overlap=False)\n", |
1642 |
| - "drive_dist_df = enrich(study_areas=[buffered], data_collections=['Age'])" |
| 1681 | + "buffered = BufferStudyArea(\n", |
| 1682 | + " area=\"380 New York St Redlands CA 92373\",\n", |
| 1683 | + " radii=[1, 3, 5],\n", |
| 1684 | + " units=\"Miles\",\n", |
| 1685 | + " overlap=False,\n", |
| 1686 | + ")\n", |
| 1687 | + "drive_dist_df = enrich(study_areas=[buffered], data_collections=[\"Age\"])" |
1643 | 1688 | ]
|
1644 | 1689 | },
|
1645 | 1690 | {
|
|
1828 | 1873 | "outputs": [],
|
1829 | 1874 | "source": [
|
1830 | 1875 | "# Plot on a map\n",
|
1831 |
| - "buffer_map1 = gis.map('Redlands, CA')\n", |
1832 |
| - "buffer_map1.basemap.basemap = 'dark-gray-vector'\n", |
| 1876 | + "buffer_map1 = gis.map(\"Redlands, CA\")\n", |
| 1877 | + "buffer_map1.basemap.basemap = \"dark-gray-vector\"\n", |
1833 | 1878 | "buffer_map1"
|
1834 | 1879 | ]
|
1835 | 1880 | },
|
|
1868 | 1913 | "source": [
|
1869 | 1914 | "renderer_manager = buffer_map1.content.renderer(0)\n",
|
1870 | 1915 | "smart_mapping_manager = renderer_manager.smart_mapping()\n",
|
1871 |
| - "smart_mapping_manager.class_breaks_renderer(break_type=\"size\", classification_method=\"esriClassifyNaturalBreaks\", num_classes=4, field=\"buffer_radii\")" |
| 1916 | + "smart_mapping_manager.class_breaks_renderer(\n", |
| 1917 | + " break_type=\"size\",\n", |
| 1918 | + " classification_method=\"esriClassifyNaturalBreaks\",\n", |
| 1919 | + " num_classes=4,\n", |
| 1920 | + " field=\"buffer_radii\",\n", |
| 1921 | + ")" |
1872 | 1922 | ]
|
1873 | 1923 | },
|
1874 | 1924 | {
|
|
1894 | 1944 | },
|
1895 | 1945 | "outputs": [],
|
1896 | 1946 | "source": [
|
1897 |
| - "buffered = BufferStudyArea(area='380 New York St Redlands CA 92373', \n", |
1898 |
| - " radii=[5, 10], units='Minutes', \n", |
1899 |
| - " travel_mode='Driving')\n", |
1900 |
| - "drive_time_df = enrich(study_areas=[buffered], data_collections=['Age'])" |
| 1947 | + "buffered = BufferStudyArea(\n", |
| 1948 | + " area=\"380 New York St Redlands CA 92373\",\n", |
| 1949 | + " radii=[5, 10],\n", |
| 1950 | + " units=\"Minutes\",\n", |
| 1951 | + " travel_mode=\"Driving\",\n", |
| 1952 | + ")\n", |
| 1953 | + "drive_time_df = enrich(study_areas=[buffered], data_collections=[\"Age\"])" |
1901 | 1954 | ]
|
1902 | 1955 | },
|
1903 | 1956 | {
|
|
2064 | 2117 | "outputs": [],
|
2065 | 2118 | "source": [
|
2066 | 2119 | "# Plot on a map\n",
|
2067 |
| - "buffer_map2 = gis.map('Redlands, CA')\n", |
2068 |
| - "buffer_map2.basemap.basemap = 'gray-vector'\n", |
| 2120 | + "buffer_map2 = gis.map(\"Redlands, CA\")\n", |
| 2121 | + "buffer_map2.basemap.basemap = \"gray-vector\"\n", |
2069 | 2122 | "buffer_map2"
|
2070 | 2123 | ]
|
2071 | 2124 | },
|
|
2104 | 2157 | "source": [
|
2105 | 2158 | "renderer_manager = buffer_map1.content.renderer(0)\n",
|
2106 | 2159 | "smart_mapping_manager = renderer_manager.smart_mapping()\n",
|
2107 |
| - "smart_mapping_manager.class_breaks_renderer(break_type=\"size\", classification_method=\"esriClassifyNaturalBreaks\", num_classes=3, field=\"buffer_radii\")" |
| 2160 | + "smart_mapping_manager.class_breaks_renderer(\n", |
| 2161 | + " break_type=\"size\",\n", |
| 2162 | + " classification_method=\"esriClassifyNaturalBreaks\",\n", |
| 2163 | + " num_classes=3,\n", |
| 2164 | + " field=\"buffer_radii\",\n", |
| 2165 | + ")" |
2108 | 2166 | ]
|
2109 | 2167 | },
|
2110 | 2168 | {
|
|
2134 | 2192 | "metadata": {},
|
2135 | 2193 | "outputs": [],
|
2136 | 2194 | "source": [
|
2137 |
| - "usa = Country.get('US')" |
| 2195 | + "usa = Country.get(\"US\")" |
2138 | 2196 | ]
|
2139 | 2197 | },
|
2140 | 2198 | {
|
|
2147 | 2205 | },
|
2148 | 2206 | "outputs": [],
|
2149 | 2207 | "source": [
|
2150 |
| - "redlands = usa.subgeographies.states['California'].zip5['92373']" |
| 2208 | + "redlands = usa.subgeographies.states[\"California\"].zip5[\"92373\"]" |
2151 | 2209 | ]
|
2152 | 2210 | },
|
2153 | 2211 | {
|
|
2200 | 2258 | },
|
2201 | 2259 | "outputs": [],
|
2202 | 2260 | "source": [
|
2203 |
| - "redlands_df = enrich(study_areas=[redlands], data_collections=['Age'] )" |
| 2261 | + "redlands_df = enrich(study_areas=[redlands], data_collections=[\"Age\"])" |
2204 | 2262 | ]
|
2205 | 2263 | },
|
2206 | 2264 | {
|
|
2326 | 2384 | "metadata": {},
|
2327 | 2385 | "outputs": [],
|
2328 | 2386 | "source": [
|
2329 |
| - "zip_map = gis.map('Redlands, CA')\n", |
| 2387 | + "zip_map = gis.map(\"Redlands, CA\")\n", |
2330 | 2388 | "zip_map"
|
2331 | 2389 | ]
|
2332 | 2390 | },
|
|
2386 | 2444 | },
|
2387 | 2445 | "outputs": [],
|
2388 | 2446 | "source": [
|
2389 |
| - "ca_counties = usa.subgeographies.states['California'].counties" |
| 2447 | + "ca_counties = usa.subgeographies.states[\"California\"].counties" |
2390 | 2448 | ]
|
2391 | 2449 | },
|
2392 | 2450 | {
|
|
2613 | 2671 | }
|
2614 | 2672 | ],
|
2615 | 2673 | "source": [
|
2616 |
| - "counties_df = enrich(study_areas=ca_counties, data_collections=['Age'])\n", |
| 2674 | + "counties_df = enrich(study_areas=ca_counties, data_collections=[\"Age\"])\n", |
2617 | 2675 | "counties_df.head()"
|
2618 | 2676 | ]
|
2619 | 2677 | },
|
|
2844 | 2902 | }
|
2845 | 2903 | ],
|
2846 | 2904 | "source": [
|
2847 |
| - "counties_df2 = usa.enrich(study_areas=list(ca_counties.values()), data_collections=['transportation'])\n", |
| 2905 | + "counties_df2 = usa.enrich(\n", |
| 2906 | + " study_areas=list(ca_counties.values()), data_collections=[\"transportation\"]\n", |
| 2907 | + ")\n", |
2848 | 2908 | "counties_df2.head()"
|
2849 | 2909 | ]
|
2850 | 2910 | },
|
|
2861 | 2921 | "metadata": {},
|
2862 | 2922 | "outputs": [],
|
2863 | 2923 | "source": [
|
2864 |
| - "county_map = gis.map('California')\n", |
| 2924 | + "county_map = gis.map(\"California\")\n", |
2865 | 2925 | "county_map"
|
2866 | 2926 | ]
|
2867 | 2927 | },
|
|
2898 | 2958 | "metadata": {},
|
2899 | 2959 | "outputs": [],
|
2900 | 2960 | "source": [
|
2901 |
| - "county_map.legend.enabled=True" |
| 2961 | + "county_map.legend.enabled = True" |
2902 | 2962 | ]
|
2903 | 2963 | },
|
2904 | 2964 | {
|
|
0 commit comments