开发者

Google Geocoding Recommendation

开发者 https://www.devze.com 2023-03-04 16:39 出处:网络
I am looking into utilizing Google Maps API to do some geocoding. I want to implement client side geocoding, to remove th开发者_如何转开发e possibility of request limitation.

I am looking into utilizing Google Maps API to do some geocoding. I want to implement client side geocoding, to remove th开发者_如何转开发e possibility of request limitation.

I need to do some fairly complex logic on the result set, and I would prefer to do that in C# as it is a ASP.NET MVC application. However part of that logic is possibly makeing subsequent follow up requests and that again would require JavaScript.

So, my first thought is to make a service in my application to pass JSON results to and certain return types to trigger the subsequent request. That seems a little convoluted and want to know from the community if this seems like the best approach and if there are any libraries/third party tools that can help handle this situation.


I've an app that does something similar, with the complexity somewhat decoupled by using standardized events (within this app, not a W3 standard or anything)

  1. Client uses native geolocation, SimpleGeo and Google Loader to guess where the user is and AJAX's that to the server.
  2. Server uses client data, MaxMind, and user preferences to decide where to treat the user as being.
  3. Server response is generic event data (as JSON response) that is converted by a generic AJAX response handler into one or more events triggered against the body element.
  4. Depending on the page, various listeners are bound to the events and or namespaces (see jQuery namespaced events) and they handle the updated location events, e.g., getting different weather data, changing local search results
  5. Some of those listeners in turn trigger other AJAX requests, the responses to those may also carry generic events to triggered...

This way there's no sequential code I have to write, i.e., I can add or remove behaviors (simple or complex) without changing anything else. jQuery Events are all I use, really nothing much to it after you decide how you'll pattern things.

Let me know if that's interesting to you and you want me to expand or clarify a part of it.


You may want to try this API: http://code.google.com/apis/maps/documentation/geocoding/

It's far more REST like - no Javascript required. May work better with C#


In the end I found the best solution was to do as I stated in my question. Pass the JSON object to controller, do work, then return. Worked pretty well.

0

精彩评论

暂无评论...
验证码 换一张
取 消