Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • OpenLayers 2.10 Beginner's Guide
  • Toc
  • feedback
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)
close
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)

Overview of this book

Table of Contents (18 chapters)
close
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for Action – common style examples


Let's take a look at what some of these common properties do through an example. We'll also demonstrate how to use two different intents—the default intent and the selected intent.

  1. Make a copy of the previous example's file. We'll be using the same code, but modifying the feature styles a bit. We'll also use the select intent, so we'll need two style objects. Let's first recreate the default style object:

    var vector_style = new OpenLayers.Style({ 
        'cursor': 'pointer', 
        'fillColor': '#787878', 
        'fillOpacity': .8, 
        'fontColor': '#343434', 
        'pointRadius': 14, 
        'strokeColor': '#232323', 
        'strokeDashstyle': 'dot', 
        'strokeWidth': 3
    });
  2. Now, let's create a style object to use when the feature is selected. We'll change the border to solid, change the fill color, increase the point's radius a little bit, change the graphicName to 'square', and add a label that will display 'X'.

    var vector_style_select = new OpenLayers.Style({ 
    ...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete