[OSGeo-Discuss] Fwd: Compare linestrings in postgres

Karamanlis Konstantinos konkaramanlis at gmail.com
Wed Feb 8 22:59:27 PST 2017


Hi to eveyrone,

my name is Konstantinos and I am new both in the mailing list and postgis.
My field is electrical engineering and currently  I m working on modelling
of power networks. A sugnificant part of my work deals with spatial data. I
have a question concerning an issue (explain it below) and would like to
ask for your opinion.  The processing is done in 2 database from which I
extract the following part of grids:




Both pictures illustrate the same object. The blue  is considered to be the
valid one, while the green contains missing data. Therefore my aim is to
compare the geometries of the lines of both grids and find similarities.
For example the lines of the third image can be considers as identical and
hence tha blue data can be copyed to the green. To mention that both
databases have column with the geometries of the lines. I am running the
following:

create index geom_1_idx ON table1 USING GIST (geometry_1);
select table1_id, table2_id  from table1 t1, table2 t2
              where (select st_DWithin(t1.geometry_2 , t2.geometry_2,
units_of_srid) = true)


 I used spatial indexing according to your guidelines (
http://revenant.ca/www/postgis/workshop/indexing.html). As far I have
understood by this code, I compare the bounding boxes of the lines and if
the distance between the boxes is not higher than "units_of_srid", then the
two geometries are considered identical.

My first question is if it s right what I wrote. How can I improve this in
order not to miss "identical" lines?

Thank you in advance and for your understanding.
Looking forward for your comments and corrections.

Kind regards,

Konstantinos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/discuss/attachments/20170209/3cfce25f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pepe.jpg
Type: image/jpeg
Size: 16538 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/discuss/attachments/20170209/3cfce25f/attachment.jpg>


More information about the Discuss mailing list