开发者

delphi+openstreetmap

开发者 https://www.devze.com 2022-12-18 21:11 出处:网络
is there a vcl or a project (in delphi) that would allow me to download OSM tiles and display them on an app?

is there a vcl or a project (in delphi) that would allow me to download OSM tiles and display them on an app?

I have tried embedding an b开发者_如何学Gorowser and it worked great but i need a way to display the maps offline.


As I see it, there is 3 ways to do this :

  • Save all displayed tiles as a single image (could be done easily with a TWebBrowser, or TEmbeddedBrowser component) : you would navigate to the map address (OSM Mapping Server) based on given coordinates (top left corner), and then take a snapshot. You need to recalculate the base coordinates (top left corner) after each snapshot.

  • You need to understand how tiles are generated, wich is not quite difficult : basically, the scheme of osm tiles generation is as follow http://osmserver.org/tiles/tile/x/y/z.png Once you understand how it works, you could calculate tiles url by code and download'em one by one. For more info on the tiles generation scheme look here : good thread on manifold forum : http://forum.manifold.net/forum/t71011.13#75206 http://wiki.openstreetmap.org/wiki/Slippy_Map http://wiki.openstreetmap.org/wiki/Tiles%40home or if you need to go further : http://wiki.openstreetmap.org/wiki/OSM_Protocol_Version_0.5

  • download the entire OSM maps (available on the web) and use a VCL component to display them (Tatukgis DK...)

Best Regards, Mo3ez


I don't know the OpenStreetMap project very well, but there's a chance that the project itself has the software to "view" the maps inside a page.

You can accomplish your goal: show the maps off-line using the same basic construct you have now for the user interface: a embedded browser.

What you change is the url the browser will connect to to something like (http://localhost:3458), making your application her own web-server, for example, with Indy TIdHTTPServer binded to port 3458 (just an example port).

That way, you can serve the content for the embedded browser from inside your application, in the same way Delphi IDE (>= 2005) itself provides content for the main page you see when you start it (in fact, a embedded web browser).

To that browser, you serve the viewer page, all it's dependencies and the OSM file. The only restriction to this idea is the viewer MUST do all the things on the client side (for example, it could be javascript, flash, etc.). No server side scripts, unless you are willing to "mimic" the server side behavior or to integrate your application with the script engine (not too easy).

Other chance is to use THBImage, who offers OpenStreetMap integration with Delphi and a (not working) site demo.


Oops! I tried to provide a few hyperlinks in my message but as a new StackOverflow user I'm limited to just one. You might checkout the "Need solution to display map" message thread (25-Jan-2010) on: embarcadero.public.delphi.thirdpartytools.general

I'm trying to solve a similar problem. I need to display a county-wide or city-wide map using Delphi and then put custom icons on the map. I do not need routing or a very detailed map. In the past I've used a TMS "hotspot" component for the custom icons on top of a TImage. Now I need a way for the client to select their own map for the static background image.

A freeware MFC GUI control class (with source) which implements display of OpenStreeMap tiles: www.naughter.com/osmctrl.html The zip there has an executable that shows how it works.

This unit is to calculate URLs for the OpenStreetMap Project's TileServer, and other useful utilities as may be needed. If you want to use OpenStreetMap in your pascal programs, then this is for you. http://code.google.com/p/openstreetmap-fpk/

I'm also considering using the free Tiger/Line maps. Those look pretty good in a free Linux program (xastir).

TatukGIS looks very good (and expensive). I certainly don't need a full GIS solution so this seems to be way overkill just to display a map. But if I don't find a simpler solution this still might be better than integrating MS MapPoint.

TGlobe seems like what I need but sadly it is no longer available.


look in StelMAP for Delphi with OSM

Component to view a map of the project OpenStreetMap for Delphi 2010 without using browser or scripts.

You can view maps offline. Support for proxy servers for work online. Multi-threaded loading tile map speeds up the process to download and view maps. The set of procedures and property allows you to add a component to map an unlimited number of layers, shapes and images.


Don't know about OSM files, but if you can open them in a browser, you can always embed a TWebBrowser in your Delphi application and load the files within it.
Not the most elegant, but should work...(requires IE)

0

精彩评论

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