3
votes

I'm looking for a Delphi component that enables the user to pick and modify lat/lon coordinates, preferably in a user-friendly way (that is, not by entering two numbers).

Ideally, the component would work as follows:

  • It has fields latitude and longitude that can be edited by the user.
  • Given coordinates, it displays a map or satellite picture with a marker.
  • It can take an address (street, number, zip-code and country) and make a guess for the coordinates
  • It would be nice if a user can drag the marker to adjust the coordinates

Does anybody know if such a component exists? Open-source solutions are preferred. If not, can anybody get me started on how to build such a component?

3
If you need something that works offline, you can also consider using MS MapPoint 2011 and its ActiveX control. Not free obviously, and you have to buy and install MapPoint on the computer, but it makes for an ease to use Active X mapping control on delphi. The trouble isn't the component, it's the data. Either go with online maps (google or bing) or you'll need potentially huge set of map data files, and a way to display them. - Warren P

3 Answers

6
votes

Try using the Google Static Maps API V2, If you want a Delphi sample to use this API try this article Using Google maps (Static Maps) without TWebBrowser and also check the license agreement (because in the time when I wrote this article the license agreement was different).

...If a Static Maps API image is used outside of a web-based application (such as a browser) then a link must be included pointing to the displayed location in a web browser or native Google Maps application

3
votes

Here you can find 4 articles about use the Google API in Delphi. You can find two arcicles about GeoAdress and two about Google Maps. How to find coordinates (lat/long) of an postal adress o select a position (lat/long) visualy in a Google Maps and retrieve it with Delphi.

The articles are in Spanish, but you can access to authomatic translation with a button on right of page.

All articles are with code; See and test it.

Regards.

1
votes

You can use online map services (e.g. Google Map or Microsoft Bing); they both provide static map services alongside their default dynamic map interfaces which work inside a web browser. They also support geo-location queries; that is, you can send an address to their server, and retrieve a coordinate. They also provide different layers of information and tools being drawn on the map.

For your purpose you can use static map service to retrieve an image (map, satellite, or hybrid) with specified zoom level and image size from a given coordinate using Google or Bing, then you can show the image in your application.

For using the geo-location query and dynamic web map you need to obtain a free developer key either using Google and Bing. They both also have extensive online documentation and SDK which you can download.

If you are looking for a ready commercial component, TGAgis is one of the components which provide such functionality.