Google 地理编码推荐

发布于 2024-11-05 16:54:49 字数 289 浏览 3 评论 0原文

我正在考虑利用 Google Maps API 进行一些地理编码。我想实现客户端地理编码,以消除请求限制的可能性。

我需要对结果集执行一些相当复杂的逻辑,并且我更喜欢在 C# 中执行此操作,因为它是 ASP.NET MVC 应用程序。然而,该逻辑的一部分可能是发出后续跟进请求,而这又需要 JavaScript。

因此,我的第一个想法是在我的应用程序中创建一个服务来传递 JSON 结果和某些返回类型来触发后续请求。这似乎有点复杂,想从社区了解这是否是最好的方法,以及是否有任何库/第三方工具可以帮助处理这种情况。

I am looking into utilizing Google Maps API to do some geocoding. I want to implement client side geocoding, to remove the 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

过潦 2024-11-12 16:54:49

我有一个应用程序做了类似的事情,通过使用标准化事件(在这个应用程序中,不是W3标准或任何东西)来稍微解耦复杂性

  1. 客户端使用本机地理定位,SimpleGeo和Google Loader来猜测用户在哪里,然后使用AJAX来猜测用户在哪里服务器。
  2. 服务器使用客户端数据、MaxMind 和用户偏好来决定将用户视为
  3. 服务器响应是通用事件数据(作为 JSON 响应),由通用 AJAX 响应处理程序转换为针对 body 元素触发的一个或多个事件。
  4. 根据页面的不同,各种侦听器绑定到事件和/或命名空间(请参阅 jQuery 命名空间事件),并且它们处理更新的位置事件,例如,获取不同的天气数据,更改本地搜索结果
  5. 其中一些侦听器依次触发其他 AJAX 请求,对这些请求的响应也可能携带要触发的通用事件...

这样我就没有顺序代码写,即我可以添加或删除行为(简单或复杂)而不改变任何其他内容。 jQuery Events 是我使用的所有内容,在您决定如何模式之后,实际上没有什么太大的意义事物。

如果您对此感兴趣并且希望我扩展或澄清其中的一部分,请告诉我。

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.

菩提树下叶撕阳。 2024-11-12 16:54:49

您可能想尝试一下这个 API:
http://code.google.com/apis/maps/documentation/geocoding/

它更像 REST - 不需要 Javascript。与 C# 配合使用可能会更好

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#

心房敞 2024-11-12 16:54:49

最后我发现最好的解决方案是按照我在问题中所述进行。将 JSON 对象传递给控制器​​,执行工作,然后返回。工作得很好。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文