Example #1
0
        //--------------------------------------------------------------------------
        //
        //	Methods
        //
        //--------------------------------------------------------------------------

        #region GetParameters

        /// <summary>
        /// format the properties for the querystring
        /// </summary>
        /// <returns></returns>
        public override Dictionary <string, string> GetParameters()
        {
            var ps = new Dictionary <string, string>();

            // apply all of the options to a single hash
            if (GeneralOptions != null)
            {
                ps = ps.MergeLeft(GeneralOptions.GetParameters());
            }
            if (LocaleOptions != null)
            {
                ps = ps.MergeLeft(LocaleOptions.GetParameters());
            }
            if (LocationOptions != null)
            {
                ps = ps.MergeLeft(LocationOptions.GetParameters());
            }

            return(ps);
        }
Example #2
0
        public GeoJson.PointLayer GetPointLayerByBounds(double neLat, double neLng, double swLat, double swLng, int page = 1, string[] ds = null, string[] tags = null)
        {
            //Consumer Key:	kVvCwX0ocRhDHbA9LfdLrQ
            //Consumer Secret:	RCJdVyZ5R3pVoc3hzyXIy-0ILQ0
            //Token:	ZgOH_PB5SkKIOIIeI3_9vYRE5ZNTZiIn
            //Token Secret:	rSn8bgTH44an2XYJTgqQQqcDubs

            PointLayer layer = new PointLayer(this.DataSource);

            var options = new Options()
            {
                AccessToken = "ZgOH_PB5SkKIOIIeI3_9vYRE5ZNTZiIn",
                AccessTokenSecret = "rSn8bgTH44an2XYJTgqQQqcDubs",
                ConsumerKey = "kVvCwX0ocRhDHbA9LfdLrQ",
                ConsumerSecret = "RCJdVyZ5R3pVoc3hzyXIy-0ILQ0"
            };

            Yelp yelp = new Yelp(options);

            SearchOptions searchOptions = new SearchOptions()
            {
                LocationOptions = new BoundOptions()
                {
                    sw_latitude = swLat,
                    sw_longitude = swLng,
                    ne_latitude = neLat,
                    ne_longitude = neLng
                }
            };

            //VectorLocation vLocation = Util.VectorLocationFromBounds(neLat, neLng, swLat, swLng);

            //LocationOptions location = new LocationOptions();
            //CoordinateOptions coords = new CoordinateOptions();
            //coords.latitude = vLocation.Latitude;
            //coords.longitude = vLocation.Longitude;
            //location.coordinates = coords;
            //// location.location = coords;

            //searchOptions.LocationOptions = location;

            GeneralOptions generalOptions = new GeneralOptions();
            //generalOptions.radius_filter = vLocation.Radius;
            generalOptions.limit = pageSize;

            if(page > 1)
            {
                generalOptions.offset = (page - 1) * pageSize;
            }

            searchOptions.GeneralOptions = generalOptions;

            SearchResults results = yelp.Search(searchOptions).Result;

            layer.TotalResults = results.total;
            layer.Page = page;
            layer.PageCount = layer.TotalResults % pageSize;
            layer.Points = PointsFromBusinessList(results.businesses);
            layer.PageSize = pageSize;

            return layer;
        }