Coder Social home page Coder Social logo

geocoding.net's Introduction

geocoding.net's People

Contributors

0657code avatar adalyatnazirov avatar adamhathcock avatar alvillain avatar bryant1410 avatar chadly avatar codejnki avatar daveajrussell avatar dfyx avatar dr9885 avatar harsimranb avatar jamesmanning avatar jaxuk avatar jensbengtsson avatar joekrill avatar joero4 avatar manuel-guilbault avatar nielsvoigt avatar osaleem303 avatar pranav700 avatar rodneyrichardson avatar ronin1 avatar ryanoneill1970 avatar s-moon avatar stlk avatar troncho avatar twarin avatar virtualhurst avatar zhskay 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  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

geocoding.net's Issues

Invalid latlng parameter

If I call ReverseGeocodeAsync( 51.441163, 0.000081) this generates a request:

GET https://maps.googleapis.com/maps/api/geocode/xml?latlng=51.441163,8.1E-05&sensor=false HTTP/1.1

which in turn generates:

<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
 <status>INVALID_REQUEST</status>
 <error_message>Invalid request. Invalid 'latlng' parameter.</error_message>
</GeocodeResponse>

Suggestions?

No APIkey specifyable for GoogleMaps API

Hi,
excellent library incidentally.

A recent test I did looping through 200 records to return a set of coordinates and I am now getting an error (OverQueryLimit) indicating I need to (presumably sign in with an apikey) so google can track my queries via my gmail account. Looking at the source it appears that the APIkey logic hasn't been defined for the googleGeocode library. Is this correct?

Cheers
Tim,

How to obtain the status from a Google Request

One item I cannot figure out is how to obtain the request status, in my case the GoogleStatus. I don't see anyway from either the GoogleGeocoder or the GoogleAddress objects.

I then assumed that if the google api returned anything other than OK, Geocoding.net would throw a GoogleGeocodingException, but am not getting any exceptions.

Thank you for putting this together.

How to use Accuracy value from Google?

Hello all - is there any way to access the Accuracy value that Google returns? I've gone through the properties available through intellisense but can't find anything that looks valuable. (And sorry for raising an issue - I couldn't find a discussion forum anywhere).

Improper Handling of Longitude Result Returned from Google Geocoding Service

In certain cases, the Google geocoding web service returns a longitude result of -180, which does not appear to be valid when parsing the results into the Location object. I have tried to eliminate the issue by providing custom bounds in the query, but it is not always consistent.

Here is an example with a longitude of -180 from the Google geocoding service:

https://maps.googleapis.com/maps/api/geocode/xml?latlng=26.713422775268555,-80.04793548583984&sensor=false

Here is what I believe to be an issue in the code when attempting to parse the longitude in the Location class:

public virtual double Longitude
              {
                     get { return longitude; }
                     set
                     {
                           if (value <= -180 || value > 180)
                                  throw new ArgumentOutOfRangeException("Longitude", value, "Value must be between -180 and 180 (inclusive).");
                           if (double.IsNaN(value))
                                  throw new ArgumentException("Longitude must be a valid number.", "Longitude");

                           longitude = value;
                     }
              }

Serialization error in Geocoding.Microsoft

Newtonsoft.Json does not serialize the Resource as a Location type, thus the cast in the ParseResponse-Method fails.

This issue may be present in other Geocoders. It has appeared in a project built from source, incorporating Geocoding.Core and Geocoding.Microsoft. The target framework is .NET 4.6.1.

Decimal to string should not be culture dependent

Calling ReverseGeoCode(double, double) results in a culture dependent string conversion. This in turn leads to incorrect or missing addresses (depending on provider). Example, using Bing on Swedish locale gives the following call
http://dev.virtualearth.net/REST/v1/Locations/47,64054,-122,12934?key=xxx
where the correct call should be
http://dev.virtualearth.net/REST/v1/Locations/47.64054,-122.12934?key=xxx

For Google this just fails and gives zero results, for Bing it gives "low resolution" results

To fix this i think it is enough to change the calls to GetResponse from
String.Format("{0},{1}", latitude, longitude)
to
string.Format(new System.Globalization.CultureInfo("en-US"), "{0},{1}", latitude, longitude)

Exception during ParseAddress()

Getting a GoogleGeocodingException - "Value cannot be empty. Parameter name: components"

Run the example and enter: "muswellbrook 2 New South Wales Australia"
at Geocoding.Google.GoogleGeocoder.ProcessRequest(HttpWebRequest request)
at Geocoding.Google.GoogleGeocoder.Geocode(String address)
at Geocoding.Google.GoogleGeocoder.Geocoding.IGeocoder.Geocode(String address)
at Example.Web.Controllers.HomeController.Geocode(String address)

Always explicitly setting Proxy (even to null) prevents the use of the default system proxy.

The Google and Microsoft providers are explicitly always setting the Proxy on the web request, even if it is null. Which makes it cumbersome to use the default system proxy. And it causes the requests to ignore it if you supply this in your .config:

<system.net> <defaultProxy enabled="true" useDefaultCredentials="true" /> </system.net>

Instead, consider:

if(this.Proxy != null) {
  request.Proxy = this.Proxy;
}

The MapQuest geocoder does this. The Yahoo Geocoder doesn't seem to support proxies at all. Not only that, the property should really be changed to an IWebProxy instead of WebProxy. Because even if I manually wanted to set the provider to use the default proxy, System.Net.WebRequest.DefaultWebProxy returns the interface (IWebProxy) and not the class (WebProxy).

Tuning Timeout for google geocoding

I see no way to customize the timeout of HTTP call to google. Maybe i miss something, if not, i can make a PR :

  • adding a property Timeout nullable in GoogleGeocoder class
  • use this property only if not null in

var req = WebRequest.Create(url) as HttpWebRequest;

Strong sign assembly

Hi,

Please could you strongly name the assemblies? Otherwise us with signed assemblies need to rebuild this and add our own key

Thank you!

OVER_QUERY_LIMIT response causes exception?

We're getting an uncaught exception thrown from the geocoding.net library when we make a geocoding response that gets an OVER_QUERY_LIMIT response from Google.

I don't have good control of our C# project but we get this in our logs: 2014-06-03 15:02:58,151 WINServer [26][osthread] ERROR WINConnect.Apis.ApiExceptionHandle - Name: Geocoding, Message: There was an error processing the geocoding request. See Status or InnerException for more information.

Running wireshark shows the response from Google is good:

over_query_limit_sniff

The exception caught in our code doesn't seem to have any useful information about the error. Do you need any more info on this?

Geocoding.net 3.3.0 BingMapsGeocoder throws Exception under mono 4.0.1

Found problem when deploying my small application to CentOS server:

Geocoding.Microsoft.BingGeocodingException: There was an error processing the geocoding request. See InnerException for more information. ---> System.Runtime.Serialization.SerializationException: Cannot load type 'Location:http://schemas.microsoft.com/search/local/ws/rest/v1'. Error at  (1,516)
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x0048f] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:200
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
  at System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection (System.Type collectionType, System.Type elementType, System.Object collectionInstance) [0x00247] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:357
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00419] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:183
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361
  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00485] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:195
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
  at System.Runtime.Serialization.Json.JsonSerializationReader.DeserializeGenericCollection (System.Type collectionType, System.Type elementType, System.Object collectionInstance) [0x00247] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:357
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00419] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:183
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
  at System.Runtime.Serialization.Json.TypeMapProperty.SetMemberValue (System.Object owner, System.Runtime.Serialization.Json.JsonSerializationReader jsr) [0x00019] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:361
  at System.Runtime.Serialization.Json.TypeMap.Deserialize (System.Runtime.Serialization.Json.JsonSerializationReader jsr, System.Object o) [0x000f4] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs:263
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type, System.Object instance) [0x00485] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:195
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadObject (System.Type type) [0x00000] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:72
  at System.Runtime.Serialization.Json.JsonSerializationReader.ReadRoot () [0x0000d] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs:66
  at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlReader reader, Boolean verifyObjectName) [0x00045] in /usr/local/src/mono/mono-4.0.1/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/DataContractJsonSerializer.cs:200
  --- End of inner exception stack trace ---
  at Geocoding.Microsoft.BingMapsGeocoder.ReverseGeocode (Double latitude, Double longitude) [0x00000] in <filename unknown>:0
...

I tried to figure out what is going on in those source files, but either couldn't understand or find the problem... Any ideas if this is a bug in mono and if it can be fixed, or should I do something differently when using mono?

Support extra data, i.e. viewport information etc.

The Google Geocoder response contains additional data, such as viewport size information, type of address etc. However these additional items of data are ignored for the purposes of Geocoding.net - is this intentionally by design (to keep the API slim and simple)?

Issues parsing Bing address??

I'm trying to ReverseGeocode using lat-lon, and I get this exception message: "Unable to cast object of type 'd__0' to type 'GeoCoding.Microsoft.BingAddress[]'.".

My code:
IGeoCoder geoCoder = new BingMapsGeoCoder(mykey);
BingAddress[] addresses = (BingAddress[]) geoCoder.ReverseGeocode(33.941213, -84.213531);

I've also tried assigning the results of geoCoder.ReverseGeocode(....) to a var:
var addresses = geoCoder.ReverseGeocode(33.941213, -84.213531);

but there is no address data associated with it.

I have verified that my key and the lat-lon is valid:
http://dev.virtualearth.net/REST/v1/Locations/33.941213,-84.213531?o=json&key=[my key]
returns:
{"authenticationResultCode":"ValidCredentials","brandLogoUri":"http://dev.virtualearth.net/Branding/logo_powered_by.png","copyright":"Copyright © 2013 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"Location:http://schemas.microsoft.com/search/local/ws/rest/v1","bbox":[33.93741767722188,-84.219858178107813,33.945143112363233,-84.207442573101446],"name":"85 S Peachtree St NW, Norcross, GA 30071","point":{"type":"Point","coordinates":[33.941280394792557,-84.21365037560463]},"address":{"addressLine":"85 S Peachtree St NW","adminDistrict":"GA","adminDistrict2":"Gwinnett Co.","countryRegion":"United States","formattedAddress":"85 S Peachtree St NW, Norcross, GA 30071","locality":"Norcross","postalCode":"30071"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[33.941280394792557,-84.21365037560463],"calculationMethod":"Interpolation","usageTypes":["Display","Route"]}],"matchCodes":["Good"]}]}],"statusCode":200,"statusDescription":"OK","traceId":"44ea061dc0e245f2ab49dba485148eb4|BL2M002309|02.00.161.1800|BL2MSNVM001280, BL2IPEVM000008"}

Exception thrown when using Geocoding google

Hi,

I receive this exception (sometimes) when sending geocoding requests

System.AggregateException occurred
HResult=0x80131500
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Easymage.TEC.Entities.Application.QueryHandlers.AddressSearchQueryHandler.Handle(AddressSearchQuery query) in C:\Users\Ludovic\Source\Repos\Easymage.TEC\Easymage.TEC.Entities.Application\QueryHandlers\AddressSearchQueryHandler.cs:line 32

Inner Exception 1:
GoogleGeocodingException: There was an error processing the geocoding request. See Status or InnerException for more information.

Calling "Count()" on result enumeration causes "First()" to fail

for the Google provider (Not sure about the others), if I call "Count()" on the resulting Address collection then "First()" claims there are none in the collection, even though "Count()" returns 1. Feels like Count() is unnecessarily moving and internal iterator

Error when running in .NET 4 only environment

The following exception is thrown: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib'

This StackOverflow post describes a similar error: http://stackoverflow.com/questions/13748055/could-not-load-type-system-runtime-compilerservices-extensionattribute-from-as

This blog post describes the underlying issue: http://www.mattwrock.com/post/2012/02/29/What-you-should-know-about-running-ILMerge-on-Net-45-Beta-assemblies-targeting-Net-40.aspx

Simple Example - Errors

In the Simple Example, listed on the front page for the project, this is listed:

IGeocoder geocoder = new GoogleGeocoder() { ApiKey = "this-is-my-optional-google-api-key" };
Address[] addresses = geocoder.Geocode("C");
Console.WriteLine("Formatted: " + addresses[0].FormattedAddress); //Formatted: 1600     Pennslyvania Avenue Northwest, Presiden'ts Park, Washington, DC 20500, USA
Console.WriteLine("Coordinates: " + addresses[0].Coordinates.Latitude + ", " + addresses[0].Coordinates.Longitude); //Coordinates: 38.8978378, -77.0365123

Notice "Address[] addresses = geocoder.Geocode("C");"

I am pretty sure that is a copy paste error, and should have been the address of the White House in stead of just "C".

I also an error in that line, regardless of value to geocode:

"Cannot convert source type 'System.Collection.Generic.IEnumerable<Geocoding.Address> to type 'Geocoding.Address[]'"

image

If I change things to IEnumerable and replace addresses[0] with addresses.First(), then it works.

Thank you for creating and updating the package, much appreciated. :)

PCL version

Any plans to port this to be compatible with the PCL?

Exception during batch request

Hello,

I am using MapQuest free vesion with UseOSM = true, and I am trying to batch geocode 100 addresses. By using fiddler I can see that the response is good, so the addresses are correclty geocoded, but I get an exception

Object reference not set to an instance of an object.

System.NullReferenceException

at Geocoding.MapQuest.MapQuestGeocoder.Parse(HttpWebRequest request) at Geocoding.MapQuest.MapQuestGeocoder.Execute(BaseRequest f) at Geocoding.MapQuest.MapQuestGeocoder.Geocode(IEnumerable`1 addresses) at ...Controller.d__13.MoveNext() in d:....Controller.cs:line 62

Thanks!

Exception thrown when using Geocoding.Microsoft

IGeocoder geocoder = new Geocoding.Microsoft.BingMapsGeocoder("my api key here");
IEnumerable<Address> addresses = geocoder.GeocodeAsync("amsterdam").Result;

Cannot convert type Geocoding.Microsoft.Json.Resource to type Geocoding.Microsoft.Json.Location

Async API

The world we live in today is 100% async. I think that the whole api should be async and those who are needing non async can use wrappers around there code to make it sync.

This would also make the api more consistent because you can't currently do an async reverse geocode..

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.