<div dir="ltr">Update...<div><br></div><div style>I stumbled across something that creates the WFS connection from a WMS Layer. I tried this earlier but evidently had the code wrong. Both layers show up in the Layers panel as it is added to the map, but the WMS layer shows up and the created WFS does not. Code below:</div>
<div style><br></div><div style><div>var wmsParcels = new OpenLayers.Layer.WMS("Parcels",</div><div> "<a href="http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin">http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin</a>",</div>
<div> { layers: 'Samples/Sheboygan/Layers/Parcels', transparent: true },</div><div> { isBaseLayer: false, transitionEffect: 'resize', format: 'image/png' }</div><div> //{ projection: new OpenLayers.Projection('EPSG:900913') }</div>
<div> );</div><div><br></div><div>map.addLayer(wmsParcels);<br></div><div><br></div><div>var wfsParcels = new OpenLayers.Layer.Vector("WFS Parcels", { protocol: new OpenLayers.Protocol.WFS.fromWMSLayer(wmsParcels) });<br>
</div><div><br></div><div>map.addLayers([select, wfsParcels]);<br></div><div><br></div><div style>With this there are no errors showing up in Chrome.</div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Jun 14, 2013 at 7:37 AM, RDBauer <span dir="ltr"><<a href="mailto:rdbauer@gmail.com" target="_blank">rdbauer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
All,<br>
<br>
I have searched the list and Google and have not been able to find what I<br>
need. I am trying to connect to MapGuide (2.5 on test machine but 2.2 on<br>
production machine right now) from OpenLayers 2.12. I know that it would be<br>
easier to use Fusion, but it currently doesn't have the support for Mobile<br>
and that is what I need. Also, I can't use PHP or .NET for any code because<br>
it will be packaged in PhoneGap for a mobile app. Right now I am just trying<br>
to connect to the sample dataset to get things working and also, by actual<br>
data will most likely be served as the same WGS projection. My current code<br>
is:<br>
<br>
<br>
/map = new OpenLayers.Map({<br>
div: "map",<br>
theme: null,<br>
projection: osmProj,<br>
displayProjection: wgs,<br>
maxExtent: extent,<br>
scales: tempScales,<br>
controls: [<br>
new OpenLayers.Control.Attribution(),<br>
new OpenLayers.Control.TouchNavigation({ dragPanOptions: {<br>
enableKinetic: true } }),<br>
//new<br>
OpenLayers.Control.Scale(document.getElementById("mapScale"))<br>
geolocate<br>
//selectControl<br>
]<br>
});<br>
<br>
var layer = new OpenLayers.Layer.MapGuide("Sheboygan Tiled Layer", url,<br>
params, options);<br>
<br>
var wfsParcels = new OpenLayers.Layer.Vector("WFS Parcels", {<br>
strategies: [new OpenLayers.Strategy.Fixed()],<br>
protocol: new OpenLayers.Protocol.WFS({<br>
//version: "1.1.0",<br>
srsName: "EPSG:4326",<br>
url:<br>
"<a href="http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin" target="_blank">http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin</a>",<br>
featureType: "ns34414117:ParcelsType",<br>
featureNS: "<a href="http://www.opengis.net/gml" target="_blank">http://www.opengis.net/gml</a>",<br>
geometryName: "SHPGEOM"<br>
}),<br>
styleMap: new OpenLayers.StyleMap({<br>
strokeWidth: 3,<br>
strokeColor: "#333333"<br>
})<br>
//projection: wgs<br>
});<br>
<br>
map.addLayer(layer);<br>
map.addLayer(wfsParcels);<br>
map.zoomToExtent(extent);/<br>
<br>
With this current code, I get the following error in Chrome Developer Tools:<br>
<br>
/Failed to load resource: Origin null is not allowed by<br>
Access-Control-Allow-Origin.<br>
<a href="http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin" target="_blank">http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin</a><br>
<br>
XMLHttpRequest cannot load<br>
<a href="http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin" target="_blank">http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin</a>.<br>
Origin null is not allowed by Access-Control-Allow-Origin. index.html:1/<br>
<br>
Things I am not sure about if they are correct are the "featureType" &<br>
"featureNS". I got those from the GETCAPABILITIES command. Any thoughts?<br>
<br>
Thanks,<br>
Rich<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/WFS-Connection-from-OpenLayers-tp5060185.html" target="_blank">http://osgeo-org.1560.x6.nabble.com/WFS-Connection-from-OpenLayers-tp5060185.html</a><br>
Sent from the MapGuide Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
mapguide-users mailing list<br>
<a href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapguide-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><br>
</blockquote></div><br></div>