HARRY POTTRER kirjoitti:
> I have a model which represents a route. I can use the `make_line()`
> geoqueryset method to create a LineString like so:
> 
>>>> r = Route.objects.get(pk=33)
>>>> # a route from Seattle to New York to Miami, a total distance
>>>> # of about 3043.8 nautical miles
>>>> r
> <Route: KSEA-KLGA-KMIA>
>>>> # a collection of the airports used in the route
>>>> # turned into a LineString
>>>> ls = Airport.objects.filter(routebase__route=r).make_line()
>>>> ls
> <LineString object at 0x2cd42e0>
> 
> How can I find the total distance of that LineString object, so that
> it returns a Distance object that I can then convert to nautical
> miles? the .length() method here just returns a float, which is in who-
> knows-what units...

It's exactly in the units that are specified in your SRS definition. To 
go beyond that you can use Distance to make math and conversions to 
another units..

Note that "length" gives linear distance, not spherical so in long 
distances you get a distorted length.

-- 
Jani Tiainen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to