Spacial search in Umbraco 13? Has anyone done it?
# help-with-umbraco
s
Basically I have a v8 site which uses it to calculate distances from a set of lat/lng values to a location and display all the locations closes to that user i.e. within say 50 miles. Client is now moving to Umbraco 13 so I need to rewrite it to work - any examples anywhere or gotchas I need to be aware of? Not started coding it yet, just identifying areas in the site that may need 'special attention' ;-)
s
I presume you are using - some kind of controller (surface/api) as an entry point - a quick way to get the partial info from the cms, examine?? - an algorithm or external service to calculate the distance based on the information you retrieved If so, then nothing has changed from v8 to v13 expect maybe the registration of these classes into the DI container. You might have to update some package dependencies as we moved to .net core in v9 but beyond that I do not see any major changes that could interfere with whatever solution you came up with in v8
s
Yup pretty much thats it - it was more a question around the spacial calcs but i'm sure it will be a reasonable straightforward port :)
s
Our.Umbraco.Gmaps is great. You may need this if you have a map and location picker in the back office.
I would expect your calcs to be a copy paste - core maths stuff is pretty much unchanged. It's more about the request and response objects that tend to cause me issues - ready url parameters etc. But usually "what is the .net core equivalent of ..." gives me the answer eventually.
s
Thanks Steve - we already have the lat/lng as umbraco data as it's imported from an external api. In theory it should all just work when ported across, I just heard a while back of a couple of people not being able to get it to work but I can't find the posts now
m
Depending on what you need, if it's just as the crow flies you can always just calculate front end.. (we tend to use haversine in js) but their are other methods https://henry-rossiter.medium.com/calculating-distance-between-geographic-coordinates-with-javascript-5f3097b61898 If it's just show a set distance from a point on a google map to reveal markers, then you can also just cheat and draw a circle from the current location with radius x and then fit the map to the bounds of that circle 🙂 (obv depends on the use case 1000s or 10000s locations to check and prob not for the front end)
2 Views