Skip to content

Commit

Permalink
Update example.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
ni1o1 committed Apr 13, 2022
1 parent b34d568 commit 4e4e78f
Showing 1 changed file with 0 additions and 99 deletions.
99 changes: 0 additions & 99 deletions docs/source/example/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,102 +326,3 @@ light. Given coordinates and height of the point light:

.. figure:: https://github.com/ni1o1/pybdshadow/raw/main/image/README/1649405838683.png
:alt: 1649405838683.png


Advertisment billboard analyze
==============================

Billboard visual area analyze
-----------------------------

To analyze billboard visual area, the parameter ``ad_params`` for the
billboard should be defined. It has two forms:

::

#ad_params for the billboard should be defined. It has two forms
#1. Given the coordinates of brandCenter, orientation and height
ad_params = {'orientation': 1.2806657381630058,
'height': 10,
'brandCenter': [139.71259, 35.552842999999996]}
#2. Given the coordinates of the two border points and height
ad_params = {'point1': [139.711861, 35.552040],
'point2': [139.713319, 35.553646],#1861,3646
'height': 50,
}

We can calculate the visual area of the billboard using
``ad_visualArea``.

::

#calculate the visual area
visualArea,shadows = pybdshadow.ad_visualArea(ad_params,buildings)

Then, visualize the billboard and the visual area.

::

#Generate a GeoDataFrame from ad_params for visualization
billboard_gdf = pybdshadow.ad_to_gdf(ad_params,billboard_height = 100)
#Visualize buildings, shadows, billboard and visual area
pybdshadow.show_bdshadow(buildings=buildings,
shadows=shadows,
ad=billboard_gdf,
ad_visualArea=visualArea)


.. figure:: https://github.com/ni1o1/pybdshadow/raw/main/image/README/1649406044109.png
:alt: 1649406044109.png


Optimize billboard parameters
-----------------------------

Optimize advertisment parameters using Genetic Algorithm

::

#Define area boundaries
bounds = [139.707846,35.543637,139.718567,35.553909]
#Optimize billboard parameters
ad_params = pybdshadow.ad_optimize(bounds,
buildings,
height_range=[100,200],
printlog=True,
size_pop=10,
max_iter=10,
prob_mut=0.001,
precision=1e-7)
ad_params

.. figure:: https://github.com/ni1o1/pybdshadow/blob/main/docs/source/example/output_ga.png?raw=true
:alt: output_ga.png

::

{'orientation': 4.504880430224753,
'height': 109.41611234294162,
'brandCenter': [139.70883048898688, 35.550840354517774]}

::

#calculate the visual area
visualArea,shadows = pybdshadow.ad_visualArea(ad_params,buildings)
#Generate a GeoDataFrame from ad_params for visualization
billboard_gdf = pybdshadow.ad_to_gdf(ad_params,billboard_height = 100)
#Visualize buildings, shadows, billboard and visual area
pybdshadow.show_bdshadow(buildings=buildings,
shadows=shadows,
ad=billboard_gdf,
ad_visualArea=visualArea)

.. figure:: https://github.com/ni1o1/pybdshadow/blob/main/image/README/QQ20220413-100625.png?raw=true
:alt: QQ20220413-100625.png

0 comments on commit 4e4e78f

Please sign in to comment.