Tuesday, January 31, 2012

Re: GIS Distance from Point to Geometry Collection

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 ANY of the polygons...

On Tue, Jan 31, 2012 at 8:41 PM, Alex Kopp <loaferdtd@gmail.com> wrote:
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, Jan 31, 2012 at 8:36 PM, Jeff Heard <jefferson.r.heard@gmail.com> wrote:
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 For complete details



On Jan 31, 2012, at 6:36 PM, Loafer <loaferdtd@gmail.com> wrote:

> 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 collection. Apparently the distance function
> only works on single shapes, not a collection. Are there any
> workarounds to this?
>
> Any help is appreciated.
>
> Thanks.
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment