Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matt 8 posts 78 karma points
    Jul 24, 2016 @ 18:29
    Matt
    0

    Store Locator in Umbraco 7+

    I'm trying to create a store locator and having trouble finding information that supports Umbraco 7. All the packages I've found through Google and this site appear to be outdated and do not work with Umbraco 7.

    I need to be able to provide a location (I will already have Lat/Long or can Geocode a string from the server, eg: "123 Main St., City, State") and fetch my Umbraco content that falls within a specific radius of this location. I will have the address as fields within the Content Type.

    Can anyone help point me in the right direction or let me know how to set this up? Thanks in advance for your help!

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 25, 2016 @ 08:51
    Dennis Aaen
    0

    Hi Matt and welcome to our.

    Perhaps you could use the angular google maps package to do what you are trying to do https://our.umbraco.org/projects/backoffice-extensions/angulargooglemaps/

    Hope this can help you a step further.

    /Dennis

  • Matt 8 posts 78 karma points
    Jul 25, 2016 @ 14:50
    Matt
    0

    Hi Dennis,

    I did see the Google Maps package supported Umbraco 7. That would allow me to geocode and have a latitude and longitude for each store. However, I am still unsure how to search for these within a specific distance.

    For example, let's say I have Document Type Store, which has a latitude and longitude stored on the node. A user enters a location which I can geocode and get a latitude and longitude for that as well.

    How do I query for all Stores that are within a 25 mile radius of the user's input location?

    Thanks again!

  • Matt 8 posts 78 karma points
    Aug 02, 2016 @ 04:33
    Matt
    0

    Bump - Any help here? I'm new to Umbraco and not sure where to start. Can anyone at least point me in the right direction of how to search for nodes of a Content Type within a given radius? This is a common task in any CMS, but not sure how to go about it with Umbraco.

  • Streety 358 posts 568 karma points
    Nov 01, 2016 @ 09:46
    Streety
    0

    Hi Matt,

    I have not used this control before, but the process of "getting the data" really is the easy bit.

    If you have set some doctypes and created content based on those types (say that are geo nodes).

    So you are trying to calculate the distance between a given point (say a postcode) and fixed position geonodes .

    One way is to convert the long lats to miles. Something like this:

           public static double distance(double A1, double A2, double B1, double B2)
        {
    
            DbGeography point1 = ConvertLatLonToDbGeography(A1, A2);
            DbGeography point2 = ConvertLatLonToDbGeography(B1, B2);
            var distanceInMiles = point1.Distance(point2) * 0.000621371;
            return Math.Round(Convert.ToDouble(distanceInMiles), 1, MidpointRounding.AwayFromZero);
        }
    

    If you applied this method against all your geonodes you can build a collection of geonodes with a distance value from your fixed point.

    I would then be a question of querying the nodes and applying a parameter (distance from fixed point).

    Package the results in JSON and apply to a mapping provider like google to show the positions on a map.

    I hope it gets you going.

Please Sign in or register to post replies

Write your reply to:

Draft