Subscribe to RSS - openlayers

openlayers

OpenLayers Facelift

In the current D7 development branch of the Drupal OpenLayers module there are some really great interface and styling updates that will make maps a lot more exciting and more intuitive to use.

Before

OpenLayers | openlayers-6

After

Clone map geojson | openlayers7

The images above are screenshots (click to expand) of the default maps that currently come with the stable version of the OpenLayers module and library (before) and then new styling for default maps in the development branch (after). Let's go through the changes:

  1. New image set based on MapBox's image set and filled in by ndagire. This is huge! The default image set that comes with the OpenLayers module is pretty ugly; see for yourself.
  2. New default feature styles. This was a no brainer once we got new images. It is much better than that orange color.
  3. Provided markers come with the modules, a combination of ndagire's images and a couple markers I made, the module now comes with some markers out of the box. Besides this being visually exciting, I think it will help people grok the module more easily.
  4. New popup provided by Harris Rashid which goes very well with the new image set.
  5. New map styling to compliment the image set. A little CSS can go a long way.
  6. New Mapquest tiles by default. mikl helped get this tile set into the module core. And though it was tough to let go of the OpenStreetMap default tileset, the MapQuest tiles are actually based off the OpenStreetMap data, don't require a third-party library, are free, and look so much better!
  7. Wrap dateline (not numbered) is when the tiles repeat themselves as they go past the International Date Line which means as you pan east or west, it keeps going. This is a bit nerdy, but it means that the map fills up the area completely and looks much better.

So, all in all, an amazing improvement to what was a mediocre visual experience out of the box. I am really taken back by the contributions of the community to make this happen. And considering that I have talked twice about Making Beautiful Maps in Drupal both here and here, it was about time this became more of a reality.

Map Previews

I have also been adding some interface improvements to the OpenLayers UI module that comes with the main core module. If you look at the After image above, you'll notice it says "Preview". The map building interface now has a preview button so that you can see the map before you even save it (data and all). This is really great, as before you had to save the map, then go to the display page (done with the Views module), just to see if it worked. I can't believe I hadn't done this earlier.

Style Previews

When listing styles in the OpenLayers UI, you will now see a marker preview for the styles with icons, and a little map thumbnail for vector based styling. The icon preview was done by Pol at the OpenLayers Sprint at DrupalCon London. The map thumbnails are actually little OpenLayers maps that show a random place with the style on top.

When editing styles, there is also a larger map to preview the style. This is a larger map, but same principle as the list. This also contains crosshairs so that you can see how the style is centered on the feature it is representing.

Layer Previews

Coming soon. This is not implemented yet, and a bit harder to accomplish as often layers require maps to be certain ways. But I think we can still have this doable for the majority of layers.

Testing

All this work and more is currently in the development branch. There are some known bugs. Any help testing out would be greatly appreciated. Please put any bugs into the issue queue. I am hoping to have some time over Thanksgiving to follow through with this sprint and get out another release (probably the final alpha).

DrupalCamp Spain and OpenLayers Presentation

Last weekend (26-28 Feb 2010) DrupalCamp Spain happened in Barcelona at the great CitiLab (pic), which is where DrupalCon Barcelona happened a few years ago. I don't have the exact numbers in front of me, but there was just about the same number of attendees for the DrupalCon a few years ago as there were for the DrupalCamp just a week ago (before and after)! Drupal is getting huge!

The camp was wonderful. The organizers did a great, professional job. Though my Spanish is not very good at all, all the presenters did a great job and had a nice variety of topics. I met lots of wonderful people, both seasoned Drupal professionals and Drupal first-timers. Unfortunately my trip was short, but I did get to experience some of the beauty of Barcelona. And, of course, there was the poll-dancing Drupal gorilla (pretty standard). Thanks for having me and for all the hard work!

Understanding OpenLayers Presentation

I did a presentation on Understanding OpenLayers and Drupal. I think it went pretty well. I am still getting my sea legs (and by sea legs I mean ability to speak in front of people); but the room was packed, and I got to do my first Prezi presentation. I am pretty pleased with Prezi, though it took some time to put it all together and stop thinking about things so linearly.

Below is an embedded version of the presentation; it actually starts on the second point. This is a presentation based on OpenLayers 2.x which is still in development but doing good thanks to the hard work of the developers. They took video at the camp, so I am assuming one day there will be a video which might help with understanding the presentation some.

Drupal and OpenLayers

We have just released the first beta of the Drupal OpenLayers module. It's been a pretty crazy adventure as to how we got here, and there are still high hopes for the future. This post is going to be a long one, and should give you the complete introduction to this new mapping module for Drupal, and will also build on and borrow from my previous post on building this module.

What is OpenLayers?

OpenLayers is a free, open-source Javascript library that provides an easy interface to bring together any sort of map tiles, markers, features, and other GIS goodness. OpenLayers was initially developed by MetaCarta; it is now a project of the Open Source Geospatial Foundation. Think Google Maps but open-source. The OpenLayers has many examples and a gallery of sites.

Where Drupal Fits In

Drupal is a great content management system and development framework. OpenLayers fits well into this because it basically is a really great visualization tool for content (the most obvious visualization being maps). Drupal can provide the ability to create and management data/content and OpenLayers can be a fun vehicle to displaying that content and provide a rich interface for your users.

Main Features and Modules

The Drupal OpenLayers module is actually a full suite of modules that provide many integration points with other contributed modules.

  • At is core, the OpenLayers API module provides just enough to take a map array in PHP and render it through hooks, pass it to javascript where it can interact with events, and display a working map to the page. The main API module also manages the basics of map presets.
  • The OpenLayers Preset User Interface module provides a web based interface to manage presets. Presets are basically just named map arrays that are either stored in code or in the database. With presets it becomes easy to provide interfaces to pick maps.
  • OpenLayers Layers modules provides a wide range of layers to use outside the simple default, like Yahoo, Google, OpenStreetMap tiles, and more. Layers can be manually put into map arrays, but with hooks, other modules can provided named layers that get put together when the map is rendered.
  • Much like the layers module, the OpenLayers Behaviors module provides a set of behavior add-ons that can easily be added to map arrays. These include things like feature controls, fullscreen controls, popups, and tooltips.
  • On the input side, there is the OpenLayers CCK module which provides integration with OpenLayers and CCK. This module provides a field and widget for basic WKT input, as well as a widget for the Geo module; both of which allow the user to use a map to enter features like points, lines, and polygons. On the formatter side, you can display any preset map for the field.
  • A simple way to display a map is to use the OpenLayers Filter module, which provides an input format filter where a user can input [openlayers preset_name] into the body content of a node and it will be rendered as that map.
  • Finally, there is a Views plugin provided by the OpenLayers Views module that allows the user to aggregate all kinds of Drupal data and put it into a map.

Geo June

June 2009 is Geo June, which is a campaign to organized by Advantage Labs to make a concentrated effort to stabilize the Geo Module and push towards Drupal as a GeoCMS.

What is Geo and Why is it Useful?

Geo is mainly a storage layer to hold geospatial data. What does that mean? Well, we all know about points such as latitude and longitude, but Geo helps to store other data such as lines and polygons.

Geo standardizes how all this data is stored, which is extremely helpful for modules, such as Location to store data and have the heavy lifting done for it, and makes it easy for modules such as Gmap, NIceMap, and Mapstraction to easily retrieve and display that data in lots of fun ways. Geo also provides a database abstraction layer to work with both PostGIS and MySQL Spatial.

Still not convinced of it's awesomeness, well then think Mashups! Though I am not a fan of the term, Map Mashups are all the rage and for good reason (data visualization is a great way to communicate large sets of data). By standardizing Drupal's GIS storage, it will be exponentially easier to integrate (i.e. mashup) data from your site with all those exciting external sources of data. Don't think you can collect geospatial data? Think again, more interweb explorers are becoming a lot more spatially aware and want their data represented in the context of our world. And even with lots of new open data, there are still lots of reasons to store that spatial data directly on your site.

There are many other use cases at this wiki page (feel free to add).

Events and Getting Involved

If you are interested in getting involved, go here. Some of the events going on or ways to participate:

  • Geo June Kickoff Barbecue, June 1: A decidedly offline event in Minneapolis
  • Join the daily IRC Meetups, June 1-30 : Meet in #drupal-geo from 10AM-11AM CST
  • Blog in June about Drupal geo projects and Drupal as a GeoCMS
  • Participate in the community.
  • Participate in the TC Drupal Documentation Sprint. June 20
  • Organize other events locally or online, dealing with any type of Mapping or Geospatial activities in Drupal.
  • Contribute financially
  • Join us at the release party! June 30

OpenLayers

Another goal of Geo June is for the OpenLayers Drupal Module to release a 1.0 (though I would be happy with a beta, personally). We have been really busy developing this module. It's fairly stable at the moment, but needs lots of cleaning up. We welcome testing and reporting bugs.

The Future

Drupal has always been good at being current with new technologies and this is an opportunity to continue that tradition. Geo is the building block for realizing Drupal as a GeoCMS, meaning that Drupal can consume, produce, collect, aggregate, display, cuddle, and mash geospatial data in a user-friendly (and developer-friendly) way. I personally don't know of anything that can currently be compared as a GeoCMS, and even with a stable Geo, we still have a long way to go, but I would love to see Drupal be the first GeoCMS.

Building a Module

I was asked to do a presentation on coding in Drupal for our local Drupal user group. "Coding" is a pretty general topic, and the audience at our user group is pretty varied. So, I was not sure what specifically I should present that would encompass "coding". As the time came along and I had to make a decision, I looked to the module that I currently spend most of my free time developing: OpenLayers.