Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Tiles Examples to use generatePMTiles instead of generate and writePMTiles #15

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 7 additions & 38 deletions python/wherobots-db/tile-generation-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,12 @@
"id": "a2c7de7c-e705-45f1-829c-43114475e5d2",
"metadata": {},
"source": [
"### Create DataFrame of Tiles\n",
"### Create Tiles as a PMTiles Archive\n",
"\n",
"Once we have the Spatial DataFrame ready for tile generation, we can use the `vtiles.generate` method to create a DataFrame containing the encoded tiles. A `GenerationConfig` object can optionally be provided as a second argument if a non-default configuration is desired."
"Once we have the Spatial DataFrame ready for tile generation, we can use the `vtiles.generate_pmtiles` method to create a PMTiles archive. PMTiles is a performant, simple, and optimized format for storing vector tiles.\n",
"\n",
"Wherobots will automatically handle the details for you. However, if you need more control, a `GenerationConfig` object can optionally be provided as an argument to control which tiles are created and their contents. A `PMTilesConfig` object can optionally be provided to control the header information of the PMTiles Archive.\n",
"\n"
]
},
{
Expand All @@ -190,36 +193,10 @@
"outputs": [],
"source": [
"from wherobots import vtiles\n",
"\n",
"tiles_df = vtiles.generate(features_df)\n",
"\n",
"tiles_df.show(3, 150, True)"
]
},
{
"cell_type": "markdown",
"id": "e0f026cd-34df-4620-b2bb-f7bc95dfac39",
"metadata": {},
"source": [
"### Write Tiles to File Storage\n",
"\n",
"WherobotsDB creates vector tiles in the PMTiles format by default. The PMTiles format is a performant, simple, and\n",
"optimized format for creating vector tiles and provides an interface for configuration through a `PMTilesConfig` object.\n",
"In this example, we leverage a WherobotsDB feature to configure the archive directly from the feature DataFrame used to\n",
"generated the tiles:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "48866b66-5fd3-4fda-9e42-226c5b24f159",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"\n",
"full_tiles_path = os.getenv(\"USER_S3_PATH\") + \"tiles.pmtiles\"\n",
"vtiles.write_pmtiles(tiles_df, full_tiles_path, features_df=features_df)"
"vtiles.generate_pmtiles(features_df, full_tiles_path)\n"
]
},
{
Expand Down Expand Up @@ -285,14 +262,6 @@
"tutorial, we just focus on a minimum example. Detailed explanation of each tool can be found\n",
"in [the documentation](https://docs.wherobots.com/latest/references/wherobotsdb/vector-data/Overview/)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8dc7a134-395b-429e-9a43-5be43d327e30",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -311,7 +280,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
"version": "3.11.11"
}
},
"nbformat": 4,
Expand Down
34 changes: 6 additions & 28 deletions scala/wherobots-db/tile-generation-example-scala.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,12 @@
"id": "a2c7de7c-e705-45f1-829c-43114475e5d2",
"metadata": {},
"source": [
"### Create DataFrame of Tiles\n",
"### Create Tiles as a PMTiles Archive\n",
"\n",
"Once we have the Spatial DataFrame ready for tile generation, we can use the `VTiles.generate` method to create a DataFrame containing the encoded tiles. A `GenerationConfig` object can optionally be provided as a second argument if a non-default configuration is desired."
"Once we have the Spatial DataFrame ready for tile generation, we can use the `vtiles.generate_pmtiles` method to create a PMTiles archive. PMTiles is a performant, simple, and optimized format for storing vector tiles.\n",
"\n",
"Wherobots will automatically handle the details for you. However, if you need more control, a `GenerationConfig` object can optionally be provided as an argument to control which tiles are created and their contents. A `PMTilesConfig` object can optionally be provided to control the header information of the PMTiles Archive.\n",
"\n"
]
},
{
Expand All @@ -194,33 +197,8 @@
"source": [
"import com.wherobots.VTiles\n",
"\n",
"val tilesDf = VTiles.generate(featuresDf)\n",
"\n",
"tilesDf.show(3, 150, true)"
]
},
{
"cell_type": "markdown",
"id": "e0f026cd-34df-4620-b2bb-f7bc95dfac39",
"metadata": {},
"source": [
"### Write Tiles to File Storage\n",
"\n",
"WherobotsDB creates vector tiles in the PMTiles format by default. The PMTiles format is a performant, simple, and\n",
"optimized format for creating vector tiles and provides an interface for configuration through a `PMTilesConfig` object.\n",
"In this example, we leverage a WherobotsDB feature to configure the archive directly from the feature DataFrame used to\n",
"generated the tiles:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "48866b66-5fd3-4fda-9e42-226c5b24f159",
"metadata": {},
"outputs": [],
"source": [
"val fullTilesPath = sys.env(\"USER_S3_PATH\") + \"tiles.pmtiles\"\n",
"VTiles.writePMTiles(tilesDf, fullTilesPath, featuresDf = Some(featuresDf))"
"val tilesDf = VTiles.generatePMTiles(featuresDf, fullTilesPath)"
]
},
{
Expand Down