[mapguide-users] Create feature source
Lee Wade
lee.wade at eurocoast.nsw.gov.au
Tue Nov 23 19:39:18 EST 2010
I am new to MGOS and am having some trouble creating an oracle feature
source in a file called query.aspx that allows a search to be performed
on an oracle table. The query was previously performed on an SDF file. A
copy of the part of the code that creates the feature source is below:
// Create the Feature Source (SDF)
MgFeatureSchema sdfSchema = this.CreateFilterSchema();
MgCreateSdfParams sdfParams = new
MgCreateSdfParams("MAPCS", map.GetMapSRS(), sdfSchema);
featureService.CreateFeatureSource(sdfResId, sdfParams);
// Create the Layer
MgResourceIdentifier layerResId = new
MgResourceIdentifier("Session:" + GetParameter(this.args, "SESSION") +
"//Filter.LayerDefinition");
String layerDefinition =
File.ReadAllText(GetQueryXmlTemplatePath());
layerDefinition = layerDefinition.Replace("%s",
sdfResId.ToString());
MgByteReader reader = new MgByteReader(layerDefinition,
"text/xml");
resourceService.SetResource(layerResId, reader, null);
layer = new MgLayer(layerResId, resourceService);
layer.SetName("_QuerySpatialFilter");
layer.SetLegendLabel("_QuerySpatialFilter");
layer.SetDisplayInLegend(false);
layer.SetSelectable(false);
layers.Insert(0, layer);
}
// Make the layer visible
layer.SetVisible(true);
map.Save(resourceService);
// Add the geometry to the filter feature source
MgPolygon polygon =
this.CreatePolygonFromGeomText(GetParameter(this.args, "GEOMTEXT"));
MgAgfReaderWriter agfWriter = new MgAgfReaderWriter();
MgByteReader byteReader = agfWriter.Write(polygon);
MgPropertyCollection propertyValues = new
MgPropertyCollection();
propertyValues.Add(new MgGeometryProperty("Geometry",
byteReader));
updateCommands.Add(new MgInsertFeatures("Filter",
propertyValues));
featureService.UpdateFeatures(sdfResId, updateCommands,
false);
return result;
}
Can anyone point me in the right direction to research the code to
replace the sdf file with the oracle feature source.
Thank you.
Lee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20101124/ef7fe488/attachment.html
More information about the mapguide-users
mailing list