Here's the pitch I have a collection of chakras, which are mainly two attributes: location
one The point is and the distance in the radius
meters.
Users also have the profile. Location
point attribute
In my publications, I want to find all those circles that are user "in", so they are sufficiently close to each and every section of the Circle radius
For, here's how it will be:
Meteor.publish ('circles', function) {var curUser = Meteor.users.findOne ({_ id: this.userId}) ; If (curUser) {return circles.find ({location: {$ pass: {$ geometry: curUser.profile.location, $ maxDistance: self.radius} //HERE}}))); } This.ready (); }); Except for
self.radius
is a completely created word from my side. But is it possible to achieve something like this?
Post-solaling editing:
Thanks to the electric Jesus , I have my match with a completely polygon Works, since the division is not yet geo-zodiac type (therefore they are not single properties which can be queried), so I changed my solution into polygons! To do this, there is a javascript function:
generated function GOJSONArcal (center, radius, number) {var number = []; Win Earth Radius = 6371; Var inferiority = numSides / 2; // Coverage angular distance on the surface of the earth var d = parseFloat (radius / 1000.) / earth radius; Var lat = (center.coordinates [1] * Math.PI) / 180; Var Lone = (center coordinates [0] * math. PI) / 180; (Var i = 0; i & lt; numSides; i ++) for {var gpos = {}; Var bearing = i * monastery PI / Half Side; // Red GPo.Latituude = Math.Sine (Mathematics (Lat.) * Mathematics (D) + Mathematics (lat) * Mathematics. (D) * Mathematics (bearing)); Gpos.longitude = ((lon + Math.atan2 (Math.sin (effect) * Math.sin (d) * Math.cos (lat), Math.cos (d) - Math. Sin (lat) * Math.sin (Gpos.latitude))) * 180) / Math.PI; Gpos.latitude = (gpos.latitude * 180) / Math.PI; Points. Push ([gpos.longitude, gpos.latitude]); }; Points.push (number [0]); Return {type: 'polygon', coordinates: [digits]}; }
Here you go I do not really know how many sides I should use, so I left the argument for it too. From there, you can use the answer to Electric Jesus to go where you were going, do not forget to put 2dsphere indicator on your polygon!
Circle _Concer Index ({'Polygon Conversion': "2dsphere"}); No, the indexed Geo will not work in a way that you demand a. Dynamic according to the 'radius' of the document. You can convert your circle into the globe and by using the $ geoIntersects query, you can find out which circle (polygon geometry) with your current location / location parameter (point geometry) Intersects. var location = {longitude: -1.85549, latitude: 52.9445} // create a circle with a polygon geometry, in which the converted settings circle. Intertr ({name: "My Circle 1", People: {type: "polygon", coordinates: [[[.. ..]]]],}}); // Find one or more circles with the current location Circle Address ({loc: {$ geoIntersects: {$ geometry: {type: "point" coordinates: [location.longitude, location.latitude]}}}});
Comments
Post a Comment