The Static Maps API is a great service for when you need to quickly generate a static, lightweight map. Following the updates to the Maps API/Earth API Terms of Service earlier this year, mobile application developers are now free to use the Static Maps API in native mobile apps, providing the map links to the Google Maps app or website for the same location. However the high pixel density of some mobile screens can make the labels and icons on such a static map unreadably small.
For this reason, we're introducing a new feature of the Static Maps API that smoothly doubles the size of the whole image including labels, icons, and overlays, to suit high resolution screens. To apply this upscaling to an existing Static Maps API image, simply append &scale=2 to the URL.
&scale=2
The image returned will contain the same level of detail, but be twice as wide and tall without the stepping or blurring that results from upscaling an existing image:
scale=1
scale=2
Note that when using the scale parameter the pixel size of the returned image is the product of the size and scale values given in the URL. The size parameter therefore now specifies the size of the required image in Density-independent pixels or Points, as they are known in the Android SDK and iOS SDK respectively.
scale
size
Web based apps can also benefit from higher resolution Static Maps by adding a scale=2 image to the page with a CSS width and height that matches the size parameter. By default, the browser on many mobile devices upscales images in web pages by a device specific factor based on the pixel density of the screen. However these devices will preserve additional detail in the image if the image pixel : CSS pixel ratio matches or exceeds the scaling factor, which can be found by querying window.devicePixelRatio in JavaScript.
window.devicePixelRatio
For example, below are the above two maps side-by-side with the same CSS size. On a desktop screen with a window.devicePixelRatio of 1.0 these will look almost indistinguishable. However open this blog post on a device with a high resolution screen, such as a Samsung Nexus S or Apple iPhone 4, and the image on the right will look significantly sharper.
1.0
As an added benefit, Maps API Premier developers can also request maps with a scale factor of 4. Although this exceeds the maximum window.devicePixelRatio of current mobile devices it does facilitate generating maps for printing at high quality:
scale=4
Note however that the largest image pixel size that the Static Maps API can generate for Premier customers, regardless of the value of the scale parameter, is 2048x2048. Consequently at scale=4 the largest available value for the size parameter is 512x512. Note also that any use of the Static Maps API for generating maps to print must comply with the Permission Guidelines for Google Maps and Earth, which apply equally to Maps API Premier customers.
For more information on the scale parameter, and the other great Static Maps features, check out the Static Maps API documentation. We hope this feature helps your apps enjoy the full benefit of the high resolution screens that are increasingly popular, and makes them just that little bit easier on the eye!
Posted by Thor Mitchell, Product Manager, Google Maps API
When visiting an unfamiliar city for the first time, I often pick up a tourist map when I check-in to the hotel. Tourist maps are distinctive because they apply equal emphasis to the landmarks of the city as they do to the street names and intersections. Landmarks can be extremely valuable for navigational purposes, and for this reason we add icons for prominent businesses and points of interest on Google Maps as you zoom in. These business icons can be clicked to view additional information about the business, such as the rating, address, and phone number.
At Google I/O this year we began integrating access to business information into the Maps API v3 with the launch of the places library, which adds Places Search and Autocomplete. As part of our ongoing effort to extend this integration, deliver a detailed and complete map, and offer a consistent user experience between Google Maps and the Maps API, we will shortly be adding these clickable business icons to the Maps API v3 as well.
If your application does not specify a specific version of the Maps API to load these icons will appear on the map by default from early next week, unless you are a Maps API Premier customer. The business icons will be classified with the poi.business Styled Maps feature type. If you would prefer that your Maps API application not include these icons, you can remove them ahead of next week’s release by setting visibility:off on the labels element of poi.business for your map. Maps API Premier customers who would like their maps to include these icons can enable them today by setting visibility:on.
poi.business
visibility:off
visibility:on
You can preview these icons, and the InfoWindow that is shown when they are clicked, on the map below:
In order to allow you to control visibility of these icons, and other features, across all the default map types, you can also now specify styles for your map in MapOptions. This enables you to selectively restyle roads, labels, and other features on Hybrid and Terrain maps in addition to Road Maps. Note however that the base satellite imagery (for Satellite and Hybrid maps) and base relief imagery (for Terrain maps) cannot be restyled.
MapOptions
For more information on setting map styles across map types, please see our updated Map Styling documentation. The Styled Maps Wizard has also been updated to apply styles across all maptypes. As always, if you need assistance applying styles to your Maps, or have any other Maps API questions, we recommend you post your questions to the Maps API v3 Forum.
This session at Google I/O demonstrated how developers can take advantage of new and little known GIS capabilities in all of our geo services.
We started out showing some of the GIS capabilities in Google Maps API, which amongst other features, lets you calculate distances and angles and overlay map tiles in arbitrary projections.
Moving onto some new and upcoming products, we showed off some of the capabilities of Google Earth Builder, a new platform to manage and publish large amounts of raster and vector GIS data.
In the world of data visualization, previous sessions had showed off new styling features for Fusion Tables. In this session, we showed how you can enable spatial queries on your data, displaying maps and statistics for the closest set of features to a location, or all features within an arbitrary radius.
Google Earth Builder is not the only new product that provides access to our infrastructure for working with large GIS datasets - we also talked about Google Earth Engine. This Google.org project is designed to help scientists easily access massive archives of satellite imagery, and run image analysis and other algorithms on the data within Google’s datacenters. Complex analyses that might take months or years to run on a single machine can now be completed in hours or minutes.
Finally, we showed off some ways you can integrate open source technology, and finished off the session with Brian Flood from Arc2Earth, who demonstrated a great example of the kind of GIS services that developers can build using Google’s Geo API’s.
Check out the video to see for yourself, and thanks for reading our Geo API’s Summer Learning Series.
Posted by Josh Livni, Geo Developer Relations Team
Give us feedback in our Product Forums.