Google Maps Developers Gain GeoJSON Support for Richer Maps

Support for the GeoJSON data format within the JavaScript Maps API means that Google Maps developers will be able to create richer maps while producing cleaner code, according to Google.

Google has given Google Maps developers another helpful tool for their Maps-building arsenal now that the JavaScript API supports the GeoJSON format. The addition means that Google Maps developers will be able to use GeoJSON to encode a wide range of geographic data structures in their maps.

And what that means, according to Google, is that Maps developers will be able to produce more detailed maps while producing better code.

"Maps give us an easy way to visualize all types of information, from patterns in health expenditure[s] across the world, to oceans with the highest concentration of coral reefs at risk," wrote Jen Kovnats, product manager for the Maps API team, in a March 18 post on the Google Geo Developers Blog. "The tools used to create these maps should be just as easy to use. That's why, starting today, the JavaScript Maps API will support GeoJSON, making it simpler for developers to visualize richer data, with even cleaner code."

GeoJSON, which is a geospatial data interchange format based on JavaScript Object Notation (JSON), "has emerged as a popular format for sharing location-based information on the Web, and the JavaScript Maps API is embracing this open standard," wrote Kovnats. "This means, as a developer, you can now pull raw data from multiple data sources, such as the U.S. Geological Survey or Google Maps Engine, and easily display it on your Website."

For developers, that means that the new data layer "allows you to treat a dataset likeā€¦ well, a set of data, rather than individual and unrelated features," wrote Kovnats. "If you have a GeoJSON file, you can now load it on the map simply by adding a single line of code to your JavaScript."

In addition, Maps developers using the new feature will be able to add more information to their maps for users, she wrote. "And what's more, most places have attributes beyond just location: stores have opening times, rivers have current speed, and each Girl Guide troop has cookie selling turf. The Data layer allows you to represent all attributes in GeoJSON right on the map and make decisions about what data to display more easily."

The new code feature also means that developers can create a styling function with specific attributes and that as the data or rules are updated, "the styling will automatically be applied to every feature," wrote Kovnats. "This beats having to manually update each feature or rule as more information is added to the map."

More information about the updated JavaScript API with GeoJSON support is included in the latest developer docs, as well as a demo showing data from different sources and a Google Developers Live video, wrote Kovnats. "This is a new feature, so if you run into problems or think of any additions you'd love to see, get help on StackOverflow and check our support page for the right tags to use."