[OSGeo-Discuss] Fwd: Compare linestrings in postgres

Andy Anderson aanderson at amherst.edu
Thu Feb 9 04:03:50 PST 2017


Hi, Konstantinos,

I’d recommend asking your question on the postgis-specific mailing list:

https://lists.osgeo.org/mailman/listinfo/postgis-users

You’re likely to get a better response there.

This list is for discussion “about the Open Source Geospatial Foundation (OSGeo) in general”.

— Andy

On Feb 9, 2017, at 1:59 AM, Karamanlis Konstantinos <konkaramanlis at gmail.com<mailto:konkaramanlis at gmail.com>> wrote:


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:

<pepe.jpg>


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



_______________________________________________
Discuss mailing list
Discuss at lists.osgeo.org<mailto:Discuss at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/discuss/attachments/20170209/0ca119ea/attachment-0002.html>


More information about the Discuss mailing list