Live » History » Version 1
Philippe May, 06/05/2019 16:37
| 1 | 1 | Philippe May | h1. Live |
|---|---|---|---|
| 2 | 1 | Philippe May | |
| 3 | 1 | Philippe May | While the primary intention is use a database for all layers, Gisaf has the capability to display layers directly from GeoPandas GeodataFrames. |
| 4 | 1 | Philippe May | |
| 5 | 1 | Philippe May | In this case, they can also be updated dynamically, adding animation capabilities to the maps. |
| 6 | 1 | Philippe May | |
| 7 | 1 | Philippe May | This can be used for, eg: |
| 8 | 1 | Philippe May | |
| 9 | 1 | Philippe May | * displaying text (eg. temperatures, well levels) |
| 10 | 1 | Philippe May | * moving elements |
| 11 | 1 | Philippe May | * results of computations and analysis... |
| 12 | 1 | Philippe May | |
| 13 | 1 | Philippe May | h2. Using live directly from a Python script on the Gisaf server |
| 14 | 1 | Philippe May | |
| 15 | 1 | Philippe May | Eg: |
| 16 | 1 | Philippe May | |
| 17 | 1 | Philippe May | <pre><code class="python"> |
| 18 | 1 | Philippe May | #!/usr/bin/env python |
| 19 | 1 | Philippe May | from asyncio import run |
| 20 | 1 | Philippe May | |
| 21 | 1 | Philippe May | import geopandas as gpd |
| 22 | 1 | Philippe May | |
| 23 | 1 | Philippe May | from shapely.geometry import Point |
| 24 | 1 | Philippe May | |
| 25 | 1 | Philippe May | from gisaf.live import live_server |
| 26 | 1 | Philippe May | |
| 27 | 1 | Philippe May | async def run(gs): |
| 28 | 1 | Philippe May | gdf = gpd.GeoDataFrame( |
| 29 | 1 | Philippe May | data={ |
| 30 | 1 | Philippe May | 'geometry': [ |
| 31 | 1 | Philippe May | Point(12.01, 79.81) |
| 32 | 1 | Philippe May | ] |
| 33 | 1 | Philippe May | }, |
| 34 | 1 | Philippe May | crs='epsg:4326' |
| 35 | 1 | Philippe May | ) |
| 36 | 1 | Philippe May | |
| 37 | 1 | Philippe May | await live_server.publish_gdf('FooLayer', gdf) |
| 38 | 1 | Philippe May | |
| 39 | 1 | Philippe May | |
| 40 | 1 | Philippe May | async def main(): |
| 41 | 1 | Philippe May | await live_server.create_connections() |
| 42 | 1 | Philippe May | await run(gs) |
| 43 | 1 | Philippe May | |
| 44 | 1 | Philippe May | if __name__ == '__main__': |
| 45 | 1 | Philippe May | run(main()) |
| 46 | 1 | Philippe May | </code></pre> |