I'm not sure if this is the right forum or should I write to Epi7 forum so I apoligize in advance if I'm writing to wrong forum.
My problem is that I'm storing Store pages types in Epi7. Stores have geo coordinate among other properties and I need to be able to search nearest stores based on user's current location. I thought that this is easiest to do by using Epi Find's GeoLocation type, since I'm using Find for other searches also.
The problem is, how do I store GeoLocation to Epi's database. GeoLocation isn't property type so I can't just write [Display]public virtual GeoLocation ... into my Store page type class. So how should I store locations?
Thanks in advance,Marko
The simplest solution is probably to create three code properties, two doubles for longitude and latitude and one of type GeoLocation. Annotate the third one with [Ignore] so the CMS won't try to create an editorial property of it. Then in it's getter return a GeoLocation based on the first two.
Then there is also a number of fancy ways of course, like creating custom properties etc, but the above is simple and requires only a few lines of code.
Thank you for your reply. I'll try that.
If you have more advanced operations you need to do on geolocation I would also recommend checking out the SQL features for newer versions of SQL server (SQL 2008 R2 and above if I remember correctly) that can do these kind of things really fast. The functionality is called geography and geometry depending if you want to do calculations on a curved surface or not. Ideal for filtering out x number of items that are located within a polygon / circle and similar...
Daniel, for the record, Find has that as well :)
I've just started playing around with Find myself and noticed the support for geolocation. Nice work there!Thx for PTB btw. I'm normally pretty sceptic of using 3rd party addons but it's almost impossible to code pretty without it in old projects. It was definitely time for EPiServer to switch to a similar solution in EPi 7. Can't live without strongly typed page types really... :)