It should return whatever the units are in the coordinate system you have
set. You will probably want to transform the geometry to UTM first.
Something that treats the geometry as flat and sets distance to be in
meters or similar. srid=3857 or 900913 will do this nicely (caveat
emptor).
-- Jeff
Yes Jeff, this is what I want to do. I wasn't sure if there was an easier
way. What units does the distance function return? I tried this and it
seems to return the distance in units of 10km, is this correct?
Thanks again!
On Tue, Jan 31, 2012 at 9:04 PM, Jeff Heard wrote:
> Got it. So what you
Got it. So what you want to do is a list comprehension over the geometry
object, which *should* give you individual geometries is what it sounds
like. Then you can calculate distance() from each of these. Something
like this?
interesting_point = Point(x, y)
collection = result.geom
min_dist = m
Here's a more concrete example, say I am storing shapes of all
countries. Now, the US can't be stored in one polygon (we have hawaii and
alaska), therefore I have to store the many polygons in one
geometrycollection.
Now, say I have another point on the map, I would like to know how ar it is
from
Perhaps I didn't explain it well, Jeff. I am just trying to get the
smallest distance from one point to any of the points, lines, or polygons
inside of a queryset. The data I am receiving from the queryset is a
geometrycollection already... That is how it is being stored in the
database.
On Tue, J
You should be able to create a geometrycollection object from a queryset (you
may have to use a list comprehension for this), then calculate the centroid and
take the distance from that. Taking the distance from the edge should only be a
little more
Complicated. Check the django GEOS API docs F
I have a model that currently stores a Geographic Point (Using Django
GIS (GeoDjango)) and another model that has a field to store a
geometry collection (A collection of polygons, lines, and or points).
I am trying to find the distance from the point to any one of the
shapes in the geometry collec
7 matches
Mail list logo