Skip to content

Commit

Permalink
addresses 'from_wkt' comment
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldorman committed May 13, 2024
1 parent 12b9cb4 commit 08d88a7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 07-read-write.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,10 @@ world_wkt = pd.read_csv('data/world_wkt.csv')
world_wkt
```

To convert it to a `GeoDataFrame`, we can apply the `shapely.from_wkt` function (@sec-geometries) on the WKT strings, to convert them into `shapely` geometries (also see note about the `.apply` method in @sec-topological-relations).
To convert it to a `GeoDataFrame`, we can apply the [`gpd.GeoSeries.from_wkt`](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.from_wkt.html) function (which is analogous to `shapely`'s `shapely.from_wkt`, see @sec-geometries) on the WKT strings, to convert the series of WKT strings into a `GeoSeries` with the geometries.

```{python}
world_wkt['geometry'] = world_wkt['WKT'].apply(shapely.from_wkt)
world_wkt['geometry'] = gpd.GeoSeries.from_wkt(world_wkt['WKT'])
world_wkt = gpd.GeoDataFrame(world_wkt)
world_wkt
```
Expand Down
12 changes: 12 additions & 0 deletions geckodriver.log
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,15 @@ Gtk-Message: 09:49:53.444: Not loading module "atk-bridge": The functionality is
[GFX1-]: RenderCompositorSWGL failed mapping default framebuffer, no dt
1715604964698 geckodriver INFO Listening on 127.0.0.1:60959
1715604968145 geckodriver INFO Listening on 127.0.0.1:54067
1715605683299 geckodriver INFO Listening on 127.0.0.1:40473
1715605686917 geckodriver INFO Listening on 127.0.0.1:47261
1715605720566 geckodriver INFO Listening on 127.0.0.1:53875
1715605723697 geckodriver INFO Listening on 127.0.0.1:44131
1715605753544 geckodriver INFO Listening on 127.0.0.1:56437
1715605756940 geckodriver INFO Listening on 127.0.0.1:49185
1715605767617 geckodriver INFO Listening on 127.0.0.1:34393
1715605770604 geckodriver INFO Listening on 127.0.0.1:35175
1715605782289 geckodriver INFO Listening on 127.0.0.1:41231
1715605785639 geckodriver INFO Listening on 127.0.0.1:32863
1715605816857 geckodriver INFO Listening on 127.0.0.1:38919
1715605820035 geckodriver INFO Listening on 127.0.0.1:52745
Binary file modified output/w_many_features.gpkg
Binary file not shown.
Binary file modified output/w_many_layers.gpkg
Binary file not shown.
Binary file modified output/world.gpkg
Binary file not shown.

0 comments on commit 08d88a7

Please sign in to comment.