Online Book Reader

Home Category

Mapping With Drupal - Alan Palazzolo [51]

By Root 310 0
manage your code. Git has become the main version control system used with Drupal. The Drupal documentation for Git is useful, but if you are totally new to version control, the GitHub help is an easy introduction.

Chapter 8. Conclusion


With all that you have learned about mapping with Drupal, you should now be able to create beautiful and useful maps for your website. Even using the pre-existing Drupal modules, you can build appropriate, useful, and interactive maps. Going beyond that, you can create your own modules to add imaginative and lively ways for your site’s users to interact with the maps, and you can personalize the maps with custom-built markers and interfaces.

Next Steps in Mapmaking


If you want to create even more interesting maps, with features that are not available through existing Drupal modules, you need to become familiar with JavaScript and with the JavaScript libraries that are used to create maps.

If you are using the OpenLayers module, get to know the OpenLayers JavaScript library. OpenLayers explained how to add new JavaScript Behaviors to your maps. There are many Behaviors in the OpenLayers JavaScript library that are not implemented in the OpenLayers module, but which you can activate using the method in Chapter 5. For example, it would be possible to add a shape on your map that rotates, with the speed of rotation representing the intensity of a tornado. The OpenLayers examples page contains an example showing the geometry.rotate method. Then again, you could create labels on your map that change depending on the zoom level. Find an example that is close to what you want to do, then view its source code to work out how it achieves its effect. In conjunction with that, study the class documentation. For the rotating tornado, you would read the documentation for the OpenLayers.Geometry.LineString class. There is one book in English on OpenLayers, which is listed in Appendix A.

As mentioned in Mapping with the OpenLayers Module, the OpenLayers JavaScript library is an open source project, so if you are running into limitations on what is possible and are inspired to add new features, you can get involved and contribute code. The OpenLayers email lists are the best way to stay current with new developments.

If you are using the GMap module, you will want to understand the Google Maps API. That API has several subsidiary APIs within it. The Web Services API is useful if you want to geocode an address, generate driving directions, or get the elevation of a point. The Maps Image APIs allow you to create an image of a map or Street View and display that on your website without using any JavaScript. Most relevant to the Drupal GMap module, however, is Version 2 of the Google Maps JavaScript API. This is the code that allows you to embed maps on your website using JavaScript, and this is how you can change the way that maps work and what is displayed on them. For example, if you wanted to change the zoom controls of your map from images to text, the instructions and example are in the documentation for map controls. If you wanted to make a map of the world that plays the national anthem of each country you click on, the JavaScript API Reference is where you would look for the code to do this. In addition to that documentation, there is a code playground, where all of the examples are listed and you can view the source code, change that code on the page, and then see how your changes come out on the map. Several books have been written on Google Maps, some of which are listed in Appendix A.

The Future of Mapping with Drupal


There are exciting developments all the time in open source mapmaking, and there is work being done to integrate these into Drupal. The new ideas at the moment are in two main fields: displaying maps and data storage.

There are several new JavaScript libraries for displaying maps, including Leaflet, which was introduced in Library size. The Leaflet project is to make maps display well on both mobile and desktop browsers, and to take advantage of HTML5 to be

Return Main Page Previous Page Next Page

®Online Book Reader