开发者

Map API that allows image corner-point coordinates and is suitable for a non-web language

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 poi开发者_C百科nt. 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.


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.


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

Map API that allows image corner-point coordinates and is suitable for a non-web language

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

  • The GeoServer list
  • The gis.stackexchange.com list of lists


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜