diff --git a/.gitignore b/.gitignore index efa5523..5a5e2f8 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ wheels/ *.egg-info/ .ipynb_checkpoints + +simple_example \ No newline at end of file diff --git a/build.sh b/build.sh index b084e07..153f035 100644 --- a/build.sh +++ b/build.sh @@ -2,5 +2,5 @@ set -e set -o pipefail cd src/utk-ts && npm install && npm run build -cd - && cd src/utk-frontend && npm install && npm run build:web +cd - && cd src/utk-frontend && npm install && npm run build:web && npm run build:webpack cd - && python setup.py sdist \ No newline at end of file diff --git a/jupyter/simple_example_utk.ipynb b/jupyter/simple_example_utk.ipynb new file mode 100644 index 0000000..91fcc41 --- /dev/null +++ b/jupyter/simple_example_utk.ipynb @@ -0,0 +1,21803 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "2c051b20-8641-4040-9061-76ec6c868f52", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "C:\\Users\\Vinicius\\.pyenv\\pyenv-win\\versions\\3.10.5\\lib\\site-packages\\geopandas\\_compat.py:124: UserWarning: The Shapely GEOS version (3.10.3-CAPI-1.16.1) is incompatible with the GEOS version PyGEOS was compiled with (3.10.4-CAPI-1.16.2). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "********************************************************************************\n", + "PlotOptiX newer version is available: 0.17.0\n", + "to update your release use:\n", + " pip install plotoptix --upgrade\n", + "********************************************************************************\n" + ] + } + ], + "source": [ + "import utk\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "57b0a059-033e-457a-9451-6608c3ee3381", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0d0f2e10d567453fb6ab38ab1de8861a", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + " 0%| | 0/241 [00:00, ?it/s]" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "uc = utk.OSM.load([40.699768, -74.019904, 40.71135, -74.004712], layers=['water', 'surface', 'parks', 'roads', 'buildings'])\n", + "uc.save('./data/my_first_vis', includeGrammar=False)" + ] + }, + { + "cell_type": "markdown", + "id": "6c095384-0063-4692-97d2-16f15c664405", + "metadata": {}, + "source": [ + "Create an archive called grammar.json inside ./data/my_first_vis and insert the following code inside it:" + ] + }, + { + "cell_type": "markdown", + "id": "b9d33db1-3cbb-4ba2-91b1-e623e0d69494", + "metadata": {}, + "source": [ + "```[json]\n", + "{\n", + " \"components\": [\n", + " {\n", + " \"map\": {\n", + " \"camera\": {\n", + " \"position\": [\n", + " -8239611,\n", + " 4941390.5,\n", + " 2.100369140625\n", + " ],\n", + " \"direction\": {\n", + " \"right\": [\n", + " 553.601318359375,\n", + " -2370.810546875,\n", + " 2100.369140625\n", + " ],\n", + " \"lookAt\": [\n", + " 563.9249267578125,\n", + " -1633.5897216796875,\n", + " 1424.7962646484375\n", + " ],\n", + " \"up\": [\n", + " 0.009459096007049084,\n", + " 0.6755067110061646,\n", + " 0.7372931241989136\n", + " ]\n", + " }\n", + " },\n", + " \"knots\": [\n", + " \"purewater\",\n", + " \"pureparks\",\n", + " \"pureroads\",\n", + " \"buildings\"\n", + " ],\n", + " \"interactions\": [\n", + " \"NONE\",\n", + " \"NONE\",\n", + " \"NONE\",\n", + " \"NONE\"\n", + " ]\n", + " },\n", + " \"plots\": [],\n", + " \"knots\": [\n", + " {\n", + " \"id\": \"purewater\",\n", + " \"integration_scheme\": [\n", + " {\n", + " \"out\": {\n", + " \"name\": \"water\",\n", + " \"level\": \"OBJECTS\"\n", + " }\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"id\": \"pureparks\",\n", + " \"integration_scheme\": [\n", + " {\n", + " \"out\": {\n", + " \"name\": \"parks\",\n", + " \"level\": \"OBJECTS\"\n", + " }\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"id\": \"pureroads\",\n", + " \"integration_scheme\": [\n", + " {\n", + " \"out\": {\n", + " \"name\": \"roads\",\n", + " \"level\": \"OBJECTS\"\n", + " }\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"id\": \"buildings\",\n", + " \"integration_scheme\": [\n", + " {\n", + " \"spatial_relation\": \"NEAREST\",\n", + " \"out\": {\n", + " \"name\": \"buildings\",\n", + " \"level\": \"OBJECTS\"\n", + " }\n", + " }\n", + " ]\n", + " }\n", + " ],\n", + " \"widgets\": [\n", + " {\n", + " \"type\": \"TOGGLE_KNOT\"\n", + " }\n", + " ],\n", + " \"position\": {\n", + " \"width\": [\n", + " 6,\n", + " 12\n", + " ],\n", + " \"height\": [\n", + " 1,\n", + " 4\n", + " ]\n", + " }\n", + " }\n", + " ],\n", + " \"arrangement\": \"LINKED\",\n", + " \"grid\": {\n", + " \"width\": 12,\n", + " \"height\": 4\n", + " },\n", + " \"grammar_position\": {\n", + " \"width\": [\n", + " 1,\n", + " 5\n", + " ],\n", + " \"height\": [\n", + " 1,\n", + " 4\n", + " ]\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "1c35e290-5f8e-45b8-9c0b-5e894f9c3bd4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "utk start --data ./data/my_first_vis/ --grammar ./data/my_first_vis/grammar.json\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + "
\n", + "\n", + "\n", + "\n", + "