OK, here is your bone ;-) This is a basic principle of integration of Google Maps into a Cocoa application.
1. You need to create a web page, that you will be displaying. This can be the standard Google Maps API example with one exception - you need to define the variable map in the body, so it becomes global:
Code:
<body>
<div id="map" style = "width:800px; height:512px;"></div>
<script language="JavaScript" type="text/javascript">
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(0, 0)); // or your default location
</script>
</body>
2. Then you create a Cocoa application, make sure you include the WebKit in the project, create a WebView in a window, point an instance variable (named mapView below) to the window and load the above mentioned document into the WebView.
3. Now you can easily communicate with the displayed map, something like this:
Code:
// you would of course get this by parsing the GPS output
NSString *lat = "50.12345"
NSString *lon = "04.00012"
NSString *jsCmd = [NSString stringWithFormat:@"map.panTo(new GLatLng(%@, %@));",lat, lon];
id document = [mapView windowScriptObject];
NSString *err = [document evaluateWebScript:jsCmd];
This way you can call all the Google JavaScript API functions, typically as a response to OS X GUI actions. Another quick example would bee zoom, called in response to a button click:
Code:
-(IBAction)ZoomIn:sender{
id document = [mapView windowScriptObject];
NSString *jsCmd = @"map.zoomIn();";
NSString *err = [document evaluateWebScript:jsCmd];
}