|
44 | 44 | "cell_type": "markdown",
|
45 | 45 | "metadata": {},
|
46 | 46 | "source": [
|
47 |
| - "### Load the Counties table from the Census Bureau US Boundaries dataset" |
| 47 | + "### 1. Load the Counties table from the Census Bureau US Boundaries dataset" |
48 | 48 | ]
|
49 | 49 | },
|
50 | 50 | {
|
|
56 | 56 | "name": "stderr",
|
57 | 57 | "output_type": "stream",
|
58 | 58 | "text": [
|
59 |
| - "/usr/local/google/home/arwas/src1/python-bigquery-dataframes/bigframes/session/_io/bigquery/read_gbq_table.py:280: DefaultIndexWarning: Table 'bigquery-public-data.geo_us_boundaries.counties' is clustered and/or partitioned, but BigQuery DataFrames was not able to find a suitable index. To avoid this warning, set at least one of: `index_col` or `filters`.\n", |
| 59 | + "/usr/local/google/home/arwas/src/bigframes3/bigframes/session/_io/bigquery/read_gbq_table.py:280: DefaultIndexWarning: Table 'bigquery-public-data.geo_us_boundaries.counties' is clustered and/or partitioned, but BigQuery DataFrames was not able to find a suitable index. To avoid this warning, set at least one of: `index_col` or `filters`.\n", |
60 | 60 | " warnings.warn(msg, category=bfe.DefaultIndexWarning)\n"
|
61 | 61 | ]
|
62 | 62 | }
|
|
69 | 69 | "cell_type": "markdown",
|
70 | 70 | "metadata": {},
|
71 | 71 | "source": [
|
72 |
| - "### Create a series from the int_point_geom column" |
| 72 | + "### 2. Create a series from the int_point_geom column" |
73 | 73 | ]
|
74 | 74 | },
|
75 | 75 | {
|
|
103 | 103 | {
|
104 | 104 | "data": {
|
105 | 105 | "text/plain": [
|
106 |
| - "37 POINT (-91.19496 39.98605)\n", |
107 |
| - "406 POINT (-84.86717 33.92103)\n", |
108 |
| - "926 POINT (-82.47974 35.33641)\n", |
109 |
| - "940 POINT (-75.50298 39.09709)\n", |
110 |
| - "996 POINT (-92.56434 39.8298)\n", |
| 106 | + "171 POINT (-95.50742 42.39186)\n", |
| 107 | + "219 POINT (-105.42894 37.27755)\n", |
| 108 | + "402 POINT (-93.34905 32.10121)\n", |
| 109 | + "526 POINT (-84.60469 43.29233)\n", |
| 110 | + "677 POINT (-89.5681 37.04779)\n", |
111 | 111 | "Name: int_point_geom, dtype: geometry"
|
112 | 112 | ]
|
113 | 113 | },
|
|
136 | 136 | {
|
137 | 137 | "data": {
|
138 | 138 | "text/plain": [
|
139 |
| - "0 POINT (-91.19496 39.98605)\n", |
140 |
| - "1 POINT (-84.86717 33.92103)\n", |
141 |
| - "2 POINT (-82.47974 35.33641)\n", |
142 |
| - "3 POINT (-75.50298 39.09709)\n", |
143 |
| - "4 POINT (-92.56434 39.8298)\n", |
| 139 | + "0 POINT (-95.50742 42.39186)\n", |
| 140 | + "1 POINT (-105.42894 37.27755)\n", |
| 141 | + "2 POINT (-93.34905 32.10121)\n", |
| 142 | + "3 POINT (-84.60469 43.29233)\n", |
| 143 | + "4 POINT (-89.5681 37.04779)\n", |
144 | 144 | "dtype: geometry"
|
145 | 145 | ]
|
146 | 146 | },
|
|
185 | 185 | {
|
186 | 186 | "data": {
|
187 | 187 | "text/plain": [
|
188 |
| - "0 -91.194961\n", |
189 |
| - "1 -84.867169\n", |
190 |
| - "2 -82.479741\n", |
191 |
| - "3 -75.502982\n", |
192 |
| - "4 -92.56434\n", |
| 188 | + "0 -95.507421\n", |
| 189 | + "1 -105.42894\n", |
| 190 | + "2 -93.34905\n", |
| 191 | + "3 -84.60469\n", |
| 192 | + "4 -89.568097\n", |
193 | 193 | "dtype: Float64"
|
194 | 194 | ]
|
195 | 195 | },
|
|
217 | 217 | {
|
218 | 218 | "data": {
|
219 | 219 | "text/plain": [
|
220 |
| - "0 39.986053\n", |
221 |
| - "1 33.92103\n", |
222 |
| - "2 35.336415\n", |
223 |
| - "3 39.097088\n", |
224 |
| - "4 39.829795\n", |
| 220 | + "0 42.39186\n", |
| 221 | + "1 37.277547\n", |
| 222 | + "2 32.101213\n", |
| 223 | + "3 43.292326\n", |
| 224 | + "4 37.047793\n", |
225 | 225 | "dtype: Float64"
|
226 | 226 | ]
|
227 | 227 | },
|
|
367 | 367 | {
|
368 | 368 | "data": {
|
369 | 369 | "text/plain": [
|
370 |
| - "10 POLYGON ((-101.7778 40.34969, -101.77812 40.34...\n", |
371 |
| - "127 POLYGON ((-89.22333 44.50398, -89.22334 44.499...\n", |
372 |
| - "253 POLYGON ((-76.69446 37.07288, -76.69515 37.072...\n", |
373 |
| - "261 POLYGON ((-98.70136 44.45055, -98.70136 44.450...\n", |
374 |
| - "303 POLYGON ((-85.99565 30.28131, -85.99566 30.280...\n", |
| 370 | + "54 POLYGON ((-93.76575 45.06448, -93.76575 45.064...\n", |
| 371 | + "256 POLYGON ((-89.83723 42.68318, -89.83732 42.682...\n", |
| 372 | + "266 POLYGON ((-104.19381 39.56523, -104.19464 39.5...\n", |
| 373 | + "485 MULTIPOLYGON (((-91.05884 32.17233, -91.05891 ...\n", |
| 374 | + "765 POLYGON ((-83.61848 38.1557, -83.61861 38.1554...\n", |
375 | 375 | "Name: county_geom, dtype: geometry"
|
376 | 376 | ]
|
377 | 377 | },
|
|
389 | 389 | "cell_type": "markdown",
|
390 | 390 | "metadata": {},
|
391 | 391 | "source": [
|
392 |
| - "### Convert the geometry collection to `bigframes.gopandas.GeoSeries`" |
| 392 | + "### 2. Convert the geometry collection to `bigframes.gopandas.GeoSeries`" |
393 | 393 | ]
|
394 | 394 | },
|
395 | 395 | {
|
|
400 | 400 | {
|
401 | 401 | "data": {
|
402 | 402 | "text/plain": [
|
403 |
| - "0 POLYGON ((-101.7778 40.34969, -101.77812 40.34...\n", |
404 |
| - "1 POLYGON ((-89.22333 44.50398, -89.22334 44.499...\n", |
405 |
| - "2 POLYGON ((-76.69446 37.07288, -76.69515 37.072...\n", |
406 |
| - "3 POLYGON ((-98.70136 44.45055, -98.70136 44.450...\n", |
407 |
| - "4 POLYGON ((-85.99565 30.28131, -85.99566 30.280...\n", |
| 403 | + "0 POLYGON ((-93.76575 45.06448, -93.76575 45.064...\n", |
| 404 | + "1 POLYGON ((-89.83723 42.68318, -89.83732 42.682...\n", |
| 405 | + "2 POLYGON ((-104.19381 39.56523, -104.19464 39.5...\n", |
| 406 | + "3 MULTIPOLYGON (((-91.05884 32.17233, -91.05891 ...\n", |
| 407 | + "4 POLYGON ((-83.61848 38.1557, -83.61861 38.1554...\n", |
408 | 408 | "dtype: geometry"
|
409 | 409 | ]
|
410 | 410 | },
|
|
442 | 442 | "outputs": [
|
443 | 443 | {
|
444 | 444 | "ename": "NotImplementedError",
|
445 |
| - "evalue": "GeoSeries.area is not supported. Use bigframes.bigquery.st_area(series), instead. Share your usecase with the BigQuery DataFrames team at the https://bit.ly/bigframes-feedback survey.You are currently running BigFrames version 1.34.0", |
| 445 | + "evalue": "GeoSeries.area is not supported. Use bigframes.bigquery.st_area(series), instead. Share your usecase with the BigQuery DataFrames team at the https://bit.ly/bigframes-feedback survey.You are currently running BigFrames version 1.35.0", |
446 | 446 | "output_type": "error",
|
447 | 447 | "traceback": [
|
448 | 448 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
449 | 449 | "\u001b[0;31mNotImplementedError\u001b[0m Traceback (most recent call last)",
|
450 | 450 | "Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mfive_geom\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43marea\u001b[49m\n",
|
451 |
| - "File \u001b[0;32m~/src1/python-bigquery-dataframes/bigframes/geopandas/geoseries.py:66\u001b[0m, in \u001b[0;36mGeoSeries.area\u001b[0;34m(self, crs)\u001b[0m\n\u001b[1;32m 47\u001b[0m \u001b[38;5;129m@property\u001b[39m\n\u001b[1;32m 48\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21marea\u001b[39m(\u001b[38;5;28mself\u001b[39m, crs\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m bigframes\u001b[38;5;241m.\u001b[39mseries\u001b[38;5;241m.\u001b[39mSeries: \u001b[38;5;66;03m# type: ignore\u001b[39;00m\n\u001b[1;32m 49\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Returns a Series containing the area of each geometry in the GeoSeries\u001b[39;00m\n\u001b[1;32m 50\u001b[0m \u001b[38;5;124;03m expressed in the units of the CRS.\u001b[39;00m\n\u001b[1;32m 51\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 64\u001b[0m \u001b[38;5;124;03m GeoSeries.area is not supported. Use bigframes.bigquery.st_area(series), insetead.\u001b[39;00m\n\u001b[1;32m 65\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m---> 66\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mNotImplementedError\u001b[39;00m(\n\u001b[1;32m 67\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mGeoSeries.area is not supported. Use bigframes.bigquery.st_area(series), instead. \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mconstants\u001b[38;5;241m.\u001b[39mFEEDBACK_LINK\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 68\u001b[0m )\n", |
452 |
| - "\u001b[0;31mNotImplementedError\u001b[0m: GeoSeries.area is not supported. Use bigframes.bigquery.st_area(series), instead. Share your usecase with the BigQuery DataFrames team at the https://bit.ly/bigframes-feedback survey.You are currently running BigFrames version 1.34.0" |
| 451 | + "File \u001b[0;32m~/src/bigframes3/bigframes/geopandas/geoseries.py:66\u001b[0m, in \u001b[0;36mGeoSeries.area\u001b[0;34m(self, crs)\u001b[0m\n\u001b[1;32m 47\u001b[0m \u001b[38;5;129m@property\u001b[39m\n\u001b[1;32m 48\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21marea\u001b[39m(\u001b[38;5;28mself\u001b[39m, crs\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m bigframes\u001b[38;5;241m.\u001b[39mseries\u001b[38;5;241m.\u001b[39mSeries: \u001b[38;5;66;03m# type: ignore\u001b[39;00m\n\u001b[1;32m 49\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Returns a Series containing the area of each geometry in the GeoSeries\u001b[39;00m\n\u001b[1;32m 50\u001b[0m \u001b[38;5;124;03m expressed in the units of the CRS.\u001b[39;00m\n\u001b[1;32m 51\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 64\u001b[0m \u001b[38;5;124;03m GeoSeries.area is not supported. Use bigframes.bigquery.st_area(series), insetead.\u001b[39;00m\n\u001b[1;32m 65\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m---> 66\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mNotImplementedError\u001b[39;00m(\n\u001b[1;32m 67\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mGeoSeries.area is not supported. Use bigframes.bigquery.st_area(series), instead. \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mconstants\u001b[38;5;241m.\u001b[39mFEEDBACK_LINK\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 68\u001b[0m )\n", |
| 452 | + "\u001b[0;31mNotImplementedError\u001b[0m: GeoSeries.area is not supported. Use bigframes.bigquery.st_area(series), instead. Share your usecase with the BigQuery DataFrames team at the https://bit.ly/bigframes-feedback survey.You are currently running BigFrames version 1.35.0" |
453 | 453 | ]
|
454 | 454 | }
|
455 | 455 | ],
|
|
461 | 461 | "cell_type": "markdown",
|
462 | 462 | "metadata": {},
|
463 | 463 | "source": [
|
464 |
| - "## Use `bigframes.bigquery.st_area` to retirive the `area` in square meters instead. See: https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_area" |
| 464 | + "### 3. Use `bigframes.bigquery.st_area` to retirive the `area` in square meters instead. See: https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_area" |
465 | 465 | ]
|
466 | 466 | },
|
467 | 467 | {
|
|
481 | 481 | {
|
482 | 482 | "data": {
|
483 | 483 | "text/plain": [
|
484 |
| - "0 2382382043.48891\n", |
485 |
| - "1 1977633097.26862\n", |
486 |
| - "2 939388839.499466\n", |
487 |
| - "3 3269015229.381782\n", |
488 |
| - "4 2678752241.321673\n", |
| 484 | + "0 1567505274.453911\n", |
| 485 | + "1 1511436852.079554\n", |
| 486 | + "2 4789800692.948824\n", |
| 487 | + "3 1686877416.586061\n", |
| 488 | + "4 740944862.916908\n", |
489 | 489 | "dtype: Float64"
|
490 | 490 | ]
|
491 | 491 | },
|
|
498 | 498 | "geom_area = bbq.st_area(five_geom)\n",
|
499 | 499 | "geom_area"
|
500 | 500 | ]
|
| 501 | + }, |
| 502 | + { |
| 503 | + "cell_type": "markdown", |
| 504 | + "metadata": {}, |
| 505 | + "source": [ |
| 506 | + "## Use `bigframes.geopandas.GeoSeries.from_xy()` to create a GeoSeries of `Point` geometries. " |
| 507 | + ] |
| 508 | + }, |
| 509 | + { |
| 510 | + "cell_type": "markdown", |
| 511 | + "metadata": {}, |
| 512 | + "source": [ |
| 513 | + "### 1. Reuse the `geo_points.x` and `geo_points.y` results by passing them to `.from_xy()` " |
| 514 | + ] |
| 515 | + }, |
| 516 | + { |
| 517 | + "cell_type": "code", |
| 518 | + "execution_count": 16, |
| 519 | + "metadata": {}, |
| 520 | + "outputs": [ |
| 521 | + { |
| 522 | + "data": { |
| 523 | + "text/plain": [ |
| 524 | + "0 POINT (-95.50742 42.39186)\n", |
| 525 | + "1 POINT (-105.42894 37.27755)\n", |
| 526 | + "2 POINT (-93.34905 32.10121)\n", |
| 527 | + "3 POINT (-84.60469 43.29233)\n", |
| 528 | + "4 POINT (-89.5681 37.04779)\n", |
| 529 | + "dtype: geometry" |
| 530 | + ] |
| 531 | + }, |
| 532 | + "execution_count": 16, |
| 533 | + "metadata": {}, |
| 534 | + "output_type": "execute_result" |
| 535 | + } |
| 536 | + ], |
| 537 | + "source": [ |
| 538 | + "bigframes.geopandas.GeoSeries.from_xy(geo_points.x, geo_points.y)" |
| 539 | + ] |
501 | 540 | }
|
502 | 541 | ],
|
503 | 542 | "metadata": {
|
|
0 commit comments