Skip to content

Commit

Permalink
Merge pull request #368 from Nitnelav/cnossos
Browse files Browse the repository at this point in the history
Add osm road type to ROADS table + PointNoiseMap fix
For later use with possible osm based speed or acceleration distributions for exemple
  • Loading branch information
nicolas-f authored Jul 27, 2021
2 parents 56d0a0d + b278d7d commit 4102e2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.index.strtree.STRtree;
import org.noise_planet.noisemodelling.pathfinder.ComputeRays;
import org.noise_planet.noisemodelling.propagation.ComputeRaysOutAttenuation;
Expand Down Expand Up @@ -209,7 +208,7 @@ public Map<CellIndex, Integer> searchPopulatedCells(Connection connection) throw
try (SpatialResultSet srs = rs.unwrap(SpatialResultSet.class)) {
while (srs.next()) {
Geometry pt = srs.getGeometry();
if(pt instanceof Point && !pt.isEmpty()) {
if(pt != null && !pt.isEmpty()) {
Coordinate ptCoord = pt.getCoordinate();
List queryResult = rtree.query(new Envelope(ptCoord));
for(Object o : queryResult) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,23 +246,24 @@ def exec(Connection connection, input) {

if (!ignoreRoads) {
sql.execute("DROP TABLE IF EXISTS ROADS")
sql.execute("create table ROADS (PK serial, ID_WAY integer, THE_GEOM geometry, LV_D integer, LV_E integer,LV_N integer,HV_D integer,HV_E integer,HV_N integer,LV_SPD_D integer,LV_SPD_E integer,LV_SPD_N integer,HV_SPD_D integer, HV_SPD_E integer,HV_SPD_N integer, PVMT varchar(10));")
sql.execute("create table ROADS (PK serial, ID_WAY integer, THE_GEOM geometry, TYPE varchar, LV_D integer, LV_E integer,LV_N integer,HV_D integer,HV_E integer,HV_N integer,LV_SPD_D integer,LV_SPD_E integer,LV_SPD_N integer,HV_SPD_D integer, HV_SPD_E integer,HV_SPD_N integer, PVMT varchar(10));")

for (Road road: handler.roads) {
if (road.geom.isEmpty()) {
continue;
}
String query = 'INSERT INTO ROADS(ID_WAY, ' +
'THE_GEOM, ' +
'TYPE, ' +
'LV_D, LV_E, LV_N, ' +
'HV_D, HV_E, HV_N, ' +
'LV_SPD_D, LV_SPD_E, LV_SPD_N, ' +
'HV_SPD_D, HV_SPD_E, HV_SPD_N, ' +
'PVMT) ' +
' VALUES (?,' +
'st_setsrid(st_updatez(ST_precisionreducer(ST_SIMPLIFYPRESERVETOPOLOGY(ST_TRANSFORM(ST_GeomFromText(?, 4326), '+srid+'),0.1),1), 0.05), ' + srid + '),' +
'?,?,?,?,?,?,?,?,?,?,?,?,?);'
sql.execute(query, [road.id, road.geom,
'?,?,?,?,?,?,?,?,?,?,?,?,?,?);'
sql.execute(query, [road.id, road.geom, road.type,
road.getNbLV("d"), road.getNbLV("e"), road.getNbLV("n"),
road.getNbHV("d"), road.getNbHV("e"), road.getNbHV("n"),
Road.speed[road.category], Road.speed[road.category], Road.speed[road.category],
Expand Down

0 comments on commit 4102e2f

Please sign in to comment.