Giter VIP home page Giter VIP logo

google-maps's People

Contributors

allon-guralnek avatar dependabot[bot] avatar fr33fr0m avatar genbox avatar george-shaw avatar graham128 avatar juancri avatar jwkerley avatar kevbite avatar kzudin avatar leifershag avatar lucasfogliarini avatar lucasjans avatar maximn avatar mdekok avatar mishani0x0ef avatar nicholashead avatar nilesh-shah avatar oliverchristen avatar oudzy avatar petelopez avatar peterdew avatar rhwilburn avatar rossiter10 avatar rukeba avatar rvoroz avatar sevagd avatar solmead avatar the-chriss avatar tystol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-maps's Issues

Polylines for each steps

Also it would be great to see polyline points for each step

There is a html instructions but no step polyline.

"polyline" : {
"points" : "..."
},

Supporting .net core

I am keen to use this library via .net core, and have started working on it. In fact I am almost done (70% unit test pass and the code compiles). I will make a PR when I am done. Hopefully this is something of interest to this project. I am making it dual compile into netstandard and net45 which means it can be written once but support both targets. Someone could add a PCL one if they really wanted probably fairly easily too.

I will need some help likely on the travis aspects; but will give it a stab myself.

I have had to change some API, so not sure on the preference there (I have tried not to mostly; but there is alot of duplication around the async stuff) and also removing references to webclient to support netcore.

Perhaps #55 will be fixed by this as we can add a very easy new target once standardized to netstandard.

Broken unit test

image

The unit test as shown is failing. It seems to be something not returned from googles end. Perhaps we should update this unit test?

Static Map Requests now Require API Key?

I have updated to the 0.5.4 version of the GoogleMapsApi nuget package and today noticed something strange. I now get this message:

The Google Maps API server rejected your request. This service requires an API key.

For a URL that is built by the StaticMapsEngine:

http://maps.google.com/maps/api/staticmap?center=755%20Bush%20%23A%2C%20San%20Francisco%2C%20CA%2094108%20&zoom=14&size=350x350&maptype=roadmap&markers=color%3Ared%7Clabel%3AX%7C755%20Bush%20%23A%2C%20San%20Francisco%2C%20CA%2094108%20&sensor=false

But I see no way to add the API Key to the Static Map Request. Am I missing something new?

Thank you,
Ray

Can probably replace NUnit.Runners dependency with NUnit.ConsoleRunner

NUnit has been updated to move away from Nunit.Runners in favour of Nunit.Console.Runner

I propose we change this line:

- nuget install NUnit.Runners -Version 3.2.0 -OutputDirectory testrunner

to this line:

- nuget install NUnit.ConsoleRunner -Version 3.6.1 -OutputDirectory testrunner

Convert to PCL for using in Xamarin

Currently this projects NuGet package cant be used in a Xamarin.Android or Xamarin.IOS project. If changed to a PCL and given the right profile this could be fixed.

Make the library work on Windows Phone 8

I have tried to use you excellent library for a Windows phone project (specifically the directions API), but got around 8 compile errors.
They were easy to fix, but I don't want to contribute them since my "solution" was to simply delete the offending pieces of code (and some minor rewrites e.g. WebClient returns string)

thanks

DistanceMatrix statuses

The "Status" field of class "DistanceMatrixResponse" has the type "DirectionsStatusCodes" instead of "DistanceMatrixStatusCodes"?
The "Status" field of the "GoogleMapsApi.Entities.DistanceMatrix.Response.Element" class has the type "DirectionsStatusCodes", there are no enumerations for this status?
In the DistanceMatrixTests.cs tests, too, enumerations are used from "using GoogleMapsApi.Entities.Directions.Response;"?

Wrapper with Info Window

Hello, I found your lib and want to try it out.

I am trying to implement an info window, is there a wrapper in your lib with an Info window?

GeoCoding request not using API key

I'm seeing an issue where I am getting an over the query limit error when attempting to GeoCode addresses. I have logged into my Google console and don't see the number of requests for my API key increasing at all.

I have attempted to set the API key in the code by using the SigningKey property of the GeoCodingRequest, but that doesn't appear to do anything.

Am I missing something, or is the API key not being used when making GeoCode requests?

Location uses incorrect ToString method when generating LocationString

In GoogleMapsApi.Entities.Common the LocationString property uses num.ToString(CultureInfo.InvariantCulture) for the Latitude and Longitude.

Sometimes double gives scientific notation, e.g. if I have a longitude of 0.000009 this is converted to "9E-06". Google maps API does not support this notation for lat/long.

According to StackOverflow the only way to reliable generate string in the correct format is to use num.ToString("0." + new string('#', 339)).TrimEnd('0');

This works for me if I create a new MyLocation class inherited from Location and override ToString to use this format.

  private class MyLocation : Location
        {
            public MyLocation(double lat, double lng) : base(lat, lng)
            {
            }

            public override string ToString()
            {
                string lats = ToNonScientificString(Latitude);
                string lons = ToNonScientificString(Longitude);
                return lats + "," + lons;
            }

            private static string ToNonScientificString(double d)
            {
                return d.ToString(DoubleFormat).TrimEnd('0');
            }

            private static readonly string DoubleFormat = "0." + new string('#', 339);
        }

Unable to query API behind proxy

Hi there,
We're trying to use this library from behind a corporate proxy. Running the following throws a The remote server returned an error: (407) Proxy Authentication Required. exception.

How do we use this API from behind a proxy? Is there some way to configure the proxy?

using System;
using GoogleMapsApi;
using GoogleMapsApi.Entities.Directions.Request;
using GoogleMapsApi.Entities.Directions.Response;

namespace GoogleMapsApiTesting
{
    class Program
    {
        static void Main(string[] args)
        {

            //Static class use (Directions) (Can be made from static/instance class)
            DirectionsRequest directionsRequest = new DirectionsRequest()
            {
                Origin = "NYC, 5th and 39",
                Destination = "Philladephia, Chesnut and Wallnut",
            };

            DirectionsResponse directions = GoogleMaps.Directions.Query(directionsRequest);
            Console.WriteLine(directions);

        }
    }
}

A query on Directions hangs

My code just hangs on this line. Never getting a response back.
image

The request is arriving at google maps, I can see the request and the responsecode (http 200 ok))
What can be the reason here?

Add Vehicle Type LONG_DISTANCE_TRAIN

The google maps directions API call
https://maps.googleapis.com/maps/api/directions/json?&mode=transit&origin=Z%C3%BCrich-Flughafen&destination=Z%C3%BCrich&departure_time=1534606200
returns directions containing a vehicle type LONG_DISTANCE_TRAIN. This leads to an exception when parsing the response. When parsing this string to a VehicleType enum an ArgumentException occurs.

This error is reproducible like this:
GoogleMapsApi.GoogleMaps.Directions.Query(new DirectionsRequest { Origin = "Zürich-Flughafen", Destination = "Zürich", TravelMode = TravelMode.Transit, DepartureTime = new DateTime(2018, 08, 18, 15, 30, 00), });

Unfortunetely the vehicle type LONG_DISTANCE_TRAIN is not documented here: https://developers.google.com/maps/documentation/directions/intro#VehicleType

Is that possible make your BaseUrl changeable from out side?

I love your GoogleMapApi, very easy to use, My company has opensource project provide google style API which has no limitation for internal usage. use your code all I need change is change your MapsBaseRequest.cs BaseUrl parameter. I am thinking, is that possible make this field editable from outside, which give user ability to customize Url instead of only use maps.googleapis.com/maps/api/

Update to V 0.7 from .66 stopped working

We do not even get a response from the server to see what is going on.
{
Origin = origin,
Destination = destination
};

                DirectionsResponse directions = GoogleMaps.Directions.Query(directionsRequest);

I am assuming there are updates related to use of API key, we did not have to pass the key before, not sure if that is what is causing the issue.
Documentation does not reflect any breaking changes.
Test with passing and ApiKey produces same results
DirectionsRequest directionsRequest = new DirectionsRequest()
{
Origin = origin,
Destination = destination,
ApiKey = "...."
};

When using Google direction Api, How to add waypoints?

Your google-maps-api is very helpful for me.
but I don't know how to add waypoints in direction request.
I tried Waypoints as string array like this.
{ "lat1, lng1", "lat2, lng2", "lat3, lng3", "lat4, lng4"}
But I get Illegal request error.
What can I do?
Thank you advance.

Does keyword have any affect on Places Searches?

I'm trying a PlacesRequest with these paremeters:

        placesRequest.Location = {34.0522342,-118.2436849};
        placesRequest.Sensor = false;
        placesRequest.Types = "insurance_agency";
        placesRequest.Radius = 50000;
        placesRequest.Keyword = "whins.com";

And it returns AON as the first result. (Not "WHINS Insurance Agency")

Just for an experiment, I changed the keyword to "something silly" and achieved the exact same result. I still need to test if this is a Google API quirk.

---EDIT---
Turns out that's just what the API returns. I think I need to rely on the text search for more fuzzy/accurate searching when I have few details.

A lot of classes missing from package ?

Bear with me, since I'm only starting out to tinker with .NET and C# for a bit. But it seems that there are a lot of classes missing for this wrapper ?

I did a new C# console application in Vis Stud 2015 and used NuGet to install the wrapper. Afterwards I tried copy pasting the code in the wiki but it throws me an error on classes such as

DirectionsResponse directions = MapsAPI.GetDirections(directionsRequest);
// The name MapsApi doesnt exist in current context

and

GeocodingEngine geocodingEngine = new GeocodingEngine();
// The type or namespace GeocodingEngine could not be found

Do I need additional depedencies to get the wrapper to work ?

ps: I'm using GoogleMapsApi.0.52.0 and I also tried googleMapsApi 0.42.0 from NuGet. Both unable to work because there are missing classes

Thank you

The OverviewPath in DirectionResponse Route objects is always an empty array.

Dmitri Kozlov (gmail <- at <- dmitri80) has contacted me via email to report the following bug:

First of all thanks for Your work.
Trying to get direction resposnce.
Everything works besides OverviewPath {string[0]}

As I understand OverviewPath is overview_polyline.
This parramentr is important for me, but this come each time blank.

Using DirectionsRequest dr = new DirectionsRequest();
dr.Destination = "maleva 10, Ahtme, Kohtla-Järve, 31025 Ida-Viru County, Estonia";
dr.Origin= "veski 2, Jõhvi Parish, 41532 Ida-Viru County, Estonia"; dr.Sensor = false;

DirectionsResponse responce= GoogleMaps.Directions.Query(dr);

Is coming: Status OK GoogleMapsApi.Entities.Directions.Response.DirectionsStatusCodes

But: OverviewPath {string[0]} string[]

May is another way to get overview_polyline?

Regards
Dmitri Kozlov

This is due to the actual data of "overview_polyline" being nested inside an additional "points" property. In addition, the string provided by Google is encoded and supplying it to the user as-is is not very useful and therefore should be decoded. Fortunately someone already wrote a decoder in C#.

GeocodingRequest missing filter components

The original geocode Google api offers a filter (components) to get only certain types of components in the result.
I miss this parameter in the GeoCodingRequest class.

Static Everything!

I've just started trying to use this library today but it really hard to fit in to my normal development cycle as everything seems to be static. Would be really nice if the library could move towards instances using interfaces or virtual members so that everything could be mocked out and calls verified.

I don't mind submitted a pull request with some idea if that helps? I don't think there would be any breaking changes but might be worse obsoleting multiple navigation paths.

Radar search support

Edit: I made a pull request for this.

So it looks like the PlacesRequest uses maps.googleapis.com/maps/api/place/search/ which seems to act very similar to maps.googleapis.com/maps/api/place/nearbysearch. What I'm looking for is the radar search (https://developers.google.com/places/webservice/search#RadarSearchRequests). This allows you to search 200 places at once instead of the 20(or 60). Am I missing this somewhere, or are there any plans to add it?

API doesn't work on C# MVC3 project

Forwarded from google code project :

Reported by czetsuya, Today (10 hours ago)
What steps will reproduce the problem?

  1. Create a c# mvc3 project
  2. Include the dll in the project
  3. Put the sample api (example geocode) call in a controller

What is the expected output? What do you see instead?
Geocode of an address string (ex. New York). The request just continue loading.

What version of the product are you using? On what operating system?
0.10.0.0

Please provide any additional information below.
The api call just continue loading for more than 10mins.

WayPointOrder

Thanks again for Your work.

DirectionsResponse gives as one of route property gives WayPointOrder.

In DirectionsRequest I didn't find any way to something like this:
DirectionsRequest dr = new DirectionsRequest();
dr.OptimizeWaypoints = true;

May is another way to set optimizing, but now I found just one way:

dr.Waypoints ={"optimize:true","adrr1","adrr2"};

if is no such property, it would gread to realize that.

Directions API - substeps are not working

As an example see
http://maps.googleapis.com/maps/api/directions/json?origin=King%27s%20Cross%20station,%20Euston%20Road,%20London%20N1%209AP&destination=6%20Lukin%20St,%20London%20E1%200AA&mode=transit&departure_time=1402884303

there are 2 issues with this query:

  • The official Google documentation seems to differ from the implementation:
    The Google documentation states that each step field can contain a sub_steps array. In the example link you can see that the array is called steps. (I have not tested this for other cities)
  • This library does not parse the substeps because it has this signature:
[DataMember(Name = "sub_steps")]
public Step SubSteps { get; set; }

The correct signature is:

[DataMember(Name = "steps")]
public IEnumerable<Step> SubSteps { get; set; }

Convert to DateTime

Can i convert the return text "1 min" to datetime? I was thinking make a string logical to do this, but all ways sounds bad.

Thx

Description of setting the ApiKey

The description of setting the ApiKey in the wiki is confusing.

It suggests to add it to the config-file like so:

<add key="ApiKey" value=""/>
what made me think that the library will read and use this key from the config for all requests if available.

In fact the library doesn't work with that config-setting though, only the unittests does sometimes, like here: https://github.com/maximn/google-maps/blob/master/GoogleMapsApi.Test/IntegrationTests/DirectionsTests.cs#L198 and it puts the value manually into the requestobject.

But the unittest-project consúmes the library and isn't part of it.

@maximn What is the best to do here and what is most in line with the original purpose of the project :
* reading the ApiKey from config and use it (for all requests? / requests that need an ApiKey?) like I expected?

  • Change the documentation and instead tell to provide an ApiKey to the RequestObjects if needed?

System.InvalidOperationException within DownloadDataTaskAsync

Not really sure whats going off here, but i have a feelings its because the library is using an async void method without having a async context?
The DownloadDataTaskAsync method is currently using public WebClient.DownloadDataAsync(Uri address) and I'm guessing it just needs changing to use the one that returns a Task object - WebClient.DownloadDataTaskAsync(Uri address)

Details are below:

Exception thrown: 'System.InvalidOperationException' in GoogleMapsApi.dll

Additional information: An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async="true" %>. This exception may also indicate an attempt to call an "async void" method, which is generally unsupported within ASP.NET request processing. Instead, the asynchronous method should return a Task, and the caller should await it.

Stack Trace:

   at System.Web.AspNetSynchronizationContext.OperationStarted()
   at System.Net.WebClient.DownloadDataAsync(Uri address, Object userToken)
   at System.Net.WebClient.DownloadDataAsync(Uri address)
   at GoogleMapsApi.WebClientExtensionMethods.DownloadDataTaskAsync(WebClient client, Uri address, TimeSpan timeout, CancellationToken token) in c:\code\google-maps\GoogleMapsApi\WebClientExtensionMethods.cs:line 119
   at GoogleMapsApi.Engine.MapsAPIGenericEngine`2.QueryGoogleAPIAsync(TRequest request, TimeSpan timeout, CancellationToken token) in c:\code\google-maps\GoogleMapsApi\Engine\MapsAPIGenericEngine.cs:line 120
   at GoogleMapsApi.EngineFacade`2.QueryAsync(TRequest request, CancellationToken token) in c:\code\google-maps\GoogleMapsApi\GoogleMaps.cs:line 215

Ability to add referrer to request

As Google allows a Referrer Authorization, would it be possible to add this functionality?

I've looked at the code, and it would that it would make sense to add it as parameter to the query function, in the same way that timeout is added.

And then when you create a new WebClientEx pass the extra parameter for referrer and follow the same logic as when passing the timeout.

Newest version (0.67.0) stalls when querying directions

Not sure what changed between 0.66.0 and 0.67.0 - but we have very simple "look up directions" code that calls GoogleMaps.Directions.Query - and since upgrading to 0.67.0, it just "sits there" and never returns/timeouts. Downgrading to 0.66.0 fixes the issue for us.

Increace max Radius for PlacesAutocomplete from 50000 to 20000000 to turn off location bias

The paragraph from API documentation says:

Note: If you do not supply the location and radius, the API will attempt to detect the user's location from their IP address, and will bias the results to that location. If you would prefer to have no location bias, set the location to '0,0' and radius to '20000000' (20 thousand kilometers), to encompass the entire world.

20k km is about a half of equator length therefore it is not artificial unlike 50000 limitation.

Encoded Polyline based Static Maps

Hello,
Google static maps allow rendering static maps based on encoded polylines. These polylines are part of the directions API response.

I have noticed that, when I request static map using locations, if route has multiple steps which are not joined by single road and has curved, static maps draw a single line to pinpoint the route which is not accurate. But for the same origin and destinations, If i fire the static map using encoded polyline, I get more accuracy in the routes display on the map.

I observed that the only way currently do build static map request is using locations using this library. Do we have a way where I can request or build static map URL using encoded polylines?

Thanks
Nilesh

PolyLine.Points has bad coordinates in directions query (bug)

I have this code:

var directionsRequest = new DirectionsRequest  {Origin = "48.31 37.21", Destination = "48.32 37.35};
var directionsResponse = GoogleMaps.Directions.Query(directionsRequest);

i have response with one route which has one leg which has many Steps.
if we will look at PolyLine.Points property we can see points with bad coordinates
48312121, 37212122, 48323232, 37353223

DirectionsResponse pass though to client for map rendering

Hi,

Within a MVC project is it possible to pass through the response from GoogleMapsApi.GoogleMaps.Directions.Query (DirectionsResponse) to a view to render on a map? I have tried to do this but the DirectionsResponse is not accepted by the google maps api's directionsDisplay.setDirections function.

Thanks

Luke

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.