Exemplo n.º 1
0
        private void OnComplete(string s)
        {
            OnlineMapsFindPlacesResult[] results = OnlineMapsFindPlaces.GetResults(s);
            if (results == null)
            {
                Debug.Log("Error");
                Debug.Log(s);
                return;
            }

            List <OnlineMapsMarker> markers = new List <OnlineMapsMarker>();

            foreach (OnlineMapsFindPlacesResult result in results)
            {
                Debug.Log(result.name);
                Debug.Log(result.location);

                OnlineMapsMarker marker = OnlineMaps.instance.AddMarker(result.location, result.name);
                markers.Add(marker);
            }

            Vector2 center;
            int     zoom;

            OnlineMapsUtils.GetCenterPointAndZoom(markers.ToArray(), out center, out zoom);

            OnlineMaps.instance.position = center;
            OnlineMaps.instance.zoom     = zoom + 1;
        }
Exemplo n.º 2
0
 private void Start()
 {
     OnlineMapsFindPlaces.FindNearby(
         new Vector2(151.1957362f, -33.8670522f),
         5000,
         "ADD YOUR OWN KEY HERE", // <----------------------------- Google API Key
         null,
         null,
         "food").OnComplete += OnComplete;
 }
Exemplo n.º 3
0
 private void Start()
 {
     // Makes a request to Google Places API.
     OnlineMapsFindPlaces.FindNearby(
         "ADD YOUR OWN KEY HERE",                     // <----------------------------- Google API Key
         new OnlineMapsFindPlaces.NearbyParams(
             new Vector2(151.1957362f, -33.8670522f), // X - Longitude, Y - Latitude
             5000)                                    // Radius
     {
         types = "food"
     }).OnComplete += OnComplete;
 }
Exemplo n.º 4
0
    /// <summary>
    /// The Google Places API Radar Search Service allows you to search for up to 200 places at once, but with less detail than is typically returned from a Text Search or Nearby Search request. \n
    /// With Radar Search, you can create applications that help users identify specific areas of interest within a geographic area.
    /// </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 by 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/maps/documentation/places/supported_types
    /// </param>
    /// <param name="minprice">
    /// Restricts results to only those places within the specified price level. \n
    /// Valid values are in the range from 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 price level. \n
    /// Valid values are in the range from 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>
    /// <returns>Query instance to the Google API.</returns>
    public static OnlineMapsGoogleAPIQuery FindRadar(Vector2 latlng, int radius, string key, string keyword = null, string name = null, string types = null, int minprice = -1, int maxprice = -1, bool opennow = false)
    {
        OnlineMapsFindPlaces query = new OnlineMapsFindPlaces(
            OnlineMapsFindPlacesType.radar,
            key,
            latlng,
            radius,
            keyword,
            name,
            types,
            null,
            null,
            minprice,
            maxprice,
            opennow);

        OnlineMaps.instance.AddGoogleAPIQuery(query);
        return(query);
    }
Exemplo n.º 5
0
    /// <summary>
    /// Returns information about a set of places based on a string — for example "pizza in New York" or "shoe stores near Ottawa". \n
    /// The service responds with a list of places matching the text string and any location bias that has been set. \n
    /// The search response will include a list of places.
    /// </summary>
    /// <param name="query">
    /// The text string on which to search, for example: "restaurant". \n
    /// The Google Places service will return candidate matches based on this string and order the results based on their perceived relevance.
    /// </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="latlng">The latitude/longitude around which to retrieve place information.</param>
    /// <param name="radius">
    /// Defines the distance (in meters) within which to bias place results. \n
    /// The maximum allowed radius is 50 000 meters. \n
    /// Results inside of this region will be ranked higher than results outside of the search circle; however, prominent results from outside of the search radius may be included.
    /// </param>
    /// <param name="language">The language code, indicating in which language the results should be returned, if possible. </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/maps/documentation/places/supported_types
    /// </param>
    /// <param name="minprice">
    /// Restricts results to only those places within the specified price level. \n
    /// Valid values are in the range from 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 price level. \n
    /// Valid values are in the range from 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>
    /// <returns>Query instance to the Google API.</returns>
    public static OnlineMapsGoogleAPIQuery FindText(string query, string key, Vector2 latlng = default(Vector2), int radius = -1, string language = null, string types = null, int minprice = -1, int maxprice = -1, bool opennow = false)
    {
        OnlineMapsFindPlaces q = new OnlineMapsFindPlaces(
            OnlineMapsFindPlacesType.text,
            key,
            latlng,
            radius,
            null,
            null,
            types,
            query,
            language,
            minprice,
            maxprice,
            opennow);

        OnlineMaps.instance.AddGoogleAPIQuery(q);
        return(q);
    }
Exemplo n.º 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);
    }
Exemplo n.º 7
0
        /// <summary>
        /// This method is called when a response is received.
        /// </summary>
        /// <param name="s">Response string</param>
        private void OnComplete(string s)
        {
            // Trying to get an array of results.
            OnlineMapsFindPlacesResult[] results = OnlineMapsFindPlaces.GetResults(s);

            // If there is no result
            if (results == null)
            {
                Debug.Log("Error");
                Debug.Log(s);
                return;
            }

            List <OnlineMapsMarker> markers = new List <OnlineMapsMarker>();

            foreach (OnlineMapsFindPlacesResult result in results)
            {
                // Log name and location of each result.
                Debug.Log(result.name);
                Debug.Log(result.location);

                // Create a marker at the location of the result.
                OnlineMapsMarker marker = OnlineMaps.instance.AddMarker(result.location, result.name);
                markers.Add(marker);
            }

            // Get center point and best zoom for markers
            Vector2 center;
            int     zoom;

            OnlineMapsUtils.GetCenterPointAndZoom(markers.ToArray(), out center, out zoom);

            // Set map position and zoom.
            OnlineMaps.instance.position = center;
            OnlineMaps.instance.zoom     = zoom + 1;
        }
 /// <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;
 }
 /// <summary>
 /// The Google Places API Radar Search Service allows you to search for up to 200 places at once, but with less detail than is typically returned from a Text Search or Nearby Search request. \n
 /// With Radar Search, you can create applications that help users identify specific areas of interest within a geographic area.
 /// </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 by 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/maps/documentation/places/supported_types
 /// </param>
 /// <param name="minprice">
 /// Restricts results to only those places within the specified price level. \n
 /// Valid values are in the range from 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 price level. \n
 /// Valid values are in the range from 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>
 /// <returns>Query instance to the Google API.</returns>
 public static OnlineMapsGoogleAPIQuery FindRadar(Vector2 latlng, int radius, string key, string keyword = null, string name = null, string types = null, int minprice = -1, int maxprice = -1, bool opennow = false)
 {
     OnlineMapsFindPlaces query = new OnlineMapsFindPlaces(
         OnlineMapsFindPlacesType.radar, 
         key,
         latlng, 
         radius, 
         keyword, 
         name, 
         types, 
         null,
         null,
         minprice, 
         maxprice, 
         opennow);
     OnlineMaps.instance.AddGoogleAPIQuery(query);
     return query;
 }
 /// <summary>
 /// Returns information about a set of places based on a string — for example "pizza in New York" or "shoe stores near Ottawa". \n
 /// The service responds with a list of places matching the text string and any location bias that has been set. \n
 /// The search response will include a list of places.
 /// </summary>
 /// <param name="query">
 /// The text string on which to search, for example: "restaurant". \n
 /// The Google Places service will return candidate matches based on this string and order the results based on their perceived relevance.
 /// </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="latlng">The latitude/longitude around which to retrieve place information.</param>
 /// <param name="radius">
 /// Defines the distance (in meters) within which to bias place results. \n
 /// The maximum allowed radius is 50 000 meters. \n
 /// Results inside of this region will be ranked higher than results outside of the search circle; however, prominent results from outside of the search radius may be included.
 /// </param>
 /// <param name="language">The language code, indicating in which language the results should be returned, if possible. </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/maps/documentation/places/supported_types
 /// </param>
 /// <param name="minprice">
 /// Restricts results to only those places within the specified price level. \n
 /// Valid values are in the range from 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 price level. \n
 /// Valid values are in the range from 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>
 /// <returns>Query instance to the Google API.</returns>
 public static OnlineMapsGoogleAPIQuery FindText(string query, string key, Vector2 latlng = default(Vector2), int radius = -1, string language = null, string types = null, int minprice = -1, int maxprice = -1, bool opennow = false)
 {
     OnlineMapsFindPlaces q = new OnlineMapsFindPlaces(
         OnlineMapsFindPlacesType.text, 
         key,
         latlng, 
         radius,
         null,
         null,
         types,
         query,
         language,
         minprice,
         maxprice,
         opennow); 
     OnlineMaps.instance.AddGoogleAPIQuery(q);
     return q;
 }