qwat / qwat-data-model

TEKSI Water module (project QWAT) - PostgreSQL / postgis Datamodel
https://www.teksi.ch
23 stars 25 forks source link

fk_pipe in valves gets filled with bogus pipe id's #76

Closed tudorbarascu closed 8 years ago

tudorbarascu commented 8 years ago

the title is explicit enough.

tudorbarascu commented 8 years ago

It's not fixed yet, you can test by trying

INSERT INTO qwat_od.distributor (name) VALUES ('Demo Distributor');

INSERT INTO qwat_od.pipe (geometry, fk_function, fk_material, fk_distributor, fk_status, fk_watertype, fk_installmethod, fk_precision, fk_bedding)
SELECT ST_SetSRID(ST_GeomFromText('LINESTRING (559980 149980, 559990 149990, 560000 150000)'), 21781), 4105, 101, 1, 1301, 1502, 101, 101, 101;

INSERT INTO qwat_od.pipe (geometry, fk_function, fk_material, fk_distributor, fk_status, fk_watertype, fk_installmethod, fk_precision, fk_bedding)
SELECT ST_SetSRID(ST_GeomFromText('LINESTRING (560000 150000, 560010 150010, 560020 150020)'), 21781), 4105, 101, 1, 1301, 1502, 101, 101, 101;

INSERT INTO qwat_od.pipe (geometry, fk_function, fk_material, fk_distributor, fk_status, fk_watertype, fk_installmethod, fk_precision, fk_bedding)
SELECT ST_SetSRID(ST_GeomFromText('LINESTRING (560000 150000, 559990 150010, 559980 150020)'), 21781), 4105, 101, 1, 1301, 1502, 101, 101, 101;

INSERT INTO qwat_od.vw_element_valve (geometry, fk_distributor, fk_status, fk_valve_type, fk_valve_function, fk_actuation)
SELECT ST_SetSRID(ST_GeomFromText('POINT(559990 149990)'), 21781), 1, 1301, 101, 101, 101;

INSERT INTO qwat_od.vw_element_valve (geometry, fk_distributor, fk_status, fk_valve_type, fk_valve_function, fk_actuation)
SELECT ST_SetSRID(ST_GeomFromText('POINT(559990 150010)'), 21781), 1, 1301, 101, 101, 101;

Which creates the following setup: pic

The pipes start end points are:

The pipe id for both valves is 1, which is incorrect. Also, the rotations of the pipes are currently:

...

tudorbarascu commented 8 years ago

Thanks a lot for investigating Denis ;).

3nids commented 8 years ago

should be good now!

3nids commented 8 years ago

so, orientation is ok for you now?

tudorbarascu commented 8 years ago

It looks good now regarding fk_pipe Orientation is bad though.

SELECT id, _pipe_orientation FROM qwat_od.vw_element_valve;

outputs

 id | _pipe_orientation 
----+-------------------
  5 |               -45
  6 |              -135

When in fact it should output:

 id | _pipe_orientation 
----+-------------------
  5 |               45
  6 |              315
3nids commented 8 years ago

There is a 90° shift. It is somehow practical because there is no need for an expression in QGIS (it uses directly the value of the angle) for the rotation. Is this ok for you?

3nids commented 8 years ago

I might have fixed some errors though 719873b

tudorbarascu commented 8 years ago

Good morning.

It's ok by me if it's shifted with 90 degrees. However, I think it would be better if the SVG's/symbols we're using are rotated using Inkscape. This way:

I still have some strange rotations, will try and make a test case. Thanks a lot!