Map website with multiple layers: introducing OpenLayers modules

KJ
by Kevin Jheng10 views·Updated Oct 15, 2011
Powered by AI

Need to present on this topic?

Create your own polished presentation in minutes. Just describe what you need.

Free to try, no credit card required

Transcript

  • The OpenLayers Module and its submodules bring the OpenLayers JS library into Drupal.
  • Combine maps from different map providers with data from Views and CCK input.
  • The OpenLayers JavaScript library is open source, making it flexible and capable across standards as well as proprietary APIs.

Anyway, you need something other than google map

  • Create a new view.
  • Add appropriate filters (example: published, content type)
  • Add your geofield, a field for title, a field for description
  • Change the Format (Style) to "OpenLayers Data Overlay"
  • Choose your Map Data Sources from the fields you added
  • Add a new display to your view: choose "OpenLayers Data Overlay"
  • Save your view.
  • Create a base map. Start by cloning the "Default Map"
  • On the "Layers & Styles" tab, locate the "Overlay layers" section at the bottom of the page, and you should see the view overlay display created in the previous step. Check the boxes for enabled and activated
  • Optionally add behaviors for the map
  • Edit your view, created in the first step.
  • Create a second view display (page, content pane, block)
  • Change the Format (style) of only your new display to "OpenLayers Map"
  • From the "Map" drop-down, select the map created in the previous step.
  • One content type for one feature type (point, path, polygon)
  • Use Views + Taxonomy to make the varieties of information
  • Use Views + Preset + style to impelement a richful multiple layers map

2011/10/15 Drupal Taiwan Meetup

Kai-Yuan Jheng

id: TKY

Twitter: @philtky

Map website with multiple layers: introducing OpenLayers modules

Such like...

The good old days were gone...

When will you need it?

You want to implement a map-orientated functionality in your website and...

Your client is picky...

You lost your mind...

Your boss is crazy

Eew~! I don't like google map, it is tasteless to me! Give me something else!

I want a map wesite without google map tomorrow. Isn't it a good idea? Heah, heah!

I can create a map website without google map!

I am the king of the world!

Concept

http://openlayers.org/dev/examples/

How to do it

Customized

Layer

See the difference

Enable the new layer in preset

Enable the new style in preset

Style

See the difference

Configure a map preset

OpenLayers

preset

Required modules

  • OpenLayers: OpenLayers, Openlayers UI, OpenLayers Views, OpenLayers CCK
  • CTools
  • Views: Views, Views UI
  • CCK: Content, Number

Add geo data to node

Display the map through Views.

  • Gmap + Location: Location CCK
  • Geofield (7.x only)
  • OpenLayers CCK (6.x only)

Make a data overlay layer in Views

Note

CCK

Views

Views again!