/// <summary>
    /// Constructor.
    /// </summary>
    /// <param name="address">Location title</param>
    /// <param name="latlng">Location coordinates (latitude,longitude). Example: 40.714224,-73.961452.</param>
    /// <param name="lang">Language of result</param>
    protected OnlineMapsGoogleGeocoding(string address = null, string latlng = null, string lang = null)
    {
        _status = OnlineMapsQueryStatus.downloading;

        StringBuilder url = new StringBuilder("https://maps.googleapis.com/maps/api/geocode/xml?sensor=false");

        if (!string.IsNullOrEmpty(address))
        {
            url.Append("&address=").Append(OnlineMapsWWW.EscapeURL(address));
        }
        if (!string.IsNullOrEmpty(latlng))
        {
            url.Append("&latlng=").Append(latlng.Replace(" ", ""));
        }
        if (!string.IsNullOrEmpty(lang))
        {
            url.Append("&language=").Append(lang);
        }

        if (OnlineMapsKeyManager.hasGoogleMaps)
        {
            url.Append("&key=").Append(OnlineMapsKeyManager.GoogleMaps());
        }

        www             = new OnlineMapsWWW(url);
        www.OnComplete += OnRequestComplete;
    }
    private OnlineMapsGooglePlacePhoto(string key, string photo_reference, int?maxWidth, int?maxHeight)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.GoogleMaps();
        }

        StringBuilder builder = new StringBuilder("https://maps.googleapis.com/maps/api/place/photo?key=").Append(key);

        builder.Append("&photo_reference=").Append(photo_reference);
        if (maxWidth.HasValue)
        {
            builder.Append("&maxwidth=").Append(maxWidth);
        }
        if (maxHeight.HasValue)
        {
            builder.Append("&maxheight=").Append(maxHeight);
        }

        if (!maxWidth.HasValue && !maxHeight.HasValue)
        {
            builder.Append("&maxwidth=").Append(800);
        }

        www             = new OnlineMapsWWW(builder);
        www.OnComplete += OnRequestComplete;
    }
Exemple #3
0
    /// <summary>
    /// Returns a blend of the three most relevant 3 word address candidates for a given location, based on a full or partial 3 word address. \n
    /// The specified 3 word address may either be a full 3 word address or a partial 3 word address containing the first 2 words in full and at least 1 character of the 3rd word.StandardBlend provides the search logic that powers the search box on map.what3words.com and in the what3words mobile apps.
    /// </summary>
    /// <param name="key">A valid API key</param>
    /// <param name="addr">The full or partial 3 word address to obtain blended candidates for. At minimum this must be the first two complete words plus at least one character from the third word</param>
    /// <param name="multilingual">
    /// StandardBlend is provided via 2 variant resources; single language and multilingual. \n
    /// The single language standardblend resource requires a language to be specified.The input full or partial 3 word address will be interpreted as being in the specified language and all results will be in this language. \n
    /// The multilingual standardblend-ml resource can accept an optional language. If specified, this will ensure that the standardblend-ml resource will look for results in this language, in addition to any other languages that yield relevant results.
    /// </param>
    /// <param name="lang">If specified, this parameter must be a supported 3 word address language as an ISO 639-1 2 letter code.</param>
    /// <param name="focus">A location, specified as a latitude,longitude used to refine the results. If specified, the results will be weighted to give preference to those near the specified location.</param>
    /// <returns>Query instance.</returns>
    public static OnlineMapsWhat3Words StandardBlend(string key, string addr, bool multilingual = false, string lang = "en", OnlineMapsVector2d?focus = null)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.What3Words();
        }

        StringBuilder url = new StringBuilder(endpoint).Append("standardblend");

        if (multilingual)
        {
            url.Append("-ml");
        }
        url.Append("?format=json&key=").Append(key);
        url.Append("&addr=").Append(addr);
        if (!string.IsNullOrEmpty(lang))
        {
            url.Append("&lang=").Append(lang);
        }
        if (focus.HasValue)
        {
            url.Append("&focus=")
            .Append(focus.Value.y.ToString(OnlineMapsUtils.numberFormat)).Append(",")
            .Append(focus.Value.x.ToString(OnlineMapsUtils.numberFormat));
        }
        return(new OnlineMapsWhat3Words(url));
    }
Exemple #4
0
        private void OnMapClick()
        {
            control.GetCoords(out targetLng, out targetLat);

            if (targetMarker == null)
            {
                targetMarker       = OnlineMapsMarker3DManager.CreateItem(targetLng, targetLat, targetPrefab);
                targetMarker.scale = targetScale;
            }
            else
            {
                targetMarker.SetPosition(targetLng, targetLat);
            }

            double tx1, ty1, tx2, ty2;

            map.projection.CoordinatesToTile(lng, lat, map.zoom, out tx1, out ty1);
            map.projection.CoordinatesToTile(targetLng, targetLat, map.zoom, out tx2, out ty2);

            rotation = (float)OnlineMapsUtils.Angle2D(tx1, ty1, tx2, ty2) - 90;

            if (!OnlineMapsKeyManager.hasGoogleMaps)
            {
                Debug.LogWarning("Please enter Map / Key Manager / Google Maps");
                return;
            }

            OnlineMapsGoogleDirections request = new OnlineMapsGoogleDirections(OnlineMapsKeyManager.GoogleMaps(), new Vector2((float)lng, (float)lat), control.GetCoords());

            request.OnComplete += OnRequestComplete;
            request.Send();
        }
    protected OnlineMapsGooglePlaceDetails(string key, string place_id, string reference, string language)
    {
        _status = OnlineMapsQueryStatus.downloading;

        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.GoogleMaps();
        }

        StringBuilder url = new StringBuilder("https://maps.googleapis.com/maps/api/place/details/xml?sensor=false&key=").Append(key);

        if (!string.IsNullOrEmpty(place_id))
        {
            url.Append("&placeid=").Append(place_id);
        }
        if (!string.IsNullOrEmpty(reference))
        {
            url.Append("&reference=").Append(reference);
        }
        if (!string.IsNullOrEmpty(language))
        {
            url.Append("&language=").Append(language);
        }

        www             = new OnlineMapsWWW(url);
        www.OnComplete += OnRequestComplete;
    }
Exemple #6
0
 internal virtual void GenerateURL(StringBuilder builder)
 {
     if (string.IsNullOrEmpty(key))
     {
         key = OnlineMapsKeyManager.AMap();
     }
     builder.Append(baseurl).Append("key=").Append(key).Append("&output=JSON");
 }
Exemple #7
0
    protected override void OnEnableLate()
    {
        base.OnEnableLate();

        keyManager = (target as OnlineMapsBingMapsTiledElevationManager).GetComponent <OnlineMapsKeyManager>();
        if (keyManager == null)
        {
            keyManager = FindObjectOfType <OnlineMapsKeyManager>();
        }
    }
Exemple #8
0
    /// <summary>
    /// Retrieves a list of the currently loaded and available 3 word address languages.
    /// </summary>
    /// <param name="key">A valid API key</param>
    /// <returns>Query instance.</returns>
    public static OnlineMapsWhat3Words GetLanguages(string key)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.What3Words();
        }

        StringBuilder url = new StringBuilder(endpoint);

        url.Append("languages?format=json&key=").Append(key);
        return(new OnlineMapsWhat3Words(url));
    }
        public virtual void Append(StringBuilder builder)
        {
            if (string.IsNullOrEmpty(key))
            {
                key = OnlineMapsKeyManager.OpenRouteService();
            }

            builder.Append("api_key=").Append(key);
            if (!string.IsNullOrEmpty(id))
            {
                builder.Append("&id=").Append(id);
            }
        }
Exemple #10
0
    private OnlineMapsQQSearch(string key, string keyword, Params p)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.QQ();
        }

        StringBuilder builder = new StringBuilder("http://apis.map.qq.com/ws/place/v1/search?key=").Append(key).Append("&keyword=").Append(OnlineMapsWWW.EscapeURL(keyword));

        p.AppendParams(builder);
        www             = new OnlineMapsWWW(builder);
        www.OnComplete += OnRequestComplete;
    }
Exemple #11
0
    public override void StartDownloadElevationTile(Tile tile)
    {
        if (TryLoadFromCache(tile))
        {
            return;
        }

        string        token = !string.IsNullOrEmpty(accessToken) ? accessToken : OnlineMapsKeyManager.Mapbox();
        string        url   = "https://api.mapbox.com/v4/mapbox.terrain-rgb/" + tile.zoom + "/" + tile.x + "/" + tile.y + ".pngraw?access_token=" + token;
        OnlineMapsWWW www   = new OnlineMapsWWW(url);

        www.OnComplete += delegate { OnTileDownloaded(tile, www); };
    }
 public virtual void GenerateURL(StringBuilder builder)
 {
     if (string.IsNullOrEmpty(key))
     {
         key = OnlineMapsKeyManager.BingMaps();
     }
     builder.Append("https://dev.virtualearth.net/REST/v1/Elevation/").Append(urlToken).Append("?key=").Append(key);
     if (heights == Heights.ellipsoid)
     {
         builder.Append("&hts=ellipsoid");
     }
     if (output == Output.xml)
     {
         builder.Append("&output=xml");
     }
 }
Exemple #13
0
    /// <summary>
    /// Returns a section of the 3m x 3m what3words grid for a given area.
    /// </summary>
    /// <param name="key">A valid API key</param>
    /// <param name="bbox">Bounding box, for which the grid should be returned.</param>
    /// <returns>Query instance.</returns>
    public static OnlineMapsWhat3Words Grid(string key, OnlineMapsGeoRect bbox)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.What3Words();
        }

        StringBuilder url = new StringBuilder(endpoint);

        url.Append("grid?format=json&key=").Append(key);
        url.Append("&bbox=")
        .Append(bbox.top.ToString(OnlineMapsUtils.numberFormat)).Append(",")
        .Append(bbox.right.ToString(OnlineMapsUtils.numberFormat)).Append(",")
        .Append(bbox.bottom.ToString(OnlineMapsUtils.numberFormat)).Append(",")
        .Append(bbox.left.ToString(OnlineMapsUtils.numberFormat));
        return(new OnlineMapsWhat3Words(url));
    }
    protected OnlineMapsGoogleDirections(string origin, string destination, bool alternatives = false)
    {
        _status = OnlineMapsQueryStatus.downloading;
        StringBuilder url = new StringBuilder();

        url.AppendFormat("https://maps.googleapis.com/maps/api/directions/xml?origin={0}&destination={1}&sensor=false", OnlineMapsWWW.EscapeURL(origin), OnlineMapsWWW.EscapeURL(destination));
        if (alternatives)
        {
            url.Append("&alternatives=true");
        }
        if (OnlineMapsKeyManager.hasGoogleMaps)
        {
            url.Append("&key=").Append(OnlineMapsKeyManager.GoogleMaps());
        }
        www             = new OnlineMapsWWW(url);
        www.OnComplete += OnRequestComplete;
    }
    private OnlineMapsBingMapsLocation(Vector2 point, string key, bool includeNeighborhood)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.BingMaps();
        }

        _status = OnlineMapsQueryStatus.downloading;
        StringBuilder url = new StringBuilder();

        url.AppendFormat("https://dev.virtualearth.net/REST/v1/Locations/{0}?key={1}&o=xml", point.y + "," + point.x, key);
        if (includeNeighborhood)
        {
            url.Append("&inclnb=1");
        }
        www             = new OnlineMapsWWW(url);
        www.OnComplete += OnRequestComplete;
    }
Exemple #16
0
    /// <summary>
    /// Returns a list of 3 word addresses based on user input and other parameters.
    /// </summary>
    /// <param name="key">A valid API key</param>
    /// <param name="addr">The full or partial 3 word address to obtain suggestions for. At minimum this must be the first two complete words plus at least one character from the third word.</param>
    /// <param name="multilingual">AutoSuggest is provided via 2 variant resources; single language and multilingual.</param>
    /// <param name="lang">For single language the lang parameter is required; for multilingual, the lang parameter is optional. If specified, this parameter must be a supported 3 word address language as an ISO 639-1 2 letter code.</param>
    /// <param name="focus">A location, used to refine the results. If specified, the results will be weighted to give preference to those near the specified location in addition to considering similarity to the addr string. If omitted the default behaviour is to weight results for similarity to the addr string only.</param>
    /// <param name="clip">Restricts results to those within a geographical area.</param>
    /// <param name="count">The number of AutoSuggest results to return. A maximum of 100 results can be specified, if a number greater than this is requested, this will be truncated to the maximum. The default is 3.</param>
    /// <param name="display">Display type.</param>
    /// <returns>Query instance.</returns>
    public static OnlineMapsWhat3Words AutoSuggest(string key, string addr, bool multilingual = false, string lang = "en", OnlineMapsVector2d?focus = null, Clip clip = null, int?count = null, Display display = Display.full)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.What3Words();
        }

        StringBuilder url = new StringBuilder(endpoint).Append("autosuggest");

        if (multilingual)
        {
            url.Append("-ml");
        }
        url.Append("?format=json&key=").Append(key);
        url.Append("&addr=").Append(addr);
        if (!string.IsNullOrEmpty(lang))
        {
            url.Append("&lang=").Append(lang);
        }
        if (focus.HasValue)
        {
            url.Append("&focus=").Append(focus.Value.y.ToString(OnlineMapsUtils.numberFormat)).Append(",")
            .Append(focus.Value.x.ToString(OnlineMapsUtils.numberFormat));
        }
        if (clip != null)
        {
            clip.AppendURL(url);
        }
        if (count.HasValue)
        {
            url.Append("&count=").Append(count.Value);
        }
        if (display != Display.full)
        {
            if (display == Display.minimal)
            {
                throw new Exception("AutoSuggest does not support Display.minimal.");
            }
            url.Append("&display=").Append(display);
        }
        return(new OnlineMapsWhat3Words(url));
    }
    protected OnlineMapsGooglePlacesAutocomplete(string input, string key, string types, int offset, Vector2 lnglat, int radius, string language, string components)
    {
        _status = OnlineMapsQueryStatus.downloading;

        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.GoogleMaps();
        }

        StringBuilder url = new StringBuilder("https://maps.googleapis.com/maps/api/place/autocomplete/xml?sensor=false");

        url.Append("&input=").Append(OnlineMapsWWW.EscapeURL(input));
        url.Append("&key=").Append(key);

        if (lnglat != default(Vector2))
        {
            url.AppendFormat("&location={0},{1}", lnglat.y, lnglat.x);
        }
        if (radius != -1)
        {
            url.Append("&radius=").Append(radius);
        }
        if (offset != -1)
        {
            url.Append("&offset=").Append(offset);
        }
        if (!string.IsNullOrEmpty(types))
        {
            url.Append("&types=").Append(types);
        }
        if (!string.IsNullOrEmpty(components))
        {
            url.Append("&components=").Append(components);
        }
        if (!string.IsNullOrEmpty(language))
        {
            url.Append("&language=").Append(language);
        }

        www             = new OnlineMapsWWW(url);
        www.OnComplete += OnRequestComplete;
    }
Exemple #18
0
    /// <summary>
    /// Forward geocodes a 3 word address to a position, expressed as coordinates of latitude and longitude.
    /// </summary>
    /// <param name="key">A valid API key</param>
    /// <param name="addr">A 3 word address as a string</param>
    /// <param name="lang">A supported 3 word address language as an ISO 639-1 2 letter code. </param>
    /// <param name="display">Display type</param>
    /// <returns>Query instance.</returns>
    public static OnlineMapsWhat3Words Forward(string key, string addr, string lang = null, Display display = Display.full)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.What3Words();
        }

        StringBuilder url = new StringBuilder(endpoint).Append("forward");

        url.Append("?format=json&key=").Append(key);
        url.Append("&addr=").Append(addr);
        if (!string.IsNullOrEmpty(lang))
        {
            url.Append("&lang=").Append(lang);
        }
        if (display != Display.full)
        {
            url.Append("&display=").Append(display);
        }
        return(new OnlineMapsWhat3Words(url));
    }
Exemple #19
0
    protected OnlineMapsGooglePlaces(string key, RequestParams p)
    {
        _status = OnlineMapsQueryStatus.downloading;

        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.GoogleMaps();
        }

        StringBuilder url = new StringBuilder();

        url.AppendFormat("https://maps.googleapis.com/maps/api/place/{0}/xml?sensor=false", p.typePath);
        if (!string.IsNullOrEmpty(key))
        {
            url.Append("&key=").Append(key);
        }
        p.AppendParams(url);

        www             = new OnlineMapsWWW(url);
        www.OnComplete += OnRequestComplete;
    }
    private OnlineMapsBingMapsLocation(string query, string key, int maxResults, bool includeNeighborhood)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.BingMaps();
        }

        _status = OnlineMapsQueryStatus.downloading;
        StringBuilder url = new StringBuilder();

        url.AppendFormat("https://dev.virtualearth.net/REST/v1/Locations/{0}?key={1}&o=xml", OnlineMapsWWW.EscapeURL(query), key);
        if (includeNeighborhood)
        {
            url.Append("&inclnb=1");
        }
        if (maxResults > 0 && maxResults != 5)
        {
            url.Append("&maxRes=").Append(maxResults);
        }
        www             = new OnlineMapsWWW(url);
        www.OnComplete += OnRequestComplete;
    }
Exemple #21
0
    private void Download(StringBuilder url, string key, string client, string signature)
    {
        if (!string.IsNullOrEmpty(key))
        {
            url.Append("&key=").Append(key);
        }
        else if (OnlineMapsKeyManager.hasGoogleMaps)
        {
            url.Append("&key=").Append(OnlineMapsKeyManager.GoogleMaps());
        }

        if (!string.IsNullOrEmpty(client))
        {
            url.Append("&client=").Append(client);
        }
        if (!string.IsNullOrEmpty(signature))
        {
            url.Append("&signature=").Append(signature);
        }
        www             = new OnlineMapsWWW(url);
        www.OnComplete += OnRequestComplete;
    }
Exemple #22
0
    /// <summary>
    /// Reverse geocodes coordinates, expressed as latitude and longitude to a 3 word address.
    /// </summary>
    /// <param name="key">A valid API key</param>
    /// <param name="coords">Coordinates</param>
    /// <param name="lang">A supported 3 word address language as an ISO 639-1 2 letter code.</param>
    /// <param name="display">Display type</param>
    /// <returns>Query instance.</returns>
    public static OnlineMapsWhat3Words Reverse(string key, OnlineMapsVector2d coords, string lang = null, Display display = Display.full)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.What3Words();
        }

        StringBuilder url = new StringBuilder(endpoint).Append("reverse");

        url.Append("?format=json&key=").Append(key);
        url.Append("&coords=")
        .Append(coords.y.ToString(OnlineMapsUtils.numberFormat)).Append(",")
        .Append(coords.x.ToString(OnlineMapsUtils.numberFormat));
        if (!string.IsNullOrEmpty(lang))
        {
            url.Append("&lang=").Append(lang);
        }
        if (display != Display.full)
        {
            url.Append("&display=").Append(display);
        }
        return(new OnlineMapsWhat3Words(url));
    }
        internal virtual void GenerateURL(StringBuilder url)
        {
            if (!string.IsNullOrEmpty(key))
            {
                url.Append("&key=").Append(key);
            }
            else if (OnlineMapsKeyManager.hasGoogleMaps)
            {
                url.Append("&key=").Append(OnlineMapsKeyManager.GoogleMaps());
            }

            if (!string.IsNullOrEmpty(language))
            {
                url.Append("&language=").Append(language);
            }
            if (!string.IsNullOrEmpty(client))
            {
                url.Append("&client=").Append(client);
            }
            if (!string.IsNullOrEmpty(signature))
            {
                url.Append("&signature=").Append(signature);
            }
        }
 private void OnEnable()
 {
     instance = this;
 }
    private OnlineMapsGoogleRoads(string key, IEnumerable path, bool interpolate)
    {
        if (string.IsNullOrEmpty(key))
        {
            key = OnlineMapsKeyManager.GoogleMaps();
        }

        StringBuilder builder = new StringBuilder("https://roads.googleapis.com/v1/snapToRoads?key=").Append(key);

        if (interpolate)
        {
            builder.Append("&intepolate=true");
        }
        builder.Append("&path=");

        int    type      = -1;
        int    i         = -1;
        double longitude = 0;
        bool   isFirst   = true;

        foreach (object p in path)
        {
            i++;
            if (type == -1)
            {
                if (p is double)
                {
                    type = 0;
                }
                else if (p is float)
                {
                    type = 1;
                }
                else if (p is Vector2)
                {
                    type = 2;
                }
                else
                {
                    throw new Exception("Unknown type of points. Must be IEnumerable<double>, IEnumerable<float> or IEnumerable<Vector2>.");
                }
            }

            double latitude;
            if (type == 0 || type == 1)
            {
                if (i % 2 == 1)
                {
                    if (type == 0)
                    {
                        latitude = (double)p;
                    }
                    else
                    {
                        latitude = (float)p;
                    }
                }
                else
                {
                    if (type == 0)
                    {
                        longitude = (double)p;
                    }
                    else
                    {
                        longitude = (float)p;
                    }
                    continue;
                }
            }
            else
            {
                Vector2 v = (Vector2)p;
                longitude = v.x;
                latitude  = v.y;
            }

            if (!isFirst)
            {
                builder.Append("|");
            }
            isFirst = false;
            builder.Append(latitude.ToString(OnlineMapsUtils.numberFormat)).Append(",")
            .Append(longitude.ToString(OnlineMapsUtils.numberFormat));
        }
        www             = new OnlineMapsWWW(builder);
        www.OnComplete += OnRequestComplete;
    }
    public void Send()
    {
        if (_status != OnlineMapsQueryStatus.idle)
        {
            return;
        }
        _status = OnlineMapsQueryStatus.downloading;

        Params p = requestParams;

        StringBuilder url = new StringBuilder();

        url.Append("https://maps.googleapis.com/maps/api/directions/xml?sensor=false");
        url.Append("&origin=");

        if (p.origin is string)
        {
            url.Append(OnlineMapsWWW.EscapeURL(p.origin as string));
        }
        else if (p.origin is Vector2)
        {
            Vector2 o = (Vector2)p.origin;
            url.Append(o.y.ToString(OnlineMapsUtils.numberFormat)).Append(",")
            .Append(o.x.ToString(OnlineMapsUtils.numberFormat));
        }
        else
        {
            throw new Exception("Origin must be string or Vector2.");
        }

        url.Append("&destination=");

        if (p.destination is string)
        {
            url.Append(OnlineMapsWWW.EscapeURL(p.destination as string));
        }
        else if (p.destination is Vector2)
        {
            Vector2 d = (Vector2)p.destination;
            url.Append(d.y.ToString(OnlineMapsUtils.numberFormat)).Append(",")
            .Append(d.x.ToString(OnlineMapsUtils.numberFormat));
        }
        else
        {
            throw new Exception("Destination must be string or Vector2.");
        }

        if (p.mode.HasValue && p.mode.Value != Mode.driving)
        {
            url.Append("&mode=").Append(Enum.GetName(typeof(Mode), p.mode.Value));
        }
        if (p.waypoints != null)
        {
            StringBuilder waypointStr    = new StringBuilder();
            bool          isFirst        = true;
            int           countWaypoints = 0;
            foreach (object w in p.waypoints)
            {
                if (countWaypoints >= 8)
                {
                    Debug.LogWarning("The maximum number of waypoints is 8.");
                    break;
                }

                if (!isFirst)
                {
                    waypointStr = waypointStr.Append("|");
                }

                if (w is string)
                {
                    waypointStr.Append(OnlineMapsWWW.EscapeURL(w as string));
                }
                else if (w is Vector2)
                {
                    Vector2 v = (Vector2)w;
                    waypointStr.Append(v.y.ToString(OnlineMapsUtils.numberFormat)).Append(",")
                    .Append(v.x.ToString(OnlineMapsUtils.numberFormat));
                }
                else
                {
                    throw new Exception("Waypoints must be string or Vector2.");
                }

                countWaypoints++;

                isFirst = false;
            }

            if (countWaypoints > 0)
            {
                url.Append("&waypoints=optimize:true|").Append(waypointStr);
            }
        }
        if (p.alternatives)
        {
            url.Append("&alternatives=true");
        }
        if (p.avoid.HasValue && p.avoid.Value != Avoid.none)
        {
            url.Append("&avoid=").Append(Enum.GetName(typeof(Avoid), p.avoid.Value));
        }
        if (p.units.HasValue && p.units.Value != Units.metric)
        {
            url.Append("&units=").Append(Enum.GetName(typeof(Units), p.units.Value));
        }
        if (!string.IsNullOrEmpty(p.region))
        {
            url.Append("&region=").Append(p.region);
        }
        if (p.departure_time != null)
        {
            url.Append("&departure_time=").Append(p.departure_time);
        }
        if (p.arrival_time.HasValue && p.arrival_time.Value > 0)
        {
            url.Append("&arrival_time=").Append(p.arrival_time.Value);
        }
        if (!string.IsNullOrEmpty(p.language))
        {
            url.Append("&language=").Append(p.language);
        }
        if (!string.IsNullOrEmpty(p.key))
        {
            url.Append("&key=").Append(p.key);
        }
        else if (OnlineMapsKeyManager.hasGoogleMaps)
        {
            url.Append("&key=").Append(OnlineMapsKeyManager.GoogleMaps());
        }

        if (p.traffic_model.HasValue && p.traffic_model.Value != TrafficModel.bestGuess)
        {
            url.Append("&traffic_model=").Append(Enum.GetName(typeof(TrafficModel), p.traffic_model.Value));
        }
        if (p.transit_mode.HasValue)
        {
            OnlineMapsUtils.GetValuesFromEnum(url, "transit_mode", typeof(TransitMode), (int)p.transit_mode.Value);
        }
        if (p.transit_routing_preference.HasValue)
        {
            url.Append("&transit_routing_preference=").Append(Enum.GetName(typeof(TransitRoutingPreference), p.transit_routing_preference.Value));
        }

        www             = new OnlineMapsWWW(url);
        www.OnComplete += OnRequestComplete;
    }
        public void Search()
        {
            if (!OnlineMapsKeyManager.hasGoogleMaps)
            {
                Debug.LogWarning("Please enter Map / Key Manager / Google Maps");
                return;
            }

            if (inputField == null)
            {
                return;
            }
            if (inputField.text.Length < 3)
            {
                return;
            }

            string locationName = inputField.text;

            OnlineMapsGoogleGeocoding request = new OnlineMapsGoogleGeocoding(locationName, OnlineMapsKeyManager.GoogleMaps());

            request.OnComplete += OnGeocodingComplete;
            request.Send();
        }
    public override void StartDownloadElevationTile(Tile tile)
    {
        if (TryLoadFromCache(tile))
        {
            return;
        }

        double lx, ty, rx, by;

        map.projection.TileToCoordinates(tile.x, tile.y, tile.zoom, out lx, out ty);
        map.projection.TileToCoordinates(tile.x + 1, tile.y + 1, tile.zoom, out rx, out @by);
        OnlineMapsBingMapsElevation request = OnlineMapsBingMapsElevation.GetElevationByBounds(OnlineMapsKeyManager.BingMaps(), lx, ty, rx, @by, tileWidth, tileHeight);

        request.OnFinish += r => OnTileDownloaded(tile, request);
    }