Friday, July 18, 2014

Imagery Resources

Over the last ten years or so, there's been an explosion of imagery available to every day users. Free to use imagery has come from from Google Earth and Maps to the APIs to APIs available through other providers like Bing, Yahoo! and Apple. But perhaps one of the most interesting things, to me at least, is the availability of tools to manipulate and control your own imagery, and combine imagery from different sources. I thought I'd highlight a few here, not at all in an exhaustive way or in any particular order.

Map Knitter by Public Lab comes out of the mapping tools they developed, DIY balloon and kite mapping. But the tool would also be useful for those doing mapping with private drones, such as the Parrot Drones, any one of a number of other drones, or DIY drones. Public Lab also produces the Spectral Workbench for people to "Use a homemade spectrometer to scan different materials, and contribute to an open source database."

Of course I'd be remiss if I didn't mention Google's efforts to make imagery available through its new Google Maps for Business Imagery program. And Google Earth Engine which allows you to do "A planetary-scale platform for environmental data & analysis."

I've been playing around with PostGIS, an extension for PostGreSQL. PostGIS is probably the best relational database for vector data. A couple of years ago, they started a raster project. I've not seen any progress recently, but it's worth keeping an eye on.

And of course books have been written about GDAL, the Geospatial Data Abstraction Library. Powerful, with lots of scripts written for it. Definitely not for the faint of heart though. There's a great set of python scripts to do raster data manipulations.



Thursday, July 3, 2014

A Couple of Common Maps API Errors

I think it's worth occasionally calling out common errors using the Google Maps API. I run into these periodically, and I am calling them out not because people are doing something done but because they are easy to make and I wanted to record them. I'll probably make this a semi-regular thing I post about. If you run into questions about using our API, the Google Maps API support page has the right links and resources to use. In this post, I've got two that I see a lot. Both are for the JavaScript Maps API.

Using undocumented methods and properties

It's not uncommon that I run into people complaining on Twitter where they say something like "Google has changed the properties of this object so that Latitude is no longer in the .a property, it's now in .b. Thanks Google for breaking my site! :-)"

FYI, the Google Maps API has no object with a .a property. When Google compiles objects, the object may be represented with a .a property to the API. People find this out using tools like Firebug and Chrome Dev Tools and then come to rely on them, not realizing that the actual object is a say a google.maps.LatLng object that has methods .lat() and .lng() and that's the right way to get those values. And Google won't change those with a version change. There's no such guarantee about undocumented methods and properties.

Making the map invisible

Creating a google.maps.Map object you give it a node in the DOM to place the map. Usually people put this in a div object. However, developers often forget to give the node a size, say a height and width. And they're confused then when nothing shows up on their map. You can see it in the Simple Map sample if you click on the Javascript + HTML tab.

<!DOCTYPE html>
<html>
  <head>
    <title>Simple Map</title>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
      html, body, #map-canvas {
      height: 100%;
      margin: 0px;
      padding: 0px
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
    <script>
var map;
function initialize() {
  var mapOptions = {
  zoom: 8,
  center: new google.maps.LatLng(-34.397, 150.644)
  };
  map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}

google.maps.event.addDomListener(window, 'load', initialize);

    </script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>