允许图像角点坐标且适用于非网络语言的地图API
我被要求将任意数量的地图 API 之一的地图支持添加到我们的软件中的地理显示。显示屏当前显示地理坐标,例如一系列 GPS 定位;我们想在他们后面展示一张地图。我们使用 C++ Builder 2010(有时Delphi),因此这是本机编译的软件,而不是 Web 应用程序。
问题是许多地图 API 似乎都是通过指定一个点来工作的,并且 API 返回以该点为中心的某种大小的地图。 Google 就是最好的例子:指定中心以及大小和比例(以像素为单位)。这意味着对于您返回的图像,您不知道图像角点的地理位置(除非我错过了一些东西 - 这将是一个很好的答案!)这意味着您无法绘制图像作为地理情节的背景。
换句话说:窗口的左边界和右边界分别为东经 147 度和 147.2 度; (例如)南纬 42.5 度和 42.6 度的顶部和底部边界。为了用地图填充该窗口,您需要能够请求包含窗口角点的地图,并知道返回图像的坐标,以便正确渲染图像。
因此,我正在寻求 SO 关于满足以下要求的良好地图 API 的建议:
- 允许包含四个角点的请求;返回结果具有图像角点的已知坐标
- 很容易从 Web 浏览器外部以本机代码使用。为了让您了解一下,像 Google 的静态图像 API 这样的 API 是一个很好的答案,它易于使用且易于处理输出;他们的 Javascript API 将是一个糟糕的答案;他们的网络服务 API 可以接受,但需要处理 JSON或 XML,所以比需要的更难。
I have been asked to add map support from one of any number of map APIs to a geographical display in our software. The display currently shows geographical coordinates, such as a series of GPS fixes; we'd like to show a map behind them. We use C++ Builder 2010 (and occasionally Delphi) so this is natively compiled software, not a web app.
The problem is many map APIs seem to work by you specifying a point, and the API returns a map of some size centred around that point. Google is the prime example: specify a centre and a size and scale (in pixels). This means that for the image you get back, you don't know the geolocation of the corner points of the image (unless I've missed something - that would be a good answer!) That means that you can't draw the image as the background to a geographical plot.
To explain it another way: the window has left and right borders of (say) 147 and 147.2 degrees east longitude; top and bottom borders of (say) 42.5 and 42.6 degrees south latitude. In order to fill that window with a map, you need to be able to request a map that encompasses the corner points of the window, and know the coordinates of the returned image(s) in order to render the image correctly.
So, I'm seeking SO's advice on a good map API that meets the following requirements:
- Allows a request that includes four corner points; return result has known coordinates for the image's corners
- Is easy to use from outside a web browser, in native code. To give you an idea, an API like Google's static image API is a great answer, it's easy to use and easy to handle the output; their Javascript API would be a terrible answer; their web services API would be acceptable, but requires processing JSON or XML so is harder than it needs to be.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
OpenStreetMap 允许获取由边界框指定的图像,如下所示:
缺点是 url 经常会导致错误,要么是因为您请求的图像太大,要么是因为他们的服务器太忙。您可能需要考虑使用 OSM 数据运行您自己的服务器。运行自己的服务器的另一个优点是您可以调整渲染器。
OpenStreetMap allows for getting an image specified by a bounding box, something like this:
The downsides are that the url often results in an error, either because you've requested too big of an image, or because their server is too busy. You may want to consider running your own server using the OSM data. The other advantage of running your own server is that you can tweak the renderer.
使用 OGC WMS GetMap 请求 获取图像
此 < a href="http://www.demis.nl/home/pages/wms/docs/OpenGISWMS.htm" rel="nofollow noreferrer">页面 解释了如何获取此内容 图像。该图像来自 DEMIS,但有数千家提供 WMS 服务的提供商
我确实推荐 DEMIS,但这里有一些免费 WMS 服务的列表。
Use the OGC WMS GetMap request to get an image
This page explains how to get this image. The image is from DEMIS, but there are thousands of providers out there with WMS services
I do recommend DEMIS, but here are some lists of free WMS services.
http://www.mapwindow.org/ 上的 MapWinGIS.ocx 可能就是您正在寻找的内容。该控件与 Delphi 配合良好,它将使用 *.shp 文件创建按订单排列的地图。它是开源的并且独立于互联网。源代码不是Delphi。
几年前就有人提出过类似的问题: 是否任何地图 API 都允许您检索精确区域? 在 stackoOverflow 上对该查询的回复可能会告诉您如何使用 Google 的静态图像 API。 OpenStreeMap 与之类似,并且也有一些与用户对 Google 静态地图相同的“反对意见”。
The MapWinGIS.ocx at http://www.mapwindow.org/ may be what you are looking for. The control works well with Delphi It will creates maps to order using *.shp files. It is open source and independent of the internet. The source code is not Delphi.
A similar question was asked several years ago: Does any map api allow you to retrieve an exact area? on stackoOverflow The replies to that query may give you ideas how you might use Google's static image API. OpenStreeMap is similar and has some of the same "objections" users have to Google's Static Maps.