diff --git a/example/example.ipynb b/example/example.ipynb index a05deae..8ffc47d 100644 --- a/example/example.ipynb +++ b/example/example.ipynb @@ -404,7 +404,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "6890f4b124d54b7c849e69a866cb1575", + "model_id": "de2c7641e08040a3ad45e212f3451770", "version_major": 2, "version_minor": 0 }, @@ -457,7 +457,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "4651f37936ab49f7ba788f90fc0a5be5", + "model_id": "449aba9c953e428b86f7c5d17d47556d", "version_major": 2, "version_minor": 0 }, @@ -482,186 +482,6 @@ "source": [ "![1649405838683.png](https://github.com/ni1o1/pybdshadow/raw/main/image/README/1649405838683.png)" ] -<<<<<<< Updated upstream - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Advertisment billboard analyze" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Billboard visual area analyze" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "To analyze billboard visual area, the parameter `ad_params` for the billboard should be defined. It has two forms:" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], - "source": [ - "#ad_params for the billboard should be defined. It has two forms\n", - "#1. Given the coordinates of brandCenter, orientation and height\n", - "ad_params = {'orientation': 1.2806657381630058,\n", - " 'height': 10,\n", - " 'brandCenter': [139.71259, 35.552842999999996]} \n", - "\n", - "#2. Given the coordinates of the two border points and height\n", - "ad_params = {'point1': [139.711861, 35.552040],\n", - " 'point2': [139.713319, 35.553646],#1861,3646\n", - " 'height': 50,\n", - " }" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We can calculate the visual area of the billboard using `ad_visualArea`." - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [], - "source": [ - "#calculate the visual area\n", - "visualArea,shadows = pybdshadow.ad_visualArea(ad_params,buildings)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Then, visualize the billboard and the visual area." - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "User Guide: https://docs.kepler.gl/docs/keplergl-jupyter\n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "803cefbc1cd54e1f8ac53f7f254e1961", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "KeplerGl(config={'version': 'v1', 'config': {'visState': {'filters': [], 'layers': [{'id': 'lz48o1', 'type': '…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "\n", - "\n", - "#Generate a GeoDataFrame from ad_params for visualization\n", - "billboard_gdf = pybdshadow.ad_to_gdf(ad_params,billboard_height = 100)\n", - "\n", - "#Visualize buildings, shadows, billboard and visual area\n", - "pybdshadow.show_bdshadow(buildings=buildings,\n", - " shadows=shadows,\n", - " ad=billboard_gdf,\n", - " ad_visualArea=visualArea)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "![1649406044109.png](https://github.com/ni1o1/pybdshadow/raw/main/image/README/1649406044109.png)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Optimize billboard parameters" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Optimize advertisment parameters using Genetic Algorithm" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "ename": "AttributeError", - "evalue": "module 'pybdshadow' has no attribute 'ad_optimize'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/var/folders/b0/q8rx9fj965b5p7yqq8zhvdx80000gn/T/ipykernel_51474/385305134.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;31m#Optimize billboard parameters\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m ad_params = pybdshadow.ad_optimize(bounds,\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0mbuildings\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mheight_range\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m100\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m200\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mAttributeError\u001b[0m: module 'pybdshadow' has no attribute 'ad_optimize'" - ] - } - ], - "source": [ - "#Define area boundaries\n", - "bounds = [139.707846,35.543637,139.718567,35.553909]\n", - "\n", - "#Optimize billboard parameters\n", - "ad_params = pybdshadow.ad_optimize(bounds,\n", - " buildings,\n", - " height_range=[100,200],\n", - " printlog=True,\n", - " size_pop=10,\n", - " max_iter=10,\n", - " prob_mut=0.001,\n", - " precision=1e-7)\n", - "ad_params\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "#calculate the visual area\n", - "visualArea,shadows = pybdshadow.ad_visualArea(ad_params,buildings)\n", - "\n", - "#Generate a GeoDataFrame from ad_params for visualization\n", - "billboard_gdf = pybdshadow.ad_to_gdf(ad_params,billboard_height = 100)\n", - "\n", - "#Visualize buildings, shadows, billboard and visual area\n", - "pybdshadow.show_bdshadow(buildings=buildings,\n", - " shadows=shadows,\n", - " ad=billboard_gdf,\n", - " ad_visualArea=visualArea)" - ] -======= ->>>>>>> Stashed changes } ], "metadata": {