 Σε εύκολα. Ευχαριστώ. Σήμερα θα μιλήσουμε πώς να λειτουργήσουμε σπασικές τραγέντρες στος Βουστ-γεωμετρο. Αυτό είναι ναι για εμένα, το πρώτο μέρος. Λοιπόν, πριν έχω κάποιες στιγμές στις τι είναι η Βουστ-γεωμετρο. Λοιπόν, αν κλείσεις τρεις τόξες αυτοί, πιστεύεις πιο αυτοί. Λοιπόν, είναι ένα Βουστ-γεωμετρο. Είναι όλοι φορά. Είναι εξερφή στην όλη η Βουστ-γεωμετρο. Επίσης, μπορείς να χρησιμοποιήσεις κάποιες φτύχους από τα νέα. Και, ναι, προβάζει πριμιτικές αυτοί και σπασικές τραγέντρες, που θα χρησιμοποιήσω σήμερα να χρησιμοποιήσει σπασικές τραγέντρες. Και, ναι, προσπαθεί να φύγει το OGC και σφασικές τραγέντρες. Λοιπόν, αυτά είναι κάποιες χρησιμοποιήσεις για τη δημιουργία, τη δημιουργία και τη δημιουργία, που είναι στο GitHub. Και, ναι, αυτή είναι για οι δημιουργίες, οπότε τρεις από αυτές είναι σε αυτή η δημιουργία. Υπάρχουν δοσέντρες από άλλες δημιουργίες. Τα τρία χρόνια είχαμε also participated in the Google Summer of Code, οπότε we usually open some interships for the summer. Yes, that's the credits about the development. Okay, this is boost geometry from the MySQL perspective. So, it's used by MySQL to provide GIS support. So, this is good for MySQL, because there are no home group GIS functions there. Τα δυο πρόγραμματα βρίσκονται στην OGC Στάνταρτ, έχουν συμβουλίσεις, και επίσης, οι μάσκουελούς μάσκουελούς από την κοινωνική κοινωνική κοινωνία. Και επίσης, στις C++ και HED, δεν υπάρχουν πρόβλημα με συμβουλίες και όλα αυτά τα τεχνικά κοινωνία σε μάσκουελ. Okay, so this is the same slide as all the previous years I'm presenting here about Boost Geometry. So it's a Hello World thing, how to compute a distance from my home place to ULB. So actually it's just a set of header files and then you use the Boost Geometry namespace. You define one point in two dimensions with double arithmetic and you use the geographic coordinate system in degrees so you can create those two points with longitude latitude coordinates and okay Boost Geometry will compute this distance for U. This is more accurate than the one that you get from Google Maps, so it's geographic computation. And you can also do a bit more advanced things, you can define a strategy which gives you more accuracy and plug it into the distance algorithm, then you get a bit more accurate results. This is only a few meters difference in that particular situation. And this is the whole idea about the algorithms in Boost Geometry. It's a coordinate independent part which is the combinatorial algorithm. It's also a coordinate specific part which we call it strategies. Okay, so again so let me just briefly say that the three coordinate systems that we support. So we have the Cartesian one and then there is the spherical equatorial. This is the one that Google Maps is using so you can parameterize it either by degrees or radians. And then we have the geographic one which is most precise but also slower to do computations. So in the whole talk I'm using the last one, the geographic one with all the defaults just to have a simpler code examples. You'll see, so I'm trying to have simple examples. Yes, you'll give me feedback on this if they are not. But you can use all of them and also you can use, especially with a geographic one, you can use more detailed strategies. So you can change the geographic algorithm that you use and you can have various different results and also performances. Okay, so yes, this is not used. Okay, so special trajectories that we're talking today. It's a sequence of timestamped locations that can generate it by many devices, GPS and smartphones and also computer games or natural phenomena. So for example, these are the trajectories of major hurricanes in the Atlantic. So in this talk, I will give examples with trajectories that I do not consider the temporal information. So as far as I understand, the next talk has some temporal computations and so trajectories can be easily modeled as a line string. So it's just a set of sequence of points with a longitudinal latitude. Okay, this is the data set that I will use. It's a Geolife GPS trajectories data set. It's open, you can download it. There is also a user guide. It's a set of trajectories produced by walking, bicycles, cars. Yes, this is more or less. Okay, you can see the user guide, the details. Most of them are in by-jink. So this is the hit map of the data set in by-jink and zoomed. So okay, I'm just selecting to start. I'm just selecting two trajectories from the whole data set to do some simple computations. Okay, so and this is how my C++ code look like. So I'm defining the point again, which is geographic. I create two line strings. I load my two trajectories on the line strings and then I can ask what is the size. The size means how many points you have in the trajectory. So you can see the first trajectory has 317 points. The second one has 75 and then I can ask what is the length. This is in meters, so I can take the two lengths of the trajectories and then I can also ask what is the distance between those trajectories. So this is the shortest distance from one trajectory to the other. This again in meters and I get this result. Okay, so if I use strategies here to make it more advanced, since all of these are very short, I mean it's less than 2 km, the whole distance, I will not see any difference. So I can just use the default algorithms. Okay, so I can also compute the closest points between the two trajectories. So I'm one trajectory and the other trajectory, what are the two points that are closest between those two. Actually, this will give me the shortest distance, but the computation is a bit different. So I can call this closest point algorithm. This is not in boost geometry. It will be a pull request on this, so you cannot use it right now. And you get this blue segment, which gives you the two shortest points there. Again, the computation here is geographic, but what I plot is just a 2D. So I don't even do a projection, just plotting them. So the projection, you can have a slightly different result, but this is just to see how those trajectories and the computations look like. Okay, so then I can do some more advanced computations, not only lengths and distances, so I can simplify my trajectory. So in boost geometry there is a simplification algorithm that is using this Douglas-Poker algorithm. It's quadratic in a worst case, but in practice you probably experience something like n log n. And there is also a line interpolate algorithm that given a measure, it interpolates points on your line string. So if you give a short distance, then you will get more points than the line string has. So the line string will be densified. So if you give a larger distance, then you can get less points than your trajectory. You can represent your trajectory with less points. And the last one, it was a Google Summer of Code project. It's in pull request, still. You can also sample points from the line string. As far as I remember, only with uniform distribution right now, this can be extended. So you can ask, ok, I want 1,000 points uniform distributed on my trajectory. So we'll get all those points. Ok, again some code. So again I load my trajectory and then I compute how many points I have. So this trajectory has 75 points. This is the length. And then I can call the simplify algorithm with 20 here. So 20 means the new line string that approximates my original one. I want to have error 20 meters at most. So this is the 20 there. And then I can call the line interpolate algorithm with my trajectory and 70. So this is every 70 meters I create one point. So I start in my trajectory and I move on the trajectory and every 70 meters I create one point. Ok, so I didn't put the random one. So the random will create random points on the line string. Ok, and with those parameters, the simplified trajectory has only 6 points and the interpolation creates 9 points. So you can easily see this. In the interpolation case you can easily see it by division. It's expected. Ok, and this is how this looked like. The red one is the original trajectory. These are my interpolated points. And the green one is the simplified trajectory. So yes, I can use either the points or the simplified trajectory to do computations because it's smaller, shorter. Ok, and then this is the last computation I'm doing with trajectory. This is measuring the similarity. So there are many measures in the literature. So maybe the most well-known or used in practice as far as I understand is the Hausdorff distance and the Freset distance. Ok, I'm talking about this because these are the ones that are implemented with this geometry. So the Hausdorff, let's say that is a more cruel measure, I take the maximum or the minimums of all the possible distances. So here in the example, the Hausdorff is that distance. So it's a different measure, the Freset distance because it counts also the sequence. So Hausdorff is like taking a set of points. Don't care about the sequence. But in Freset you also care about the sequence. So you create a coupling between the points of your sequence. It's like if you have probably, maybe you have heard about the problem of walking your dog. So the one guy that, there is one person that is walking one trajectory and the dog is in the other trajectory and you want to see what is the minimum least that you can use to walk your dog. So actually this is the Freset distance. But you can see this example that the Freset distance gives you more information about the similarity because these are two, very similar curves, line strings. Hausdorff distance will be small but the Freset distance is large. So Freset somehow describes better the similarity. And there are more. But I will talk about those two here. So I have three trajectories now to do a simple example. Okay, the one is much larger so that's why the other two are a bit scaled down. And I will compute the Hausdorff distance between all the possible pairs. So the first line string, okay, it's like this. So the first is the red, the second is the green and the third is the blue. And when I compute Hausdorff and Freset in those case give me the same result. So it tells me that the smaller it is the more similar are the trajectories. So it tells me that the first two are more similar and then the green it's more similar to blue than the red to blue. So those two, the small ones, are more similar and then the green maybe because of the shape is more similar to this than the red okay, this is the information that I am getting. Okay, and this is the last the last example I okay, this data set is huge you can do many computations but I only do as a proof of concept a few of them. So here I took one trajectory from one data set and I compare it against 160 trajectories and the interesting part I found here is that I can use either Cartesian or spherical or geographic coordinate systems. So in this piece of code you just go in the third line and you change geographic to either Cartesian or spherical equatorial and you do the computation. So with Cartesian this means that we'll take the longitude latitude and consider it as a xy. So does not care about any spherical information. So in spherical it takes the longitude latitude as they are on the sphere and it's geographic it will use it on the spheroid. So I perform this computation to compute the minimum the minimum frazier distance which means given one trajectory I'm trying to find in a set of 160 trajectories what is the most similar one and you can see here the difference in performance so Cartesian is about more than 5 times faster and with all of them I'm getting the same result. So from the whole data set these are the two more similar. So yes you can understand that the data set has a totally dissimilar trajectory so most of them you cannot even draw them. So yes using also Cartesian computations which is total symbol you can get the same result as in geographic. So yes I guess if you have if you exploit the whole data set and find much more similar trajectories then Cartesian can give you a different a different result than geographic. So you can take advantage of geographic computation but even for filtering out a lot of dissimilar trajectories you can do it just with Cartesian. So yes this is this was thanks.