[mapguide-users] WFS Connection from OpenLayers
Rich Bauer
rdbauer at gmail.com
Fri Jun 14 10:39:05 PDT 2013
FYI...I also posted in the OpenLayers list because I am not sure now if it
is OpenLayers or MapGuide related.
OpenLayers link:
http://osgeo-org.1560.x6.nabble.com/Connecting-to-MapGuide-via-WFS-td5060238.html
On Fri, Jun 14, 2013 at 12:14 PM, Rich Bauer <rdbauer at gmail.com> wrote:
> Update...
>
> 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:
>
> var wmsParcels = new OpenLayers.Layer.WMS("Parcels",
> "
> http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin
> ",
> { layers: 'Samples/Sheboygan/Layers/Parcels', transparent: true },
> { isBaseLayer: false, transitionEffect: 'resize', format:
> 'image/png' }
> //{ projection: new OpenLayers.Projection('EPSG:900913') }
> );
>
> map.addLayer(wmsParcels);
>
> var wfsParcels = new OpenLayers.Layer.Vector("WFS Parcels", { protocol:
> new OpenLayers.Protocol.WFS.fromWMSLayer(wmsParcels) });
>
> map.addLayers([select, wfsParcels]);
>
> With this there are no errors showing up in Chrome.
>
>
>
> On Fri, Jun 14, 2013 at 7:37 AM, RDBauer <rdbauer at gmail.com> wrote:
>
>> All,
>>
>> I have searched the list and Google and have not been able to find what I
>> need. I am trying to connect to MapGuide (2.5 on test machine but 2.2 on
>> production machine right now) from OpenLayers 2.12. I know that it would
>> be
>> easier to use Fusion, but it currently doesn't have the support for Mobile
>> and that is what I need. Also, I can't use PHP or .NET for any code
>> because
>> it will be packaged in PhoneGap for a mobile app. Right now I am just
>> trying
>> to connect to the sample dataset to get things working and also, by actual
>> data will most likely be served as the same WGS projection. My current
>> code
>> is:
>>
>>
>> /map = new OpenLayers.Map({
>> div: "map",
>> theme: null,
>> projection: osmProj,
>> displayProjection: wgs,
>> maxExtent: extent,
>> scales: tempScales,
>> controls: [
>> new OpenLayers.Control.Attribution(),
>> new OpenLayers.Control.TouchNavigation({ dragPanOptions: {
>> enableKinetic: true } }),
>> //new
>> OpenLayers.Control.Scale(document.getElementById("mapScale"))
>> geolocate
>> //selectControl
>> ]
>> });
>>
>> var layer = new OpenLayers.Layer.MapGuide("Sheboygan Tiled Layer", url,
>> params, options);
>>
>> var wfsParcels = new OpenLayers.Layer.Vector("WFS Parcels", {
>> strategies: [new OpenLayers.Strategy.Fixed()],
>> protocol: new OpenLayers.Protocol.WFS({
>> //version: "1.1.0",
>> srsName: "EPSG:4326",
>> url:
>> "
>> http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin
>> ",
>> featureType: "ns34414117:ParcelsType",
>> featureNS: "http://www.opengis.net/gml",
>> geometryName: "SHPGEOM"
>> }),
>> styleMap: new OpenLayers.StyleMap({
>> strokeWidth: 3,
>> strokeColor: "#333333"
>> })
>> //projection: wgs
>> });
>>
>> map.addLayer(layer);
>> map.addLayer(wfsParcels);
>> map.zoomToExtent(extent);/
>>
>> With this current code, I get the following error in Chrome Developer
>> Tools:
>>
>> /Failed to load resource: Origin null is not allowed by
>> Access-Control-Allow-Origin.
>>
>> http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin
>>
>> XMLHttpRequest cannot load
>>
>> http://localhost/mapguide/mapagent/mapagent.fcgi?USERNAME=Administrator&Password=admin
>> .
>> Origin null is not allowed by Access-Control-Allow-Origin. index.html:1/
>>
>> Things I am not sure about if they are correct are the "featureType" &
>> "featureNS". I got those from the GETCAPABILITIES command. Any thoughts?
>>
>> Thanks,
>> Rich
>>
>>
>>
>> --
>> View this message in context:
>> http://osgeo-org.1560.x6.nabble.com/WFS-Connection-from-OpenLayers-tp5060185.html
>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20130614/f2523c99/attachment.html>
More information about the mapguide-users
mailing list