Activate your free membership today | Log-in

Thursday, November 6th, 2008

Google Maps Utilities for Creating Markers and Loading KML

Category: Mapping

I know, I know, this is a bit niche but, given the ubiquity of embedded Google Maps (and having done my fair share of Google Maps hacking), I found two utilities from CloudSync interesting.

The first is a web-based interface for playing around with putting custom markers on a map (i.e., the GIcon and GMarker APIs). As a bonus, the tool generates the JavaScript you’ll need as you play with the UI; there’s an associated blog entry.

The second is CSGeoXML, a handy wrapper API that makes it easy to overlay local KML files into an embedded Google Map. This works around a limitation in the Google Maps GGeoXML API that requires that KML files be located on a publicly accessible server. There’s also a blog entry for this one.

Thanks to Matt Bernier for sharing these with us.

Posted by Ben Galbraith at 7:00 am
1 Comment

++++-
4 rating from 11 votes

Monday, November 3rd, 2008

Chess Diagram Builder and Maps Library via GWT

Category: GWT, Mapping

Alexander (aka Sasha) Maryanovsky has been hacking away with GWT, and has some come up with a couple of interesting project.

The first, is a fun chess diagram builder that lets you build out a chess diagram and export it out:

Also, he has created Sasha Maps, an API that abstracts mapping implementations allowing you to plugin your own system (but Google Maps and WMS are implemented).

The appropriate Hello World could look something like this:

JAVA:
  1.  
  2. package com.maryanovsky.mapdemo.client;
  3.  
  4. import java.util.Arrays;
  5. import java.util.List;
  6. import com.google.gwt.core.client.EntryPoint;
  7. import com.google.gwt.user.client.ui.RootPanel;
  8. import com.maryanovsky.gwtutils.client.UiUtils;
  9. import com.maryanovsky.gwtutils.client.UserEventManager;
  10. import com.maryanovsky.map.client.*;
  11. import com.maryanovsky.map.client.impl.Google;
  12.  
  13. /**
  14. * The entry point of the Map demo.
  15. */
  16. public class TutorialDemo implements EntryPoint {
  17.   /**
  18.    * Starts the map demo.
  19.    */
  20.   public void onModuleLoad() {
  21.     List tileLayers = Arrays.asList(new TileLayer[]{Google.NORMAL_TILE_LAYER});
  22.  
  23.     Map map = new Map(Google.MERCATOR_PROJECTION, tileLayers, 0, 17);
  24.     LatLng initialLocation = new LatLng(60.050317, 30.350161);
  25.     int initialZoom = 13;
  26.  
  27.     MapWidget mapWidget = new MapWidget(
  28.       new MapLocationModel(0, 17, initialLocation, initialZoom));
  29.     mapWidget.setMap(map);
  30.  
  31.     UserEventManager eventManager = mapWidget.getUserEventManager();
  32.     eventManager.setDragAction(MapWidget.DRAG_MAP_ACTION);
  33.     eventManager.setDoubleClickAction(MapWidget.ANIMATED_ZOOM_IN_ACTION);
  34.     eventManager.setWheelAction(MapWidget.ANIMATED_ZOOM_ACTION);
  35.     eventManager.setRightClickAction(MapWidget.ANIMATED_PAN_MAP_ACTION);
  36.  
  37.     UiUtils.disableContextMenu(mapWidget.getElement());
  38.     UiUtils.addFullSize(RootPanel.get(), mapWidget);
  39.   }
  40. }
  41.  

The API gives you interfaces to setup custom maps, actions, overlays, map widgets, and more.

Posted by Dion Almaer at 6:26 am
Comment here

++---
2.7 rating from 7 votes

Thursday, September 25th, 2008

Google Maps JavaScript API on the iPhone

Category: Mapping

When you link to Google Maps on the iPhone, it opens up the naive application to give you the full iPhone experience. Alastair James wanted to use the Google Maps JavaScript API on the iPhone, and wrote up his thoughts:

Before the newest version of mobile Safari, this would not have been possible. Fundamentally you cant drag the map! However, with the new version Apple introduced a javascript API for sensing single and double finger drag events.

So, I went about knocking up a very basic test version (try it on your iPhone). Is buggy, basic and sub-optimal, but proves it could work nicely. Try zooming with the double finger pinch action!

I also tried the new webkit CSS transforms to allow free zooming and rotation, however they are buggy and slow on the iphone! Oh well! Anyway, maybe we can have google maps lite on the iphone?

Posted by Dion Almaer at 8:48 am
7 Comments

+----
1.8 rating from 79 votes

Tuesday, August 26th, 2008

navigator.geolocation: Using the W3C Geolocation API today

Category: Gears, Google, JavaScript, Mapping, Standards

Last week I wrote a simple WhereAreYou? application that used the Google Ajax APIs ClientLocation API to access your location via your IP address.

At the same time, we announced support for the Gears Geolocation API that can calculate your address using a GPS device, WiFi info, cell tower ids, and IP address lookups.

Add to all of that, the W3C Geolocation API that Andrei Popescu of the Gears team is editing. You will notice that it looks similar to the Gears API, with subtle differences. The ClientLocation API is quite different.

To make life easier, I decided to put together a shim called GeoMeta that give you the W3C Geolocation API, and happens to use the other APIs under the hood.

If you have the Geolocation API native in your browser (no one does yet, future proof!) that will be used. If you have Gears, that API will be used, and finally, with nothing the ClientLocation API will be used behind the scenes.

To you the API will look similar:

// navigator.geolocation.getCurrentPosition(successCallback, errorCallback, options)
navigator.geolocation.getCurrentPosition(function(position) {
      var location = [position.address.city, position.address.region, position.address.country].join(', ');
      createMap(position.latitude, position.longitude, location);
}, function() {
      document.getElementById('cantfindyou').innerHTML = "Crap, I don't know. Good hiding!";
});

At least, that is what I would like. Unfortunately, there are a few little differences that leak through.

  • The W3C API only seems to give you a lat / long, so you have to do the geocoding to get address info
  • The Gears API gives you an additional gearsAddress object attached to the resulting position object. This can contain a lot of information on the resulting area (street address to city to ...) however for certain providers the API returns that as null, the same as the W3C standard
  • That gearsAddress object has slightly different information from the address data that the ClientLocation API returns. NOTE: I would love to see this just called 'address' to help the shim.

To give you control when you need it, you can ask the navigator.geolocation object what type it is. navigator.geolocation.type will be null if it is native, but 'Gears' or 'ClientLocation' if a shim kicks in. You can also check navigator.geolocation.shim to see if it is augmented code.

Implementation

There is some fun implementation code in there if you poke around. For example, for the ClientLocation API, when you make a call, it will be added to a queue if the Google Loader hasn't fully loaded yet, and it will kick off that call when finished. Dealing with dynamically creating <script src> as a loading mechanism sure is fun!

I like the idea of jumping straight to the W3C standard and updating the shim as the APIs change. That way, when browsers catch up, the code will still work using the native APIs and you don't have to change a thing.

I also hope that we get general reverse geocoding in place, which would enable me to even take the native "standard" and strap on useful address info to the bare bones lat/long.

Where are you?

Posted by Dion Almaer at 9:14 am
5 Comments

+++--
3.9 rating from 15 votes

Thursday, December 13th, 2007

Unobtrusively Mapping Microformats with jQuery

Category: Articles, Mapping, Microformat, jQuery

Simon Willison just doesn't stop. This time he has added a way that details the technique of unobtrusively mapping microformats with jQuery.

Simon puts together jQuery, microformats, and the Google Maps API to grok hCard and show maps of any hCard data that is found, ending up with:

JAVASCRIPT:
  1.  
  2. jQuery(function() {
  3.         // First create a div to host the map
  4.         var themap = jQuery('<div id="themap"></div>').css({
  5.                 'width': '90%',
  6.                 'height': '400px'
  7.         }).insertBefore('ul.restaurants');
  8.  
  9.         // Now initialise the map
  10.         var mapstraction = new Mapstraction('themap','google');
  11.         mapstraction.addControls({
  12.                 zoom: 'large',
  13.                 map_type: true
  14.         });
  15.  
  16.         // Show map centred on Brighton
  17.         mapstraction.setCenterAndZoom(
  18.                 new LatLonPoint(50.82423734980143, -0.14007568359375),
  19.                 15 // Zoom level appropriate for Brighton city centre
  20.         );
  21.  
  22.         // Geocode each hcard and add a marker
  23.         jQuery('.vcard').each(function() {
  24.                 var hcard = jQuery(this);
  25.        
  26.                 var streetaddress = hcard.find('.street-address').text();
  27.                 var postcode = hcard.find('.postal-code').text();
  28.        
  29.                 var geocoder = new MapstractionGeocoder(function(result) {
  30.                         var marker = new Marker(result.point);
  31.                         marker.setInfoBubble(
  32.                                 '<div class="bubble">' + hcard.html() + '</div>'
  33.                         );
  34.                         mapstraction.addMarker(marker);
  35.                 }, 'google');   
  36.                 geocoder.geocode({'address': streetaddress + ', ' + postcode});
  37.         });
  38. });
  39.  

You see the finished code at work.

Posted by Dion Almaer at 7:01 am
2 Comments

+++--
3.7 rating from 26 votes

Friday, November 30th, 2007

Placeshout: New Rails based Geo-cool site

Category: Mapping, Ruby, Showcase

Andre Lewis has a new site out there, Placeshout which offers a way to quickly call out your favourites place in various locations.

You could argue that we have other places for this... Yelp for example, or My Maps themselves. So, why Placeshout?

Sometimes, you just want a quick suggestion

When Andre and I are looking for a hole-in-the-wall Mexican restaurant or a park with a softball field, we usually just want a quick suggestion, not a lengthy review. We want to know if a place is worth visiting in 30 seconds.

Placeshout isn't about volume - it's about trying to express the positives and negatives of a destination in as few of words as possible. If people agree, that "shoutout" moves up...if they don't, the shoutout moves down and begins to disappear.

We hope Placeshout makes it easier for you to find local destinations.

There are some interesting features in this, very Web 2.0-looking, site. One that stands out is the enhanced mapping experience on top of Google Maps. As you move around, directional arrows tell you how far various other cities are away. It is kinda fun to watch:

Posted by Dion Almaer at 10:05 am
3 Comments

++---
2.9 rating from 17 votes

Thursday, October 4th, 2007

Craigslist Tibco GI Remix

Category: Dojo, Google, Mapping, Offline, TIBCO

Luke Birdeau has remixed Craigslist to produce a desktop-esque Ajax application view on the data that adds features such as being able to save your favorites, add notes to them, and even use the app offline (e.g. take your laptop on the road to go see the stuff for sale of meet that blind date). The app combines aspects of 3 libraries – TIBCO GI 3.5 for the interface, plus Dojo (for offline) and Google Maps.

To get started you first pick a locale, then a category, then do a search. You can also add multiple regions and categories too.

Here is a quick demonstration of the app in action:

Posted by Dion Almaer at 4:02 am
19 Comments

+++--
3.9 rating from 34 votes

Friday, July 20th, 2007

Prague 360: Maps with quality

Category: Mapping, Showcase

I don't normally post many "mashups" but Prague 360 is to beautiful to pass up.

Jeffrey Martin and his brother David have created some high quality views on some of the cities, and they use the Google Maps API as the platform to show the content.

If you head over to Prague, you will see that along with the usual normal map, satellite, and hybrid options, there are gigapixel versions for Winter and Spring. Jeffrey finds a high spot where he sets up his camera and takes lots of photos of the area. These pictures are with a very nice, zoomed in lens, and then he stitches them together to make one REALLY large photo.

Then David takes the image over to matlab world and cuts it up into tiles for the various zoom levels on the map. Now, on the map, when you click on one of the gigapixel options the new tiles are overlayed.

You will also notice that on the various mapping views not all of the points of interest are shown. Instead, they use the MarkerManager component to package items that are close together as one point on the map.

You will also notice that the right hand side has 360 closeup views of the given areas. We all remember the original "VR" versions of this with poor quality. These are definitely a 2007 version. One of the use cases for the site is for people to check out real estate. With this level of quality, you really can get a good view of the property, easily enough to narrow it down.

Prague 360

Posted by Dion Almaer at 9:06 am
7 Comments

++++-
4.4 rating from 31 votes

Tuesday, May 29th, 2007

Google Maps: Street View and Mapplets

Category: Google, Mapping, Showcase

When I first saw the new Street View functionality that has appeared in the Google Maps preview I was obviously impressed.

We have seen other companies taking photos of the content, but being able to walk around the Map was very cool. If I am visiting a new building, or area, I find myself checking out the area before I drive there, as it is a lot easier to find the end point if you have seen it, and walked around the outside.

Google Maps Street View

There was also a release of Mapplets, which are embeddable Google Maps mashups. You are able to overlay multiple mashups onto the one map, which means that you can combine the old favourites: HousingMaps.com and ChicagoCrime.org to make sure you get your new home in a decent area!

What is exciting about these new features is that we have more tools to play with (writting Mapplets), and a nice showcase of using Flash within an Ajax application (Maps).

Posted by Dion Almaer at 11:30 am
22 Comments

++++-
4.5 rating from 39 votes

Thursday, May 10th, 2007

Overlay Pictures on Yahoo! Travel Maps

Category: Mapping, Showcase

Yahoo! Travel has added a new Map on Map feature which allows you to overlay maps, and set the opacity.

For example, this example has the forum in Rome overlayed on top of the city.

You can also check out the Grand Canyon and the National Mall.

Yahoo! Travel Map

Posted by Dion Almaer at 9:17 am
Comment here

+++--
3.8 rating from 20 votes

Friday, March 30th, 2007

InfiView: Interactive Ajax Graphical Maps and Diagrams

Category: Mapping, Toolkit

InfiView is a mapping development tool that empowers engineers to build infinite-sized Web 2.0 mind maps, network topologies, organization charts, LDAP tools and technical diagrams.

InfiView uses Ajax technology and its own unique dynamic memory management to enable developers to systematically create graphical web applications using any amount of data (from very small all the way to infinite). With InfiView-built web-applications, end-users seamlessly interact (pan, zoom, right-click for actions…) with all types of graphical data - such as network topologies, DNA sequences or genealogy charts - oblivious to the vast amounts of data available.

100% built in Bindows (www.bindows.net), InfiView is built on top of the Bindows framework which is back-end/server agnostic, and provides best-in-industry support for section-508 accessibility compliance, internationalization and localization.

Try the demos and watch the screencasts

InfiView

Posted by Dion Almaer at 6:47 am
17 Comments

++++-
4.5 rating from 116 votes

Monday, March 26th, 2007

Click2Map: Ajax Map Editor

Category: Mapping, Showcase

Antony Zanetti of HylioSoft have created Click2Map, an Ajax map editor.

The application is based on Bindows, the .NET Ajax framework, and it allows you to create maps, add markers, and build out the Google Map.

I was a bit surprised at the startup time (loading X/Y), but to be fair this is an early beta.

Click2Map

Posted by Dion Almaer at 8:54 am
8 Comments

+++--
3.7 rating from 28 votes

Friday, February 9th, 2007

GPlotter 0.9: Prototype and Google Maps v2 update

Category: JavaScript, Library, Mapping

Brennan Stehling has updated his GPlotter project "to make use of the revised Google Maps API. I also completely restructured the Javascript to a much more object oriented coding style. I am using the latest release of Prototype, which recently moved to a new location as well as posted a great deal of new documentation. I am using Prototype for the object inheritance and AJAX functionality."

GPlotter Example

JAVASCRIPT:
  1.  
  2. var plotter = new GPlotter();
  3. plotter.setColor(plotter.BLUE);
  4. plotter.setIconUrl("http://gplotter.offwhite.net/maps/icons/");
  5. plotter.plot("map", "labels", "milwaukee.xml?version=0.9.0");
  6.  

Extending GPlotter

JAVASCRIPT:
  1.  
  2. var MyMapper = Class.create();
  3. Object.extend(MyMapper.prototype, GPlotter.prototype);