Streetview in the Wild: A Flourishing Species

Posted by Pamela Fox, Maps API Team

Several weeks ago, we announced the official release of Street View in the Maps API and invited developers to post examples of their Street View mashups. We crossed our fingers and hoped that we’d made the classes flexible and functional enough for developers to work with, and soon enough the examples started flowing in.

Here are some of my favorites:

DualMaps: For a given location, displays the Street View, Birds Eye View, and Google aerial map view simultaneously and lets you embed or share the result
Povo: A local reviews site specially for Boston. Displays street view in a lightbox for each location, and has made a Street View tour especially for the recent Boston Marathon.
StreetView Adventure Game: In the spirit of the classic interactive fiction games like Zork, this demo lets you play a short game that begins with chasing a guy trying to climb out a window in San Francisco.

Also check out VegasVision, Ong Map V2 (Alpha), VPike, FlyRig, Street View Gadget, LotView, Street View SF Tour, RealBird, Glotter and a Street View Tour Gadget. And if you loved Trulia’s implementation (announced on Google LatLong last week), check out this demo that shows how to angle a street view panorama towards the side of the street that a building is on. (It involves math, but don’t worry, we’ve done it for you.)

Thanks to all you developers for sharing your work with us, and as always, please post your examples or questions in the forum.

Creating a User-Contributed Map: Look, Ma – No server side scripts!

Posted by Keir Clarke, Virtual Tourism Blog Author and Google Maps Mania Blog Contributor

Pamela Fox wrote a wonderful tutorial in November called Creating a User-Contributed Map with PHP and Google Spreadsheets. However if you are like me, the thought of having to tackle server-side scripting sends you running for the hills. Fortunately, the recent release of forms for Google Spreadsheets means it is now possible (with just a tiny bit of hacking and wizardry) to create a user contributed map without any server-side scripting and with the added bonus of Google hosting the data for you.

  1. The first step is to create a form for Google Spreadsheets at this page.

    The information that we need in order to add a contributor to our map is their name, latitude, and longitude. Of course, if you want more information on your map, you can always add more fields to the form later.

    • The first question we will ask is ‘What is your name?’. Type this into the ‘Question Title’ box. The default question type is ‘text’ – leave this as it is. After you have completed the ‘Question Title’ press ‘save’.
    • Now add the second question by clicking ‘+ Add a question’ and this time type ‘Latitude’ in the Question Title box. Again leave the question type as ‘text’ and press ‘save’ again.
    • Add one more question with ‘Longitude’ as the ‘Question Title’.
  2. The second step (and the only one that requires some coding) is to hack the generated spreadsheet form so that instead of having to type in a latitude and longitude manually, our users can just click on a map to show where they live. To do this, we create a map and then assign an event listener for the map 'click' event that writes the values of the clicked coordinate into the form input fields. The code that accomplishes that is shown below:

    var map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    
    GEvent.addListener(map, 'click', function(overlay, latlng) {
      var LatLngStr = "Lat = " + latlng.lat() + ", Long = " + latlng.lng();
      map.openInfoWindow(latlng, LatLngStr);
      document.getElementById("latbox").value = latlng.lat();
      document.getElementById("lonbox").value = latlng.lng();
    });
    

    The full HTML for the form and map is here. This page extracts the latitude and longitude when a user clicks on the map and automatically fills in the input boxes for latitude and longitude in the spreadsheet form, and also lets the user fill in their name. The important things to remember about modifying the generated spreadsheet form is that the form field names remain the same (e.g. the name for the latitude input is ‘single:2’), and that the form action remains the same (e.g. ‘http://spreadsheets.google.com/formResponse?key=pHxwMuyQhRdSwN9QcKaqWVA’).

    Now that you understand how the simple map-based form works, feel free to hack it further. Here’s an example using the same form that integrates the GClientGeocoder to let users type in an address and then stores the resulting coordinate in hidden input fields.

  3. Once you’ve successfully modified the form, all you need to do is use the Spreadsheet Map wizard to create your user-contributed map.

    The wizard will do all the work of creating your map and generating the code, and give you something like the map embedded below. You could also try out generating KML from the spreadsheet with the techniques from the Spreadsheets Mapper tool.

    Check out the example output of the spreadsheets map wizard.

Building your own ArcGIS.com client

ArcGIS.com provides a great collection of resources and, as Jack explains below, allows other people to discover the work ESRI users are doing.

ArcGIS.com includes a cool website, but as we learned when developing the Geoportal Extension, it also provides a RESTful interface. This meant we could offer users of the Geoportal Extension access to the information others are sharing through ArcGIS.com.

In the Geoportal Extension we allow distributed searches to go to ArcGIS.com. We implemented this early on in our contribution to the Group on Earth Observation

Realizing that many organizations aren’t waiting for yet another portal, we developed a simple mechanism to integrate a search widget into any web page that would allow searching Geoportals. This has resulted in an HTML widget that can be embedded with 2 simple lines of HTML. By default this widget searches the Geoportal it is part of. But hold on, there’s more!

The Geoportal can search external catalogs, including ones that implement the Open Geospatial Consortium (OGC) Catalog Service for the Web (CS-W), but since 9.3.1 it can also search… ArcGIS.com! Try it at the GEO Portal by going to the search page and selecting ArcGIS.com from the ‘search in’ dialog. You’ll notice it searches ArcGIS.com with the keywords you give. This means any Geoportal 9.3.1+ is a client to ArcGIS.com.

But back to the widget.

Directing the searches from the widget to ArcGIS.com is possible by adding a parameter that instructs the Geoportal to direct the searches to the identified remote site. And thus here is a widget that searches ArcGIS.com. All it took was a minimal HTML like this:

<html>
<body>
<p>Search widget for ArcGIS.com >
<script type="text/javascript"