[postgis-devel] Distance2D Review

Nicklas Avén nicklas.aven at jordogskog.no
Wed Nov 11 16:27:56 PST 2009


Hallo I'm struggling a little with this distance thing and hope for some help. 1) I have been looking a little on deserializing early and working with LWGEOM as you suggested Paul. It would be wonderful, and it would probably be much cleaner code and easier to work with the logic. But I have two questions about it, is there a function for creating bbox after deserializing or what is the best way of doing that? next question is about the number of subgeometries. As it works now the number om subgeometries is presented in lwgeom_inspected, but I see no function inspecting a LWGEOM or something corresponding.  I just committed a change from void functions to integer as Paul suggested. I think a now have it "carrying" any false-value all the way up and out. My question is what to to do with the double-functions that are supposed to return the distance. If they got a false answer from the underlying functions I now just throw an error that something is wrong. Then the compiler va!
 rned that I didn't return values in all situations from a function that should return values so I put a "return 0.0;" after the error. I guess it doesn't matter since the error stops the process, but it cannot be the right way to do it. It looks dangorous that 0.0 is ready to take of as an answer at onceafter the error-message. If this gets more and more confusing it's because I should have gone sleeping some hours ago. I will continue looking at all this but I might not get time before next week. I also did some small tests to see how it competes to the old calculation on very small geometries.My test was 1 dataset of 300 000 two-vertex lines spread all over Norway. Then i ran a distance-calculation between all those lines and first another tvo-vertexline and then a three-vertexline and then a four and then ten vertexes. What I found was that the old brutal force was about 20% faster when measuring between 2-vertex lineswhen measuring between 2-vertex lines and a 3 vertex !
 line they were about the same speed. Then the new calculation was faster and 2 vertex-line to 10 vertexline was about 3 times faster with the new algoritm. The question is:Is the usage of 2-vertex lines aginst 2 vertex lines so common so we should try take those situations the old way? This have to be investigated better too I think.  Now it's time for sleep. /Nicklas    
2009-11-10 nicklas.aven at jordogskog.no wrote:

>
Great Paul>
thanks>
 >