Chapter 5. Extending Map Interactions

The basics of mapping in Drupal are fairly simple: create your configuration in Drupal with PHP; send that configuration to the web browser; do a bit of custom JavaScript processing; and then let your chosen JavaScript library, such as Google Maps, do its magic. How this gets constructed varies from module to module; in the last two chapters we have shown how to build the basic setup with both Location and GMap, and with Geofield and OpenLayers. This chapter will focus on creating richer interactions for your users by adding onto those two architectures. With this understanding, you can do things like animate your map or display a real-time map of Foursquare checkins.

This will involve writing code. We do not expect you to be a Drupal rockstar, but we do make some basic assumptions: you know how to create a simple Drupal module, and you know what a Drupal hook is. The most advanced expectation is that you know the basics of how JavaScript is used in Drupal.

Note

If you have never written a Drupal module, don’t worry, there is help to get you started. Read the Drupal.org documentation on how to write a module. If you are unfamiliar with the Drupal API, there is a complete reference at api.drupal.org. There is no definitive guide to JavaScript in Drupal, but a good place to start is the JavaScript section of Working with the Drupal API.

In this chapter, we will go through an example of extending both the GMap module and OpenLayers module with HTML5 ...

Get Mapping with Drupal now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.