54
Introduction of flood evacuation route search using QGIS, PostGIS, GRASS and pgRouting Yoichi Kayama

Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Embed Size (px)

DESCRIPTION

presentation FOSS4G2010 Barcelona

Citation preview

Page 1: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Introduction of flood evacuation

route search using QGIS,

PostGIS, GRASS and pgRouting

Yoichi Kayama

Page 2: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Self-introduction

• A member of OSGeo.JP

• A member of GISA Japan(also a member of

FOSS4G SIG)

• Coordinator of QGIS Japanese GUI translators

• Working as GIS programmer and researcher at

Aero Asahi Corporation

Page 3: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Flood area simulation map

• In Japan, since 2001 , MLIT( The Ministry of

Land, Infrastructure, Transport and Tourism )

and prefectural governments made maps of

flood area simulation about major rivers.

Page 4: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Flood area simulation map

http://www.ktr.mlit.go.jp/tonejo/saigai/sinsuisoutei/tonegawa_zentai.pdf

Page 5: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Hazard map (made by local government )

http://www.town.itakura.gunma.jp/kurashi/kinkyuu/hazard.html

Page 6: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

http://www.mlit.go.jp/river/shishin_guideline/bousai/press/200507_12/050705/050705_manual.pdf

Water depth calculated unit

making flood area simulation maps

Hight of water surface were

Calculated by 250m grid unit

Water depths were calculated by

50m grid unit of ground elevation

Page 7: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

50m grid overlay

Page 8: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

2m grid overlay

Page 9: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

50m grid overlay

Page 10: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Compare 2m grid and 50m grid

2m 50m

Page 11: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

using 2m grid ,we could find that such

a road on bank is submerged or not

2m 50m

Page 12: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Using fine grid is better

Page 13: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

How can we get

such a fine grid elevation

data ?

Page 14: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

LiDAR SystemAERO ASAHI CORPORATION

ALMAPS

航空機の姿勢および加速度情報ω,φ、κ、a

IMU

航空機の空間位置情報X1,Y1、Z1

GPS on aircraft

レーザー照射角および往復時間

θ,t

Laser Scanner

航空機の空間位置の補正情報

X2,Y2、Z2

Ground GPS

We can get fine grid elevation data using

LiDAR system

Page 15: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

ALMAPS(Asahi Laser MAPping System/Aerial Lidar Mapping)

Page 16: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting
Page 17: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Using 2m grid elevation data from

LIDAR ,we could make fine flood area

simulation maps

Hight of water surface were

Calculated by 250m unit

Water depths were calculated by

2m unit of ground elevation

2m

2m

2m

2m

Page 18: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

We could get fine flood area map

using LIDAR mapping

Page 19: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

There are many flood area simulation

data by 10 minute every assumed place

where bank overtopping

20minute

30minute

40minute

50minute

60minute

10minute

Page 20: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

We can see assumed flood area

vary with time

Page 21: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

10 minutes later after overflow

Page 22: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

20 minutes later after overflow

Page 23: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

50 minutes later after overflow

Page 24: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

120 minutes later after overflow

Page 25: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

180 minutes later overflow

Page 26: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Using such fine flood area data

• If we have network data of roads, I thought

perhaps I could make a program of searching

route system, without roads of submerged.

Page 27: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

How can I make such system?

Page 28: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

When we would make a system

about searching route,

• I think, using pgRouting is a best solution .

Page 29: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

pgRouting is a excellent program for

searching shortest path route

Page 30: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

We can add any conditions to the

pgRouting search functions as SQL

• Those conditions must be described as SQL of

PostGIS/PostgreSQL.

• We can use many spatial relation function at

PostGIS.

• So we can add spatial conditions to the search

function of pgRouting by using functions of

PostGIS.

Page 31: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

But !!

• Using stable version of PostGIS, we can use

only vector type geometries.

• We have no functions in PostGIS about raster

data now.

• LIDAR data and flood area data are raster.

• So we could not use raster flood area data for

spatial functions in PostGIS.

Page 32: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Raster Data

How can I use it with pgRouting?

• If I can change raster of flood area to vector,

such as polygon, I could use the polygon data

for pgRouting function.

• Are there any program ,have such function ?

Page 33: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

GRASS

• GRASS has many functions about raster and

vector spatial data.

Page 34: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Data conversion process

Import raster of flood area to GRASS mapset r.in.gdal 

Select the pixels from raster these are submerged =( depth >= 0.3m).Create a new raster using selected pixels with value 1 and other pixels with null.

r.mapcalc "D_SINSUI_NEW = if (D_SINSUI_ORG >= 0.3,1,null())"(D_SINSUI_NEW is new raster name D_SINSUI_ORG is original raster name)

Convert the raster to the vectorr.to.vect --overwrite --verbose input=D_SINSUI_NEW output=D_SINSUI_POLYGON feature=area

Export the vector of flood area to the shapev.out.ogr -c -e -p --verbose input=D_SINSUI_POLYGON type=line,boundary,area

dsn=D_SINSUI_shp

Make a SQL to load the shape file of flood area to the PostGIS/PostgreSQL databaseshp2pgsql -s 2451 D_SINSUI  public.D_SINSUI_TBL > DSinsui.sql

Execute the SQL to load the flood area polygons to the PostGIS/PostgreSQL database

psql -d dbname -U Username -f DSinsui.sql

START

END

Page 35: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Import raster of flood area to

GRASS mapset

r.in.gdal

Page 36: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Select the pixels from raster these are submerged =(

depth >= 0.3m).

Create a new raster using selected pixels with value 1 and

other pixels with null.

r.mapcalc "D_SINSUI_NEW = if

(D_SINSUI_ORG >= 0.3,1,null())"

Page 37: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Convert the raster to the vector

r.to.vect --overwrite --verbose

input=D_SINSUI_NEW

output=D_SINSUI_POLYGON feature=area

Page 38: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Details of created polygon

Page 39: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Export the vector of flood area to

shape file

v.out.ogr -c -e -p --verbose input=D_SINSUI_POLYGON

type=line,boundary,area dsn=D_SINSUI_shp

Page 40: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Load shapfiles to

PostGIS/Postgresql database

Page 41: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Now we can search using such SQL

SELECT vertex_id , edge_id , cost FROM

shortest_path_astar( -- shortest path A star

'SELECT a.gid as id, source, target, cost as cost, x1, y1, x2, y2

FROM ways as a where a.gid not in( select b.gid from ways as b,

suishin_polygon_all as c where c.minute = 30

-- after 30 minute from bank break

and ST_Intersects(b.the_geom,c.the_geom))‘

-- is geometries intersect? a function of PostGIS

,4799, 3962, false, false)

/* source id, target id, directed, has reverse cost */

Page 42: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Using pgRouting

• We can search route with network data

• But there are query results strings.

• There are no maps of route using only pgRouting.

• How we can see the maps of routes ?

Page 43: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

There are may ways of make a map

for pgRouting

• Web Mapping such as OpenLayers are cool

method.

• There are some good desktop GIS tools such as

QGIS, uDig, gvSIG, Open JUMP etc……

• Perhaps we can see a map ,that contain result of

using pgRouting, with such good FOSS4G

products.

Page 44: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

I used QuantumGIS for this system

• Stand alone use(without internet) is required

• There are Japanese GUI( we transrated )

• We can add functions as external plug-in

program to QuantumGIS.

Page 45: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

A system using pgRouting

DEM

Flooded

area

Road

network

Shelter s

Points

PostgreSQL

PostGIS

PgRouting

QuantumGIS

QGIS

Python

Plug-in

Page 46: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Route to a shelter

Start point

target point

route

Submerged area

overflow point

Page 47: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

There are no route to any shelter

Start point

Submerged area

overflow point

Page 48: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

10 minutes later after overflow

Start point

target point

route

Submerged area

overflow point

Page 49: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

30 minutes later after overflow

Start point

target point

route

Submerged area

overflow point

Page 50: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Driving distance calculation

Start point

Within 30 minute , reachable route by walking

without submerged road

Page 51: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Demo ?

Page 52: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Using FOSS4G products

• Without FOSS4G we would have been difficult

to obtain tools for such spatial data usage.

• pgRouting, PostGIS/PostgreSQL, GRASS,

QGIS have excellent functions for our works.

• I think when we want to use some functions

about spatial data, make combination of some

FOSS4G product is best solution.

Page 53: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

• This system made for The Ministry of Land,

Infrastructure, Transport and Tourism Japan,

Kanto Regional Development Bureau.

Page 54: Introduction of flood evacuation route search system using QGIS,PostGIS,GRASS and pgRouting

Thanks for your attention