<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal>Hello all,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I’ve looked at Peter Robbins’ example of a
persistent layer using GeoJSON (<a
href="http://maps.peterrobins.co.uk/files/ol6.html">http://maps.peterrobins.co.uk/files/ol6.html</a>)
which is well behaved. I’ve been trying to duplicate the entire structure.
I have my own IIS 7.5 running on Windows 7 which in turn is connected to a SQL
Server 2008 DB. Once I can get OpenLayers to send the right query to IIS, I’ll
be away to the races. Here’s what’s confounding me.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>The working example issues a GET to retieve the GeoJSON data.
The vector layers is defined like this:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>var vectorLayer = new OpenLayers.Layer.Vector("Line
Vectors", {<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>styleMap: sm,<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>eventListeners: {<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'> "featuresadded":
dataLoaded<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'> },<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>strategies: [<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>new
OpenLayers.Strategy.Fixed(),<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>saveStrategy<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>],<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>protocol: new OpenLayers.Protocol.HTTP({<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>url:
"/cgi-bin/fs/workspace/",<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>format: new
OpenLayers.Format.GeoJSON({<o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'>ignoreExtraDims:
true,<o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'>internalProjection:
map.baseLayer.projection,<o:p></o:p></p>
<p class=MsoNormal style='margin-left:1.0in;text-indent:.5in'>externalProjection:
wgs84<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>})<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>})<o:p></o:p></p>
<p class=MsoNormal>});<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>My code only issues an OPTIONS request to the web server,
something the working example never does. If I step through the OpenLayers code
with Firebug, not only do I not see the OPTIONS request, I don’t see anything
hitting the webserver at all. My vector layer is defined like this:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>var vectors = new OpenLayers.Layer.Vector("Vector
Layer", {<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>style: {<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>strokeColor:
"blue",<o:p></o:p></p>
<p class=MsoNormal>
strokeWidth:
3,<o:p></o:p></p>
<p class=MsoNormal>
cursor: "pointer"<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>},<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>eventListeners: {<o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>"featuresadded":
dataLoaded<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>},<o:p></o:p></p>
<p class=MsoNormal> strategies:
[<o:p></o:p></p>
<p class=MsoNormal> new
OpenLayers.Strategy.Fixed(), <o:p></o:p></p>
<p class=MsoNormal> saveStrategy<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'>],<o:p></o:p></p>
<p class=MsoNormal> protocol:
new OpenLayers.Protocol.HTTP({<o:p></o:p></p>
<p class=MsoNormal> url:
"http://10.0.1.26/roads.aspx",<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal> format:
new OpenLayers.Format.GeoJSON({<o:p></o:p></p>
<p class=MsoNormal> ignoreExtraDims:
true,<o:p></o:p></p>
<p class=MsoNormal> internalProjection:
map.baseLayer.projection,<o:p></o:p></p>
<p class=MsoNormal> externalProjection:
wgs84 <o:p></o:p></p>
<p class=MsoNormal style='margin-left:.5in;text-indent:.5in'>})<o:p></o:p></p>
<p class=MsoNormal style='text-indent:.5in'> })<o:p></o:p></p>
<p class=MsoNormal>});<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>If someone can help me understand why OpenLayers is
requesting “OPTIONS” from the server (which I can’t even see
from grepping or stepping through the code), and what I might need to go
in order to get these two piece glued together, I would really appreciate it.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Many thanks in advance,<o:p></o:p></p>
<p class=MsoNormal>Nathan Silver<o:p></o:p></p>
</div>
</body>
</html>