How to do it...

Carry out the following steps:

  1. Create the openlayers.html file and add the <head> and <body> tags. In the <head> tag, import the OpenLayers JavaScript library by executing the following code:
        <!doctype html> 
        <html> 
          <head> 
            <title>OpenLayers Example</title> 
            <script src="http://openlayers.org/api/OpenLayers.js">            </script> 
          </head> 
          <body> 
          </body> 
        </html> 
  1. First, add a <div> element in the <body> tag that will contain the OpenLayers map. The map should be given a width of 900 pixels and a height of 500 pixels, using the following code:
        <div style="width:900px; height:500px" id="map"></div>
  1. Just after the map is placed in <div>, add a JavaScript script and create an OpenLayers map object. In the map constructor parameters, ...

Get PostGIS Cookbook - Second Edition 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.