{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "d3e03ab2", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "markdown", "id": "a9210f39", "metadata": {}, "source": [ "# This is required for tippecanoe to guess the proper types for the fields" ] }, { "cell_type": "code", "execution_count": null, "id": "1cd097e5", "metadata": {}, "outputs": [], "source": [ "tippecanoe_df_types = pd.DataFrame(da_df_cop_df.dtypes)\n", "\n", "attributes_types = [] \n", "for row in tippecanoe_df_types.itertuples():\n", " # This is what it should look like --attribute-type=count_total_1:int\n", " column_name = row[0]\n", " column_type = str(row[1])\n", " \n", " if 'Int' in column_type:\n", " parameter = f\"--attribute-type={column_name}:int\"\n", " attributes_types.append(parameter)\n", " elif 'Float' in column_type:\n", " parameter = f\"--attribute-type={column_name}:float\"\n", " attributes_types.append(parameter) " ] }, { "cell_type": "code", "execution_count": 2, "id": "d8b20754", "metadata": {}, "outputs": [ { "ename": "NameError", "evalue": "name 'attributes_types' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mjoin(\u001b[43mattributes_types\u001b[49m))\n", "\u001b[0;31mNameError\u001b[0m: name 'attributes_types' is not defined" ] } ], "source": [ "print(' '.join(attributes_types))" ] }, { "cell_type": "markdown", "id": "160d5b8f", "metadata": {}, "source": [ "# Then we edit the metadata for the generated vector tiles to remove the long generator_options\n", "\n", "Edit metadata.json and remove generator_options\n", "```\n", "pmtiles show test.pmtiles --metadata > metadata.json\n", "pmtiles edit test.pmtiles --metadata=metadata.json\n", "```" ] }, { "cell_type": "code", "execution_count": null, "id": "9280e3d2", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.9" } }, "nbformat": 4, "nbformat_minor": 5 }