允许图像角点坐标且适用于非网络语言的地图API

发布于 2024-12-08 21:09:09 字数 1395 浏览 0 评论 0原文

我被要求将任意数量的地图 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 技术交流群。

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

发布评论

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

评论(3

怪我入戏太深 2024-12-15 21:09:09

OpenStreetMap 允许获取由边界框指定的图像,如下所示:

http://tile.openstreetmap.org/cgi-bin/export?bbox=min_lon,min_lat,max_lon,max_lat&scale=3500&format=png

缺点是 url 经常会导致错误,要么是因为您请求的图像太大,要么是因为他们的服务器太忙。您可能需要考虑使用 OSM 数据运行您自己的服务器。运行自己的服务器的另一个优点是您可以调整渲染器。

OpenStreetMap allows for getting an image specified by a bounding box, something like this:

http://tile.openstreetmap.org/cgi-bin/export?bbox=min_lon,min_lat,max_lon,max_lat&scale=3500&format=png

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.

烟花易冷人易散 2024-12-15 21:09:09

使用 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

enter image description here

I do recommend DEMIS, but here are some lists of free WMS services.

非要怀念 2024-12-15 21:09:09

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.

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