Tag Info

New answers tagged

2

You first need to understand the different ways to create geometries and the geometrical relations in GeoDjango (GeoDjango: GEOS API), without a database: 1) create valid geometries: # with Point, Polygon objects of GeoDjango from django.contrib.gis.geos import Point, Polygon, poly = Polygon(((0.0, 0.0), (0.0, 50.0), (50.0, 50.0), (50.0, 0.0), (0.0, ...


1

I wrote this for python and return a qgisPoint: def nearestPoint(A, B, p): A0 = A[0] A1 = A[1] B0 = B[0] B1 = B[1] p0 = p[0] p1 = p[1] AB0 = B0-A0 AB1 = B1-A1 AB_squared = (AB0*AB0+AB1*AB1)+0.0 if (AB_squared == 0): return A else: Ap0 = p0-A0 Ap1 = p1-A1 t = ...


1

I thought I'd answer this myself just in case anyone else with a similar problem ever stumbles on this. Using the above advice on converting my Cartesian coordinates to polar coordinates, I've made a function which calculates a minimum enclosing circle around the x,y coordinates, and divides this circle into a user-defined number of 'grid' cells with equal ...


0

See my example and answer ### Preparing the SpatialPointsDataFrame spdf <- matrix(as.numeric(NA), nlevels(Poly$MatchID), 1) spdf <- as.list(spdf) ### Sample the coordinate, match it with data in spdf. It create a list fore each factor of the MatchID ### sample(spsample()) fix the size of the sample for (i in seq(Poly$MatchID)) spdf[i] <- ...


2

After a lot of attempts I have this solution, probably not so clean. Comments, improvements or other way to answer are much welcome! ### Preparing the SpatialPointsDataFrame spdf <- matrix(as.numeric(NA), nlevels(Poly$MatchID), 1) spdf <- as.list(spdf) ### Sample the coordinate, match it with data in spdf. It creates a list fore each factor of the ...


1

To me, the simplest approach is to probably convert your XY datapoints to the polar coordinate system that defines your circular 'arena'. Be sure to convert your XY coordinates such that the center of your circle is the origin of your Cartesian grid before converting to polar coordinates. Almost all math texts would provide these straightforward conversion ...


1

Not a plugin, but a nice solution using Spatialite and triggers. If you put both your polygons and points layers into a Spatialite DB, then you can add a trigger to the polygon table to update the "point_count" column on each update of the polygons. Here's the trigger statement (I called the polygon layer "areas" and the point count column "cnt_pts"): ...



Top 50 recent answers are included