Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

GeoLocation and page types

Vote:
 

Hello,

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

#64877
Jan 14, 2013 14:37
Vote:
 

Hi 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.

#64894
Jan 14, 2013 22:19
Vote:
 

Hi,

Thank you for your reply. I'll try that.

-Marko

#64896
Jan 15, 2013 7:26
Vote:
 

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...

#64926
Jan 16, 2013 10:22
Vote:
 

Daniel, for the record, Find has that as well :)


More info.

#64927
Jan 16, 2013 11:19
Vote:
 

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... :)

#66166
Feb 21, 2013 15:56
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.