I'm currently creating Elgg instance which will start with around 300k groups. I'd like to view all those groups within a map (leafletjs, but that isn't relevant). Loading 300k of groups in a single AJAX request (on a mobile device) is a lot, so I'd like to only return the visible groups on the map's square.
After some searching I came across this question, which seems to be really straightforward. Except, I'm currently stuck on implementing this into Elgg. This because Elgg uses multiple tables for metadata.
Do you guys have any idea how this could be implemented and how to start? I've added a `X` and `Y` metadata to some (not all, those without doesn't need to appear on the map) ElggGroup objects.
I'm currently trying multiple ways, but none of them really seems to work with the current structure (multiple joins) of the database.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- Wouter van Os@Wouter0100
Wouter van Os - 0 likes
- nikos@nlyberakis
nikos - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
You must log in to post replies.This is just a shot in the dark, but something like this might work:
Hmm, does coordinates work like that? Thanks, let me give it a try. If that works, I was just thinking to complicated.
Have a look at this plugin https://github.com/hypeJunction/hypeGeo
I have used functions from it for building similar functionality which you ask.
Juho's suggestion won't work with geocoordinates. The earth is a sphere and coordinates span north and east.
I am quite sure I have written a query for getting entities within a bounding box before, but I can't find it now.
These might help, you can use a radial search from map center. Take the distance from center to any of the corners and you will get your bounding box plus some adjacent items.
https://github.com/hypeJunction/hypeGeo/blob/master/lib/functions.php
https://github.com/hypeJunction/hypeMaps/blob/master/classes/hypeJunction/Maps/ElggMapQuery.php