97 Posts
Anjo
11 years ago
Topic

I am wondering if the following can be done by creating a plugin.

I am setting up a directory that lists schools, care centres, hospitals etc. and I need to create a search box that sorts entries according to their distance to a given location but it also needs to work with other Seblod search criteria. see image for an example:

http://asdaily.co.uk/postcode_search.png

My theory is that this could be done using Google maps store locator but I don’t how this would work with other Seblod search fields.

https://developers.google.com/maps/articles/phpsqlsearch_v3

My question is, if every entry in my directory also includes Latitude/Longitude coordinates in database, is it possible to create a plugin that shows a search box field on the frontend and

1.  Takes the postcode/location and distance that the visitor types in

2.  Connects with Google maps API to get Lat/Long coordinates of visitor’s input

3.  Connects with my database and searches through entries

4.  Outputs entries starting with the closest?

Thanks

Anjo


Get a Book for SEBLOD
11 years ago
0
Level 1

Hi Anjo,

For now Seblod does not perform a search based on the distance between GPS coordinates.

To perform such a search, you must store in database the coordinates as in Geometry format. Then it is necessary to use a function in the query on the database, but it is not yet available in SEBLOD. The modification must be done in the core of Seblod and is not anticipated in the immediate future.

The only way around the problem is to make a first request by Seblod based on traditional fields. Then, modify the template used for rendering to perform a second request with the proper function and limited on the results of the first query.

We lose time, but it works.

Regards.

Lionel

97 Posts
Anjo
11 years ago
0
Level 1

Hi Lionel,

Thank you for your explanation. It has helped me understand how big of a job it is implementing such functionality. Maybe in the future, who knows.

Regards

Anjo

Get a Book for SEBLOD