[postgis-devel] distance measuring between ugly polygons
nicklas.aven at jordogskog.no
nicklas.aven at jordogskog.no
Fri Jul 17 06:10:28 PDT 2009
As written in ticket #63 and #137 I have rewritten the oplygon-polygon measuring.
Here I post a shapefile with one ugly polygon and one more normal.
I don't know how common problem it is to work with this ugly ones, but I had to do it the other day and this will help me a lot.
if I run :
select st_distance(a.the_geom, b.the_geom) from example a, example b where a.objektid = 1 and b.objektid =2
I now get a querytime on about 720 ms to compare with more than 6 seconds before.
I also tried to use the bounding-box as a shortcircuit to determine if the polygons shared bbox and otherwise go directly on just comparing outer-rings. But that wasn't that easy as I understood it when the headers for handling the bboxes is in the postgis folder. But I don't tkink this way of doing it seems to be that much heavier.
Something interesting to note is that I tried this polygon on an old Arcview 3.2 installation and that is fast, very, very fast.
I don't understand how they did it and I doubt that arcgis of today can compare. But I had one test where I had a different result in Arcview and I think I could prove that postgis was right and Arcview wrong, so maybe they are taking som shortcircuit to much.
to try in arcview 3.x just run an avenue-script like:
Script.The.SetNumberFormat( "d.ddddd" )
vyn = av.finddoc("view1")
temat = vyn.findtheme("example.shp")
ftabben = temat.getftab
shpfld = ftabben.findfield("shape")
thedist = ftabben.returnvalue(shpfld,0).distance(ftabben.returnvalue(shpfld,1))
msgbox.info(thedist.asstring,"")
Greetings
Nicklas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20090717/98dfe1f0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.zip
Type: application/x-zip-compressed
Size: 387937 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20090717/98dfe1f0/attachment.bin>
More information about the postgis-devel
mailing list