Database Reference
In-Depth Information
lessyourunyourGeoServerinstanceusinghttpdURLrewriting,thesolution
istohaveaproxyscriptanduseitinOpenLayersassuggestedhereat
ht-
3. Copy the proxy script
http://trac.osgeo.org/openlayers/browser/trunk/open-
layers/examples/proxy.cgi?format=txt
,
which is included in the topic dataset
as well) to the web
cgi
directory of your computer (in Linux, at
/usr/
lib/cgi-bin/
and in Windows, at
C:\ms4w\Apache\cgi-bin
), open
the proxy.
cgi
file, and add
localhost:8080
to the
allowedHosts
list.
How to do it...
Carry out the following steps:
1. Createthe
openlayers.html
fileandaddthe
<head>
and
<body>
tags.
In the
<head>
tag, import the OpenLayers and GoogleMaps Version 3
JavaScript libraries by executing the following code:
<html>
<head>
<title>OpenLayers Example</title>
<script src="http://openlayers.org/
api/OpenLayers.js"></script>
<script src="http://maps.google.com/
maps/api/js?v=3.2&sensor=false"></script>
</head>
<body>
</body>
</html>
2. First,adda
<div>
elementinthe
<body>
tagthatwillcontaintheOpenLay-
ersmap.Themapshouldbegivenawidthof700pixelsandaheightof400
pixels, using the following code:
<div style="width:700px; height:400px"
id="map"></div>
3. Justafterthemapisplacedin
<div>
,addaJavaScriptscriptandcreatean
OpenLayers
map
object.Inthemapconstructorparameters,youwilladdan