[OpenLayers-Users] FW: OpenLayers Beginners Questions
Gerd Dowideit
gdowidei at bigpond.net.au
Sun Jun 17 00:11:40 EDT 2007
Sorry, had problems with sending this. Gerd
_____
From: Gerd Dowideit [mailto:gdowidei at bigpond.net.au]
Sent: Sunday, June 17, 2007 1:58 PM
To: 'users at openlayers.org'
Subject: OpenLayers Beginners Questions
Hi All,
I am exploring OpenLayers since a few days and encounter typical beginners
problems:
1.
Trying to make use of "Class Documentation"
(http://dev.openlayers.org/docs/overview-tree.html
<blocked::http://dev.openlayers.org/docs/overview-tree.html> ): the docu is
fine, but I do miss information about 'what each entry is good for' and
brief examples about 'how to make use'. A list ordered by purpose of classes
and functions would also be good. Is there such a list which I have not
found yet?
2.
Problem with "var pointLayer = new OpenLayers.Layer.Vector("Point
Layer");" and similar (Line and Polygon): All draw controls seem to draw
points and vertices south-east of where the mouse-click occurred by about
1/2 of the diameter of the drawn Point-Circle. That means all drawn features
are miss-placed. Is this a bug or is it just that I do use the draw feature
wrongly? Source attached below. The website is at this stage not public for
administrative reasons; sorry.
Cheers, Gerd
__________-___________
<html>
<head>
<style type="text/css">
p {
width: 512px;
}
#map {
width: 100%;
height: 100%;
border: 3px solid gray;
}
#controlToggle li {
list-style: none;
}
}
</style>
<script src="./lib/OpenLayers.js"></script>
<script src="Labels.js"></script>
<script type="text/javascript">
<!--
var map, mymouse;
function init(){
// The Map
map = new OpenLayers.Map('map',
{controls: [new OpenLayers.Control.MouseDefaults()] ,
maxResolution: 'auto',
numZoomLevels: 4,
maxExtent: new OpenLayers.Bounds(463934.22,6881911.1,468114.22,6885091.1)});
// ================ Layers ==============================
// The image Base Layer
var topomap = new OpenLayers.Layer.Image(
'Topo Map',
'http://10.0.0.1/www/OL-2-4/Maroon.jpg',
new OpenLayers.Bounds(463934.22,6881911.1,468114.22,6885091.1),
new OpenLayers.Size(1313, 1001),
options);
map.addLayers([topomap]);
// Drawing Layers
var pointLayer = new OpenLayers.Layer.Vector("Point Layer");
map.addLayers([pointLayer]);
var lineLayer = new OpenLayers.Layer.Vector("Line Layer");
map.addLayers([lineLayer]);
var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
map.addLayers([polygonLayer]);
markers = new OpenLayers.Layer.Markers("markers", options);
map.addLayers([markers]);
add_markers();
markers.setVisibility(false);
//=================== Controls =================
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl( new OpenLayers.Control.PanZoomBar() );
// =================== Options ==================
var options = {handlerOptions: {freehand: true}};
drawControls = {
point: new OpenLayers.Control.DrawFeature(pointLayer,
OpenLayers.Handler.Point),
line: new OpenLayers.Control.DrawFeature(lineLayer,
OpenLayers.Handler.Path,options),
polygon: new OpenLayers.Control.DrawFeature(polygonLayer,
OpenLayers.Handler.Polygon,options)
};
for(var key in drawControls) {
map.addControl(drawControls[key]);
}
//=================== Zoom to screen ===================
map.zoomToMaxExtent();
}
//==================================== Functions
==============================
function toggleControl(element) {
for(key in drawControls) {
var control = drawControls[key];
if(element.value == key && element.checked) {
control.activate();
} else {
control.deactivate();
}
}
}
function q11_is(thisform)
{
var Q1_1
with(thisform)
{
Q1_1=value
if(Q1_1==0)
{
Q11_Answer.innerHTML= "<br><br>"
}
else if(Q1_1==1)
{
Q11_Answer.innerHTML= "<br><center><table cellpadding=5
border=1><tr><td>Tool</td><td>Purpose</td></tr><tr><td><img
src='Nav_1.jpg'></td><td
valign=top><b>Pan</b><br>North-South<br>East-West<br><br><b>Zoom</b><br>In<b
r>OUT</td></tr><tr><td><img src='Nav_2.jpg'></td><td><b>Zoom</b> to
Area<br>Shift + drag mouse<br><b>Pan</b><br>Drag with mouse</td></tr><tr><td
colspan=2>Tool active when on light-blue background</td></tr><tr><td
colspan=2>Default: <br><B>Pan</b> by dragging with mouse<br><b>Zoom In</b>:
Double-click on map</td></tr></table></center><br>"
}
else if(Q1_1==2)
{
Q11_Answer.innerHTML= "<br>Click on <img
src='img/layer-switcher-maximize.png'> at the right of the map and
select/deselect layer(s).<br>"
}
else if(Q1_1==3)
{
Q11_Answer.innerHTML= "<br>Feature digitizing is in freehand mode by
default. In freehand mode, the mouse is treated as a pen. Drawing begins on
mouse down, continues with every mouse move, and ends with mouse
up.<br><br>To turn freehand mode off, hold down the shift key while
digitizing. With freehand mode off, one vertex is added with each click and
double-clicks finish drawing. Freehand mode can be toggled on and off at any
time while drawing.<br>"
}
}
}
// -->
</script>
</head>
<body onload="init()" bgcolor=#ddf9f9>
<table border=1 cellpadding=5 width=99%>
<tr>
<td colspan=2><center>
<strong><font face="arial" size="5">Maroon Dam</font></strong></center>
</td>
</tr>
<tr>
<td width=70% height=370 valign=top>
<div id="map"></div>
</td>
<td valign=top>
<center><b>Help</b>
<SELECT Name="Q1_1" onchange="return q11_is(this)">
<OPTION Value=0>Select a Topic</OPTION>
<OPTION Value=1>Navigate</OPTION>
<OPTION Value=2>Layers</OPTION>
<OPTION Value=3>Draw</OPTION>
</select> <br>
</center>
<span id="Q11_Answer"><br><br></span></font>
<hr>
<center><b>Drawing Options</b></center>
<ul id="controlToggle">
<li>
<input type="radio" name="type" value="none" id="noneToggle"
onclick="toggleControl(this);" checked="checked" />
<label for="noneToggle">navigate</label>
</li>
<li>
<input type="radio" name="type" value="point" id="pointToggle"
onclick="toggleControl(this);" />
<label for="pointToggle">draw point</label>
</li>
<li>
<input type="radio" name="type" value="line" id="lineToggle"
onclick="toggleControl(this);" />
<label for="lineToggle">draw line</label>
</li>
<li>
<input type="radio" name="type" value="polygon" id="polygonToggle"
onclick="toggleControl(this);" />
<label for="polygonToggle">draw polygon</label>
</li>
</ul>
<hr>
</td>
</tr>
<tr>
<td>
<b>
<img src="img/marker.png" width="15" alt="" border="0">
Research Projects
<img src="img/marker-blue.png" width="15" alt="" border="0">
Student Projects, Field Study Sites<br>
<img src="img/marker-gold.png" width="15" alt="" border="0">
Institutions &nbs
p;
<img src="img/marker-green.png" width="15" alt="" border="0">
Miscellanious
</b>
<hr>
<center>
<strong><font face="arial" color="#808080" size="-2">
School of Geography, Planning and Architecture, The University of Queensland
</font></strong>
</center>
</td>
<td>
<b>Commands:</b> Click to ...
<div style="background-color:#e3fdf8" onclick="add_labels()">
<center><b>add Lables</b></center></div>
<div style="background-color:#edfe9c" onclick="markers.setVisibility(true)">
<center><b>show Markers</b></center></div>
<div style="background-color:#edfe9c"
onclick="markers.setVisibility(false)">
<center><b>hide Markers</b></center></div>
</td>
</tr>
</table>
</body>
</html>
___________________________________________
Dr Gerd R Dowideit
School of Geography, Planning and Architecture
The University of Queensland
Chamberlain Building, Room 508
phone (07) 3365 3538 (work)
(07) 3289 2325 (home)
e-mail: g.dowideit at uq.edu.au
________________________________________________
Dr Gerd R Dowideit
10 Atanie Court
Wights Mountain, QLD 4520
phone: (07) 3289 2325
e-mail: gdowidei at bigpond.net.au
________________________________________________
Dr Gerd R Dowideit
10 Atanie Court
Wights Mountain, QLD 4520
phone: (07) 3289 2325
e-mail: gdowidei at bigpond.net.au
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070617/4b9aa393/attachment.html
More information about the Users
mailing list