Coder Social home page Coder Social logo

velyo / google-maps-services Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 8.0 1.67 MB

.NET client library for Google Maps API Web Services

Home Page: https://velyo.github.io/google-maps-services/

License: MIT License

C# 27.07% Batchfile 0.10% F# 0.54% JavaScript 21.27% CSS 51.02%
dotnet google-maps-api

google-maps-services's People

Contributors

0xced avatar velyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

google-maps-services's Issues

Getting error 400 bad request

Installed product versions

  • GoogleMapsClient: [example NET35]

Description

Getting error 400 bad request

Steps to recreate

GeocodingRequest request = new GeocodingRequest(42.1438409, 24.7495615);

GeocodingResponse response = request.GetResponse(); // here error 400

string address = response.Results[0].FormattedAddress;

Empty fields in address_components list when request a regular address

Installed product versions

  • GoogleMapsClient: NET45

Description

I am getting empty results for some fields on address_components when running a request on Google Maps API.

Steps to recreate

In a C# NET45 console project, run the code below in Main static method:

        MapsApiContext _context = MapsApiContext.Default;

        // Console.WriteLine("API Key is {0}", _context.ApiKey);

        GeocodingRequest geocodingRequest = new GeocodingRequest("1 Microsoft Way, Redmond, CA", _context);
        GeocodingResponse gmapResponse = geocodingRequest.GetResponse();

        foreach (var r in gmapResponse.Results)
        {
            Console.WriteLine("Latitude/Longitude is {0}/{1}", r.Geometry.Location.Latitude, r.Geometry.Location.Longitude);
            Console.WriteLine("Formatted Address is {0}", r.FormattedAddress);

            int l = 0;
            foreach (var ac in r.AddressComponents)
            {
                Console.Write("Address Components[{0}] are '{1}' and '{2}' of types [", l++, ac.ShortName, ac.LongName);
                for (int i = 0; i < ac.Types.Length; i++)
                    Console.Write(" {0} ", ac.Types[i]);
                Console.WriteLine("]");
            }

        }
        Console.WriteLine("------");
        Console.WriteLine("Press any key...");
        Console.ReadLine();

--

Current behavior

The execution response was:

Latitude/Longitude is 47,6393225/-122,1283833
Formatted Address is 1 Microsoft Way, Redmond, WA 98052, USA
Address Components[0] are '' and '' of types [ street_number ]
Address Components[1] are '' and '' of types [ route ]
Address Components[2] are '' and '' of types [ neighborhood political ]
Address Components[3] are '' and '' of types [ locality political ]
Address Components[4] are '' and '' of types [ administrative_area_level_2 political ]
Address Components[5] are '' and '' of types [ administrative_area_level_1 political ]
Address Components[6] are '' and '' of types [ country political ]
Address Components[7] are '' and '' of types [ postal_code ]
Address Components[8] are '' and '' of types [ postal_code_suffix ]

Press any key...

Expected behavior

The values for each address component should have the respective information as described by its type

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.