コード例 #1
0
    private OnlineMapsFindPlaces(OnlineMapsFindPlacesType reqType, string key, Vector2 latlng = default(Vector2), int radius = -1, string keyword = null, string name = null, string types = null, string query = null, string language = null, int minprice = -1, int maxprice = -1, bool opennow = false, OnlineMapsFindPlacesRankBy rankBy = OnlineMapsFindPlacesRankBy.prominence)
    {
        _status = OnlineMapsQueryStatus.downloading;

        string typePath = string.Empty;

        if (reqType == OnlineMapsFindPlacesType.nearby) typePath = "nearbysearch";
        else if (reqType == OnlineMapsFindPlacesType.text) typePath = "textsearch";
        else if (reqType == OnlineMapsFindPlacesType.radar) typePath = "radarsearch";

        string url = "https://maps.googleapis.com/maps/api/place/{0}/xml?sensor=false";
        url = string.Format(url, typePath);

        if (latlng != default(Vector2)) url += string.Format("&location={0},{1}", latlng.y, latlng.x);
        if (radius != -1) url += "&radius=" + radius;
        if (!string.IsNullOrEmpty(key)) url += "&key=" + key;
        if (!string.IsNullOrEmpty(keyword)) url += "&keyword=" + keyword;
        if (!string.IsNullOrEmpty(name)) url += "&name=" + name;
        if (!string.IsNullOrEmpty(types)) url += "&types=" + types;
        if (!string.IsNullOrEmpty(query)) url += "&query=" + query.Replace(" ", "+");
        if (!string.IsNullOrEmpty(language)) url += "&language=" + language;
        if (minprice != -1) url += "&minprice=" + minprice;
        if (maxprice != -1) url += "&maxprice=" + maxprice;
        if (opennow) url += "&opennow";
        if (rankBy == OnlineMapsFindPlacesRankBy.distance) url += "&rankby=distance";

        www = OnlineMapsUtils.GetWWW(url);
    }
コード例 #2
0
    /// <summary>
    /// A Nearby Search lets you search for places within a specified area. \n
    /// You can refine your search request by supplying keywords or specifying the type of place you are searching for.
    /// </summary>
    /// <param name="lnglat">The longitude/latitude around which to retrieve place information. </param>
    /// <param name="radius">
    /// Defines the distance (in meters) within which to return place results. \n
    /// The maximum allowed radius is 50 000 meters.
    /// </param>
    /// <param name="key">
    /// Your application's API key. \n
    /// This key identifies your application for purposes of quota management and so that places added from your application are made immediately available to your app. \n
    /// Visit the Google APIs Console to create an API Project and obtain your key.
    /// </param>
    /// <param name="keyword">A term to be matched against all content that Google has indexed for this place, including but not limited to name, type, and address, as well as customer reviews and other third-party content.</param>
    /// <param name="name">
    /// One or more terms to be matched against the names of places, separated with a space character. \n
    /// Results will be restricted to those containing the passed name values. \n
    /// Note that a place may have additional names associated with it, beyond its listed name. \n
    /// The API will try to match the passed name value against all of these names. \n
    /// As a result, places may be returned in the results whose listed names do not match the search term, but whose associated names do.
    /// </param>
    /// <param name="types">
    /// Restricts the results to places matching at least one of the specified types. \n
    /// Types should be separated with a pipe symbol (type1|type2|etc).\n
    /// See the list of supported types:\n
    /// https://developers.google.com/places/documentation/supported_types
    /// </param>
    /// <param name="minprice">
    /// Restricts results to only those places within the specified range. \n
    /// Valid values range between 0 (most affordable) to 4 (most expensive), inclusive. \n
    /// The exact amount indicated by a specific value will vary from region to region.
    /// </param>
    /// <param name="maxprice">
    /// Restricts results to only those places within the specified range. \n
    /// Valid values range between 0 (most affordable) to 4 (most expensive), inclusive. \n
    /// The exact amount indicated by a specific value will vary from region to region.
    /// </param>
    /// <param name="opennow">
    /// Returns only those places that are open for business at the time the query is sent. \n
    /// Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query.
    /// </param>
    /// <param name="rankBy">Specifies the order in which results are listed.</param>
    /// <returns>Query instance to the Google API.</returns>
    public static OnlineMapsGooglePlaces FindNearby(Vector2 lnglat, int radius, string key, string keyword = null, string name = null, string types = null, int minprice = -1, int maxprice = -1, bool opennow = false, OnlineMapsFindPlacesRankBy rankBy = OnlineMapsFindPlacesRankBy.prominence)
    {
        NearbyParams p = new NearbyParams(lnglat, radius)
        {
            keyword = keyword,
            name    = name,
            types   = types,
        };

        if (minprice != -1)
        {
            p.minprice = minprice;
        }
        if (maxprice != -1)
        {
            p.maxprice = maxprice;
        }
        if (opennow)
        {
            p.opennow = true;
        }
        if (rankBy != OnlineMapsFindPlacesRankBy.prominence)
        {
            p.rankBy = rankBy;
        }

        return(new OnlineMapsGooglePlaces(key, p));
    }
コード例 #3
0
 /// <summary>
 /// A Nearby Search lets you search for places within a specified area. \n
 /// You can refine your search request by supplying keywords or specifying the type of place you are searching for.
 /// </summary>
 /// <param name="lnglat">The longitude/latitude around which to retrieve place information. </param>
 /// <param name="radius">
 /// Defines the distance (in meters) within which to return place results. \n
 /// The maximum allowed radius is 50 000 meters.
 /// </param>
 /// <param name="key">
 /// Your application's API key. \n
 /// This key identifies your application for purposes of quota management and so that places added from your application are made immediately available to your app. \n
 /// Visit the Google APIs Console to create an API Project and obtain your key.
 /// </param>
 /// <param name="keyword">A term to be matched against all content that Google has indexed for this place, including but not limited to name, type, and address, as well as customer reviews and other third-party content.</param>
 /// <param name="name">
 /// One or more terms to be matched against the names of places, separated with a space character. \n
 /// Results will be restricted to those containing the passed name values. \n
 /// Note that a place may have additional names associated with it, beyond its listed name. \n
 /// The API will try to match the passed name value against all of these names. \n
 /// As a result, places may be returned in the results whose listed names do not match the search term, but whose associated names do.
 /// </param>
 /// <param name="types">
 /// Restricts the results to places matching at least one of the specified types. \n
 /// Types should be separated with a pipe symbol (type1|type2|etc).\n
 /// See the list of supported types:\n
 /// https://developers.google.com/places/documentation/supported_types
 /// </param>
 /// <param name="minprice">
 /// Restricts results to only those places within the specified range. \n
 /// Valid values range between 0 (most affordable) to 4 (most expensive), inclusive. \n
 /// The exact amount indicated by a specific value will vary from region to region.
 /// </param>
 /// <param name="maxprice">
 /// Restricts results to only those places within the specified range. \n
 /// Valid values range between 0 (most affordable) to 4 (most expensive), inclusive. \n
 /// The exact amount indicated by a specific value will vary from region to region.
 /// </param>
 /// <param name="opennow">
 /// Returns only those places that are open for business at the time the query is sent. \n
 /// Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query.
 /// </param>
 /// <param name="rankBy">Specifies the order in which results are listed.</param>
 /// <returns>Query instance to the Google API.</returns>
 public static OnlineMapsGoogleAPIQuery FindNearby(Vector2 lnglat, int radius, string key, string keyword = null, string name = null, string types = null, int minprice = -1, int maxprice = -1, bool opennow = false, OnlineMapsFindPlacesRankBy rankBy = OnlineMapsFindPlacesRankBy.prominence)
 {
     return(new OnlineMapsFindPlaces(key, new NearbyParams(lnglat, radius)
     {
         keyword = keyword,
         name = name,
         types = types,
         minprice = minprice,
         maxprice = maxprice,
         opennow = opennow,
         rankBy = rankBy
     }));
 }
コード例 #4
0
 /// <summary>
 /// A Nearby Search lets you search for places within a specified area. \n
 /// You can refine your search request by supplying keywords or specifying the type of place you are searching for.
 /// </summary>
 /// <param name="latlng">The latitude/longitude around which to retrieve place information. </param>
 /// <param name="radius">
 /// Defines the distance (in meters) within which to return place results. \n
 /// The maximum allowed radius is 50 000 meters.
 /// </param>
 /// <param name="key">
 /// Your application's API key. \n
 /// This key identifies your application for purposes of quota management and so that places added from your application are made immediately available to your app. \n
 /// Visit the Google APIs Console to create an API Project and obtain your key.
 /// </param>
 /// <param name="keyword">A term to be matched against all content that Google has indexed for this place, including but not limited to name, type, and address, as well as customer reviews and other third-party content.</param>
 /// <param name="name">
 /// One or more terms to be matched against the names of places, separated with a space character. \n
 /// Results will be restricted to those containing the passed name values. \n
 /// Note that a place may have additional names associated with it, beyond its listed name. \n
 /// The API will try to match the passed name value against all of these names. \n
 /// As a result, places may be returned in the results whose listed names do not match the search term, but whose associated names do.
 /// </param>
 /// <param name="types">
 /// Restricts the results to places matching at least one of the specified types. \n
 /// Types should be separated with a pipe symbol (type1|type2|etc).\n
 /// See the list of supported types:\n
 /// https://developers.google.com/places/documentation/supported_types
 /// </param>
 /// <param name="minprice">
 /// Restricts results to only those places within the specified range. \n
 /// Valid values range between 0 (most affordable) to 4 (most expensive), inclusive. \n
 /// The exact amount indicated by a specific value will vary from region to region.
 /// </param>
 /// <param name="maxprice">
 /// Restricts results to only those places within the specified range. \n
 /// Valid values range between 0 (most affordable) to 4 (most expensive), inclusive. \n
 /// The exact amount indicated by a specific value will vary from region to region.
 /// </param>
 /// <param name="opennow">
 /// Returns only those places that are open for business at the time the query is sent. \n
 /// Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query.
 /// </param>
 /// <param name="rankBy">Specifies the order in which results are listed.</param>
 /// <returns>Query instance to the Google API.</returns>
 public static OnlineMapsGoogleAPIQuery FindNearby(Vector2 latlng, int radius, string key, string keyword = null, string name = null, string types = null, int minprice = -1, int maxprice = -1, bool opennow = false, OnlineMapsFindPlacesRankBy rankBy = OnlineMapsFindPlacesRankBy.prominence)
 {
     OnlineMapsFindPlaces query = new OnlineMapsFindPlaces(
         OnlineMapsFindPlacesType.nearby, 
         key,
         latlng, 
         radius, 
         keyword, 
         name, 
         types, 
         null, 
         null,
         minprice, 
         maxprice, 
         opennow, 
         rankBy);
     OnlineMaps.instance.AddGoogleAPIQuery(query);
     return query;
 }
コード例 #5
0
    private OnlineMapsFindPlaces(OnlineMapsFindPlacesType reqType, string key, Vector2 latlng = default(Vector2), int radius = -1, string keyword = null, string name = null, string types = null, string query = null, string language = null, int minprice = -1, int maxprice = -1, bool opennow = false, OnlineMapsFindPlacesRankBy rankBy = OnlineMapsFindPlacesRankBy.prominence)
    {
        _status = OnlineMapsQueryStatus.downloading;

        string typePath = string.Empty;

        if (reqType == OnlineMapsFindPlacesType.nearby)
        {
            typePath = "nearbysearch";
        }
        else if (reqType == OnlineMapsFindPlacesType.text)
        {
            typePath = "textsearch";
        }
        else if (reqType == OnlineMapsFindPlacesType.radar)
        {
            typePath = "radarsearch";
        }

        string url = "https://maps.googleapis.com/maps/api/place/{0}/xml?sensor=false";

        url = string.Format(url, typePath);

        if (latlng != default(Vector2))
        {
            url += string.Format("&location={0},{1}", latlng.y, latlng.x);
        }
        if (radius != -1)
        {
            url += "&radius=" + radius;
        }
        if (!string.IsNullOrEmpty(key))
        {
            url += "&key=" + key;
        }
        if (!string.IsNullOrEmpty(keyword))
        {
            url += "&keyword=" + keyword;
        }
        if (!string.IsNullOrEmpty(name))
        {
            url += "&name=" + name;
        }
        if (!string.IsNullOrEmpty(types))
        {
            url += "&types=" + types;
        }
        if (!string.IsNullOrEmpty(query))
        {
            url += "&query=" + query.Replace(" ", "+");
        }
        if (!string.IsNullOrEmpty(language))
        {
            url += "&language=" + language;
        }
        if (minprice != -1)
        {
            url += "&minprice=" + minprice;
        }
        if (maxprice != -1)
        {
            url += "&maxprice=" + maxprice;
        }
        if (opennow)
        {
            url += "&opennow";
        }
        if (rankBy == OnlineMapsFindPlacesRankBy.distance)
        {
            url += "&rankby=distance";
        }

        www = OnlineMapsUtils.GetWWW(url);
    }
コード例 #6
0
    /// <summary>
    /// A Nearby Search lets you search for places within a specified area. \n
    /// You can refine your search request by supplying keywords or specifying the type of place you are searching for.
    /// </summary>
    /// <param name="latlng">The latitude/longitude around which to retrieve place information. </param>
    /// <param name="radius">
    /// Defines the distance (in meters) within which to return place results. \n
    /// The maximum allowed radius is 50 000 meters.
    /// </param>
    /// <param name="key">
    /// Your application's API key. \n
    /// This key identifies your application for purposes of quota management and so that places added from your application are made immediately available to your app. \n
    /// Visit the Google APIs Console to create an API Project and obtain your key.
    /// </param>
    /// <param name="keyword">A term to be matched against all content that Google has indexed for this place, including but not limited to name, type, and address, as well as customer reviews and other third-party content.</param>
    /// <param name="name">
    /// One or more terms to be matched against the names of places, separated with a space character. \n
    /// Results will be restricted to those containing the passed name values. \n
    /// Note that a place may have additional names associated with it, beyond its listed name. \n
    /// The API will try to match the passed name value against all of these names. \n
    /// As a result, places may be returned in the results whose listed names do not match the search term, but whose associated names do.
    /// </param>
    /// <param name="types">
    /// Restricts the results to places matching at least one of the specified types. \n
    /// Types should be separated with a pipe symbol (type1|type2|etc).\n
    /// See the list of supported types:\n
    /// https://developers.google.com/places/documentation/supported_types
    /// </param>
    /// <param name="minprice">
    /// Restricts results to only those places within the specified range. \n
    /// Valid values range between 0 (most affordable) to 4 (most expensive), inclusive. \n
    /// The exact amount indicated by a specific value will vary from region to region.
    /// </param>
    /// <param name="maxprice">
    /// Restricts results to only those places within the specified range. \n
    /// Valid values range between 0 (most affordable) to 4 (most expensive), inclusive. \n
    /// The exact amount indicated by a specific value will vary from region to region.
    /// </param>
    /// <param name="opennow">
    /// Returns only those places that are open for business at the time the query is sent. \n
    /// Places that do not specify opening hours in the Google Places database will not be returned if you include this parameter in your query.
    /// </param>
    /// <param name="rankBy">Specifies the order in which results are listed.</param>
    /// <returns>Query instance to the Google API.</returns>
    public static OnlineMapsGoogleAPIQuery FindNearby(Vector2 latlng, int radius, string key, string keyword = null, string name = null, string types = null, int minprice = -1, int maxprice = -1, bool opennow = false, OnlineMapsFindPlacesRankBy rankBy = OnlineMapsFindPlacesRankBy.prominence)
    {
        OnlineMapsFindPlaces query = new OnlineMapsFindPlaces(
            OnlineMapsFindPlacesType.nearby,
            key,
            latlng,
            radius,
            keyword,
            name,
            types,
            null,
            null,
            minprice,
            maxprice,
            opennow,
            rankBy);

        OnlineMaps.instance.AddGoogleAPIQuery(query);
        return(query);
    }