Qt4 Google MapView

July 12, 2009 | Filed Under Qt4 | No Comments

I’ve received a couple of requests about Google Maps and Qt4. Today I’ve written a simple Widget that allows you to interact with Google Maps and Google Geocoder. You can set Map Type (Roadmap, Satellite, Terrain and Hybrid), you can set your center Coordinate, add Markers, add Info Windows get the User Click Coordinates and other things that Google Maps allows to do.

Qt4 Google MapView

With few lines of code, you can interact with Google Maps, and below you can see how to do it. (Other methods and overloads are available, check the GKMapView.h in the Source Code packet, link is at the end of the post).

GKMapView mapView;

// Change the Default MapType (Roadmap, Satellite, Terrain, Hybrid)
mapView.setMapType(GKMapTypeSatellite);

// Use Geocoder to Get Location from Address or Viceversa.
// See the Signals locationFound, locationNotFound() and
// addressFound(), addressNotFound() to get your results.
mapView.locationFromAddress("San Mateo");
mapView.addressFromLocation(32.718834, -117.164);

// Add Marker With Info Window at Specified Address (or Location)
mapView.addMarkerWithWindow("Bedford MA Marker",
                            "<b>Bedford MA</b> Marker",
                            "Bedford MA");

// Add Info Window without Marker using Address or Coordinates
mapView.addInfoWindow("Hello from <b>San Mateo</b>", "San Mateo");
mapView.addInfoWindow("Hello from <b>San Diego</b>", 32.718834, -117.164);

// Change your Current Location
mapView.setLocation("Phoenix AZ");

The Source Code is available Here with a small example: Qt4 Google Map View Source Code.

WebKit: Google Maps

February 1, 2009 | Filed Under Cocoa | No Comments

Following the Google StreetView post, another example on How Cocoa Application can Interact with Google. Today the WebKit shows Google Maps.
Cocoa Google Maps - Aliso Viejo
Like iPhoto ‘09 you can select you Map Type (Terrain, Satellite, Hybrid) and you can Zoom In or Zoom Out using controls of your Application.
Cocoa Google Maps - Red Wood
You can Find the Source Code Here: Cocoa Google Maps.