Creating horizontal NoiseM@p

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Creating horizontal NoiseM@p

Adrien Le Bellec
Hi,

On the wiki NoiseM@p it's possible to create a horizontal noise map, but the script don't work.
For the groovy part, the function TriangleNoiseMap wait three variables (receivers, buildings, sources) where normally having two variables (Buildins, Sources).
The second problem comes from :
result = nm.evaluateCell(connection, 0, 0, new EmptyProgressVisitor());
after this function the script stay mute and return nothing.

I know that groovy script will no longer be useful in noisemap, but how to fix problem ?

Thanks

Adrien
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating horizontal NoiseM@p

Nicolas F.
Administrator
Noisemap 2 beta as just been released.

Wiki has been updated.

More demonstration tutorial will be written. Follow the tutorial in order to install noisemap on OrbisGIS 5.0

https://github.com/irstv/noisemap/wiki/Installation
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating horizontal NoiseM@p

Adrien Le Bellec
Fix NoiseM@p wiki part : 4 Industrial sound sources (https://github.com/irstv/noisemap/wiki/4-Industrial-sound-sources-application)


Wiki_NoiseM@p wrote
drop table if exists tri_lvl;
create table tri_lvl as SELECT * from BR_TriGrid(buildings,sound_source,'db_m',750,50,0,1.5,2.8,10,4,1,0.23);
-- Use the triangle area contouring interpolation (split triangle covering level parameter)
-- Use the triangle area contouring interpolation (split triangle covering level parameter)
-- iso lvls in w corresponding to dB->'45,50,55,60,65,70,75,200'
-- the output iso will be [-inf to 45] -> 0 ]45 to 50] -> 1 etc..
-- Theses levels corresponding to the ranges specified in the standart NF S 31 130
create table tricontouring_noise_map AS SELECT * from ST_TriangleContouring(tri_lvl,'db_v1','db_v2','db_v3','31622, 100000, 316227, 1000000, 3162277, 1e+7, 31622776, 1e+20');
-- Merge adjacent triangle into polygons (multiple polygon by row, for unique isoLevel and cellId key)
-- Merge triangle together to reduce the number of rows
create table multipolygon_iso as select * from ST_TABLEGEOMETRYUNION(tricontouring_noise_map);
-- Explode each row to keep only a polygon by row
drop table if exists contouring_noise_map;
create table contouring_noise_map as select the_geom,idiso from ST_Explode(multipolygon_iso);
drop table multipolygon_iso purge;
Adrien wrote
drop table if exists tri_lvl;
create table tri_lvl as SELECT * from BR_TriGrid('buildings','sound_source','DB_M','',750,50,1.5,2.8,75,2,1,0.23);
-- Use the triangle area contouring interpolation (split triangle covering level parameter)
-- iso lvls in w corresponding to dB->'45,50,55,60,65,70,75,200'
-- the output iso will be [-inf to 45] -> 0 ]45 to 50] -> 1 etc..
-- Theses levels corresponding to the ranges specified in the standart NF S 31 130
drop table if exists tricontouring_noise_map;
create table tricontouring_noise_map AS SELECT * from ST_TriangleContouring('tri_lvl','w_v1','w_v2','w_v3',31622, 100000, 316227, 1000000, 3162277, 1e+7, 31622776, 1e+20);
-- Merge adjacent triangle into polygons (multiple polygon by row, for unique isoLevel and cellId key)
drop table if exists multipolygon_iso;
create table multipolygon_iso as select ST_UNION(ST_ACCUM(the_geom)) the_geom ,idiso from tricontouring_noise_map GROUP BY IDISO, CELL_ID;
-- Explode each row to keep only a polygon by row
drop table if exists contouring_noise_map;
create table contouring_noise_map as select the_geom,idiso from ST_Explode('multipolygon_iso');
drop table multipolygon_iso;


Fix NoiseM@p wiki part : 7 Horizontal noisemap groovy (https://github.com/irstv/noisemap/wiki/7-Horizontal-noisemap-groovy)


Wiki_NoiseM@p wrote
import org.orbisgis.noisemap.core.jdbc.TriangleNoiseMap;
import org.h2gis.h2spatialapi.EmptyProgressVisitor;
import groovy.sql.Sql;

def sql = Sql.newInstance(grv_ds);

TriangleNoiseMap nm = new TriangleNoiseMap("result", "BATI_HAUTEUR", "SOURCE_SOURCE_2002_MERGED");
nm.setHeightField("HAUTEUR")
//nm.setDemTable("DEM");
nm.setSoundDiffractionOrder(1);
nm.setSoundReflectionOrder(2);
//nm.setMaximumArea(30);
def result = null
sql.cacheConnection() { connection ->
     def begin = System.currentTimeMillis()
     nm.initialize(connection, new EmptyProgressVisitor());
     result = nm.evaluateCell(connection, 0, 0, new EmptyProgressVisitor());
     print "Compute done in "+(System.currentTimeMillis()-begin)+ " ms"
}
// Create table
sql.execute("DROP TABLE IF EXISTS TRI_LVL")
sql.execute("CREATE TABLE TRI_LVL(the_geom POLYGON, db_v1 double, db_v2 double, db_v3 double)")
for( tri in result) {
     sql.execute("INSERT INTO TRI_LVL(THE_GEOM, db_v1, db_v2, db_v3) VALUES (?,?,?,?);",tri.getTriangle(), tri.getV1(), tri.getV2(), tri.getV3())
}
Adrien wrote
import org.orbisgis.noisemap.core.jdbc.TriangleNoiseMap;
import org.h2gis.h2spatialapi.EmptyProgressVisitor;
import groovy.sql.Sql;

def sql = Sql.newInstance(grv_ds);

TriangleNoiseMap nm = new TriangleNoiseMap("BUILDINGS", "SOUND_SOURCE");
nm.setHeightField("HEIGHT")
//nm.setDemTable("DEM");
nm.setSoundDiffractionOrder(1);
nm.setSoundReflectionOrder(2);
//nm.setMaximumArea(30);
def result = null
sql.cacheConnection() { connection ->
     def begin = System.currentTimeMillis()
     nm.initialize(connection, new EmptyProgressVisitor());
     result = nm.evaluateCell(connection, 0, 0, new EmptyProgressVisitor());
     print "Compute done in "+(System.currentTimeMillis()-begin)+ " ms"
}
// Create table
sql.execute("DROP TABLE IF EXISTS TRI_LVL")
sql.execute("CREATE TABLE TRI_LVL(the_geom POLYGON, db_v1 double, db_v2 double, db_v3 double)")
for( tri in result) {
     sql.execute("INSERT INTO TRI_LVL(THE_GEOM, db_v1, db_v2, db_v3) VALUES (?,?,?,?);",tri.getTriangle(), tri.getV1(), tri.getV2(), tri.getV3())
}

Adrien
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating horizontal NoiseM@p

Nicolas F.
Administrator
In reply to this post by Adrien Le Bellec
Hi,

The wiki has been updated. Samples has been posted on ground effect and digital elevation model.

Export of map into 3D model has been also covered using Groovy plugin in the dem tutorial.

Regards;

Nicolas Fortin
IRSTV FR CNRS 2488
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating horizontal NoiseM@p

Adrien Le Bellec
Hi,

is it possible to model a source above buildings or not?

Adrien
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating horizontal NoiseM@p

Nicolas F.
Administrator
Hi, Yes we can ! However this answer may need an Acoustician feedback in order to know if NMPB can properly compute this kind of propagation. Here the code for creating the same map:
-- make buildings table
drop table if exists buildings;
create table buildings ( the_geom GEOMETRY, height double );
INSERT INTO buildings VALUES 
('MULTIPOLYGON (((80 -30 0,80 90 0,-10 90 0,-10 70 0,60 70 0,60 -30 0,80 -30 0)))',5);
drop table if exists sound_source;
create table sound_source(the_geom geometry, db_m100 double,db_m125 double,db_m160 double,db_m200 double,db_m250 double,db_m315 double,db_m400 double,db_m500 double,db_m630 double,
db_m800 double,db_m1000 double,db_m1250 double,db_m1600 double,db_m2000 double,db_m2500 double,db_m3150 double,db_m4000 double,db_m5000 double);
insert into sound_source VALUES ('POINT(68 60 11)', 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100);
INSERT INTO sound_source VALUES ('POINT( -300 -300 0 )',Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0));
INSERT INTO sound_source VALUES ('POINT( 500 500 0 )',Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0));
-- Create Digital elevation model using gaussian 2d function
drop table if exists all_dem;
SET @DOMAIN_XMIN = SELECT ST_XMIN(ST_EXTENT(THE_GEOM)) FROM SOUND_SOURCE;
SET @DOMAIN_XMAX = SELECT ST_XMAX(ST_EXTENT(THE_GEOM)) FROM SOUND_SOURCE;
SET @DOMAIN_YMIN = SELECT ST_YMIN(ST_EXTENT(THE_GEOM)) FROM SOUND_SOURCE;
SET @DOMAIN_YMAX = SELECT ST_YMAX(ST_EXTENT(THE_GEOM)) FROM SOUND_SOURCE;
SET @POINT_COUNT = 50; 
SET @MOUNTAIN_X = -80;
SET @MOUNTAIN_Y = 50;
SET @MONTAIN_WIDTH = 8;
SET @MOUNTAIN_LENGTH = 50;
create table all_dem(the_geom POINT,Z double as ST_Z(the_geom)) as select ST_MAKEPOINT(X * ((@DOMAIN_XMAX - @DOMAIN_XMIN) / @POINT_COUNT) + @DOMAIN_XMIN, Y * ((@DOMAIN_YMAX - @DOMAIN_YMIN) / @POINT_COUNT) + @DOMAIN_YMIN,
-- Gaussian
10 * EXP(-(POWER(X - ((@MOUNTAIN_X - @DOMAIN_XMIN) / (@DOMAIN_XMAX - @DOMAIN_XMIN) * @POINT_COUNT)  ,2) / @MONTAIN_WIDTH  + POWER(Y - ((@MOUNTAIN_Y - @DOMAIN_YMIN) / (@DOMAIN_YMAX - @DOMAIN_YMIN) * @POINT_COUNT) ,2) / @MOUNTAIN_LENGTH ))) the_geom,

null  from (select X from system_range(0,@POINT_COUNT)),(select X Y from system_range(0,@POINT_COUNT)) ;
select (-24 - @DOMAIN_XMIN) / (@DOMAIN_XMAX - @DOMAIN_XMIN) * @POINT_COUNT;
-- Remove dem point too close from buildings
drop table if exists dem;
create spatial index on buildings(the_geom);
create table dem as select d.the_geom, d.Z from all_dem d where (select COUNT(*) near from buildings b where d.the_geom && b.the_geom AND ST_DISTANCE(d.the_geom, b.the_geom) < 1) = 0;

SET @DOMAIN_XMIN = -148;
SET @DOMAIN_XMAX = 214;
SET @DOMAIN_YMIN = 60;
SET @DOMAIN_YMAX = 60;
SET @DOMAIN_ZMIN = 0;
SET @DOMAIN_ZMAX = 40;
SET @POINT_COUNT = 200; 
SET @POINT_ZCOUNT = 50; 
drop table if exists receivers_cut;
create table receivers_cut(gid serial, the_geom POINT,Z double as ST_Z(the_geom)) as select null,ST_MAKEPOINT(((@DOMAIN_XMAX - @DOMAIN_XMIN) * (XY/@POINT_COUNT)) + @DOMAIN_XMIN, (@DOMAIN_YMAX - @DOMAIN_YMIN) * (XY/@POINT_COUNT) + @DOMAIN_YMIN,(@DOMAIN_ZMAX - @DOMAIN_ZMIN) * (Z/@POINT_ZCOUNT) + @DOMAIN_ZMIN + CASEWHEN(XY % 2 = 0, 0, (@DOMAIN_ZMAX - @DOMAIN_ZMIN) / (@POINT_ZCOUNT * 2)::double)) the_geom, null  from (select X::double XY from system_range(0,@POINT_COUNT)),(select X::double Z from system_range(0,@POINT_ZCOUNT)) ;
-- Add grounds layer for illustration
drop table if exists building2d;
create table building2d as select 'POLYGON((60 0, 80 0, 80 5, 60 5, 60 0))'::geometry the_geom;
drop table if exists propa_line;
create table propa_line as select ST_MAKELINE(ST_MAKEPOINT(@DOMAIN_XMIN, @DOMAIN_YMIN),ST_MAKEPOINT(@DOMAIN_XMAX, @DOMAIN_YMAX))  the_geom;
drop table if exists grid_del, expl_grid;
create table grid_del as select ST_CONSTRAINEDDELAUNAY(ST_ACCUM(the_geom), 1) the_geom from dem;
create table expl_grid(the_geom LINESTRING, GID SERIAL) as select the_geom, EXPLOD_ID GID from ST_EXPLODE('GRID_DEL');
drop table if exists propa_line_inters;
create table propa_line_inters(the_geom POINT, GID SERIAL) as select ST_INTERSECTION(p.the_geom, l.the_geom) the_geom, GID from propa_line p, expl_grid l WHERE ST_INTERSECTS(p.the_geom, l.the_geom);
update propa_line_inters set the_geom = (SELECT ST_POINTN(ST_INTERPOLATE3DLINE(ST_MAKELINE(ST_POINTN(g.the_geom, 1),propa_line_inters.the_geom,ST_POINTN(g.the_geom, 2))), 2) from expl_grid g where g.GID = propa_line_inters.GID);
drop table if exists profil, source2D;
create table profil as select ST_MAKEPOLYGON(ST_MAKELINE(ST_MAKEPOINT(@DOMAIN_XMIN, @DOMAIN_ZMIN),ST_UNION(ST_ACCUM(the_geom)), ST_MAKEPOINT(@DOMAIN_XMIN, @DOMAIN_ZMIN))) the_geom from (select ST_MAKEPOINT(ST_X(the_geom), ST_Z(the_geom)) the_geom from propa_line_inters order by ST_X(the_geom));
create table source2D as select ST_MAKEPOINT(ST_X(the_geom), ST_Z(the_geom)) the_geom from sound_source;
drop table if exists pt_level;
create table pt_level as select * from BR_PtGrid3D('BUILDINGS', 'HEIGHT','SOUND_SOURCE', 'RECEIVERS_CUT', 'DB_M', '','DEM', 750, 100, 2, 1, 0.23);

drop table if exists receiver_cloud,delaun;
create table receiver_cloud(the_geom POINT) as select ST_MAKEPOINT(ST_X(the_geom), ST_Z(the_geom), W) the_geom from pt_level A JOIN RECEIVERS_CUT B ON A.GID = B.GID;
-- delaunay fail if scan line starts with multiple points
insert into receiver_cloud values ((SELECT ST_UPDATEZ(ST_TRANSLATE(ST_POINTN(ST_TOMULTILINE(ST_EXTENT(the_geom)),1),-1,1),0) from receiver_cloud));
create table delaun as select ST_DELAUNAY(ST_ACCUM(the_geom)) the_geom from receiver_cloud;
drop table if exists tri_lvl,tricontouring_noise_map;
create table tri_lvl as select * from ST_EXPLODE('delaun');
create table tricontouring_noise_map AS SELECT * from ST_TriangleContouring('TRI_LVL',31622, 100000, 316227, 1000000, 3162277, 1e+7, 31622776, 1e+20);
-- Merge adjacent triangle into polygons (multiple polygon by row, for unique isoLevel and cellId key)
-- Merge triangle together to reduce the number of rows
drop table if exists multipolygon_iso;
create table multipolygon_iso as select IDISO, ST_UNION(ST_ACCUM(the_geom)) THE_GEOM FROM tricontouring_noise_map GROUP BY IDISO;
-- Explode each row to keep only a polygon by row
drop table if exists contouring_noise_map;
create table contouring_noise_map as select the_geom,idiso from ST_Explode('MULTIPOLYGON_ISO');
-- Remove intermediate tables
drop table if exists ALL_DEM, BUILDINGS, DELAUN, DEM, EXPL_GRID, GRID_DEL, MULTIPOLYGON_ISO, PROPA_LINE, PROPA_LINE_INTERS, RECEIVERS_CUT, RECEIVER_CLOUD, RECEIVER_LVL, SOUND_SOURCE, TRICONTOURING_NOISE_MAP;
Adrien Le Bellec wrote
Hi, is it possible to model a source above buildings or not? Adrien
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating horizontal NoiseM@p

Nicolas F.
Administrator
It seems there is still a remaining bug with horizontal diffraction intersection test with dem. I will check this point.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating horizontal NoiseM@p

Adrien Le Bellec
This post was updated on .
Hi,

I have a problem to create a horizontal map when the source is above a building. This is what i get :


Furthermore, increasing the size of the building, i get it :




I would like an propagation without topography elevation. How initiate it ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating horizontal NoiseM@p

Nicolas F.
Administrator
I've updated the plugin. You have to reinstall it using the dedicated tutorial. With the following code I obtain the horizontal noisemap with a noise source on top of a building
-- make buildings table
drop table if exists buildings;
create table buildings ( the_geom GEOMETRY, height double );
insert into buildings values
('POLYGON ((304081.971140762 2252842.2377583543, 304087.2927055786 2252852.3894956196, 304120.9740158394 2252833.548805693, 304115.1308573535 2252825.994945729, 304111.00898608495 2252828.2631819816, 304109.4290281007 2252825.6481492408, 304098.86882524966 2252831.967185081, 304100.45122728107 2252834.281990951, 304081.971140762 2252842.2377583543))', 18),
('POLYGON ((304066.507676677 2252934.287102647, 304066.8030005697 2252934.890006138, 304080.97572407214 2252927.3994797524, 304076.9437141237 2252918.6594214477, 304071.7177355701 2252921.3189708022, 304070.2378479165 2252918.7047548825, 304067.5243737129 2252920.0837501315, 304069.2019599965 2252922.9998262255, 304066.58774516406 2252924.4797140043, 304065.2079349268 2252921.866315325, 304062.0925250804 2252923.4421931794, 304061.1885783817 2252923.8351413365, 304066.507676677 2252934.287102647))', 6),
('POLYGON ((304116.64878738014 2252885.2559329206, 304110.6548854257 2252883.905929764, 304107.2804970879 2252892.685601917, 304111.92112771556 2252900.4298086576, 304118.5497980566 2252897.5815475294, 304112.3680011234 2252894.728779357, 304116.64878738014 2252885.2559329206))', 4),
('POLYGON ((304116.8496270616 2252909.677588094, 304135.2385924306 2252900.620172194, 304130.6061355095 2252891.875211711, 304116.6486897959 2252885.2559239715, 304112.3678984563 2252894.7287699394, 304118.54969539 2252897.5815381147, 304111.9210250483 2252900.42979924, 304116.8496270616 2252909.677588094))', 14),
('POLYGON ((304147.06500050006 2252935.3451201664, 304148.63721490436 2252926.6508168606, 304144.60684562515 2252917.710608132, 304115.06539856613 2252932.0814030115, 304121.1687605225 2252944.541408861, 304142.47134331334 2252934.106631618, 304147.06500050006 2252935.3451201664))', 15),
('POLYGON ((304025.02294641937 2252903.723622542, 304025.4158539388 2252904.6275655366, 304026.60040863417 2252906.6388771087, 304028.6742245948 2252910.05859954, 304055.60392891726 2252896.867466023, 304063.6704399612 2252914.0473602274, 304065.45140236564 2252916.56395479, 304073.6910965696 2252912.527862693, 304054.0027388107 2252872.33428636, 304018.5265914384 2252890.3596659536, 304025.02294641937 2252903.723622542))', 14);
drop table if exists sound_source;
create table sound_source(the_geom geometry,gid integer, db_m100 double,db_m125 double,db_m160 double,db_m200 double,db_m250 double,db_m315 double,db_m400 double,db_m500 double,db_m630 double,
db_m800 double,db_m1000 double,db_m1250 double,db_m1600 double,db_m2000 double,db_m2500 double,db_m3150 double,db_m4000 double,db_m5000 double);
SET @LEVEL = 98;
insert into sound_source VALUES ('POINT (304121 2252896 15.5)',2, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL, @LEVEL);
INSERT INTO sound_source VALUES ('POINT( 303916 2252800 0 )',3,Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0));
INSERT INTO sound_source VALUES ('POINT( 304408 2253069 0 )',4,Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0),Log10(0));
drop table if exists tri_lvl;
create table tri_lvl as SELECT * FROM BR_TRIGRID3D('BUILDINGS','HEIGHT', 'SOUND_SOURCE', 'DB_M','','', 700, 500,1,3,10,2,1,0.2);

-- Use the triangle area contouring interpolation (split triangle covering level parameter)
-- iso lvls in w corresponding to dB->'45,50,55,60,65,70,75,200'
-- the output iso will be [-inf to 45] -> 0 ]45 to 50] -> 1 etc..
-- Theses levels corresponding to the ranges specified in the standart NF S 31 130
drop table if exists tricontouring_noise_map;
create table tricontouring_noise_map AS SELECT * from ST_TriangleContouring('tri_lvl','w_v1','w_v2','w_v3',31622, 100000, 316227, 1000000, 3162277, 1e+7, 31622776, 1e+20);
-- Merge adjacent triangle into polygons (multiple polygon by row, for unique isoLevel and cellId key)
drop table if exists multipolygon_iso;
create table multipolygon_iso as select ST_UNION(ST_ACCUM(the_geom)) the_geom ,idiso from tricontouring_noise_map GROUP BY IDISO, CELL_ID;
-- Explode each row to keep only a polygon by row
drop table if exists contouring_noise_map;
create table contouring_noise_map as select the_geom,idiso from ST_Explode('multipolygon_iso');
drop table multipolygon_iso;
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Creating horizontal NoiseM@p

Nicolas F.
Administrator
In reply to this post by Adrien Le Bellec
Hi,

With the update I activate the computation of horizontal edge diffraction even if source-receiver are visible in direct field.

The new cross noise map is now:



In detail, each triangle vertex are receivers:



I just receive NMPB official library. I will be able to investigate further.

-Nicolas
Loading...