[mapguide-users] Resample or Clip expression for WMS connection

Sowinski, Keith - DOT Keith.Sowinski at dot.wi.gov
Tue Jun 13 08:43:56 PDT 2023


I am using Autodesk Civil 3D/Map 3D (contains a MapGuide component) and I need to create a custom command to clip or resample raster image via WMS connection. I am a C# developer.
I see the appropriate expression capabilities listed here, but I cannot find any examples how to apply these expressions to the WMS connection.
FDO Developer's Guide: FDO Provider for WMS Capabilities (autodesk.com)<http://docs.autodesk.com/MAP/2014/ENU/Developer_Guides/index.html>

Can anyone provide an example on how to use expressions? This is what I have so far, but don't feel like I'm close.

using Autodesk.Gis.Map.Platform;
using OSGeo.FDO.Commands;
using OSGeo.FDO.Connections;
using OSGeo.FDO.Connections.Capabilities;
using OSGeo.FDO.Expression;
using OSGeo.MapGuide;

namespace MapServices
{
    public class WmsLayer
    {
        public static void ClipMapLayer(string layerName)
        {
            AcMapFeatureService fs = AcMapServiceFactory.GetService(MgServiceType.FeatureService) as AcMapFeatureService;

            //Get the current Map.
            AcMapMap currentMap = AcMapMap.GetCurrentMap();

            //Get the collecton of Map 3D layers
            MgLayerCollection layers = currentMap.GetLayers();
            if (layers.Contains(layerName)) //Make sure the specified Map 3D layer exists
            {
                //Get the specified Map 3D layer with the Raster image.
                MgLayerBase lyr = layers.GetItem(layerName);

                //Get the resource identifier
                MgResourceIdentifier identifier = new MgResourceIdentifier(lyr.FeatureSourceId);

                //Get the FDO connection from the resource
                IConnection con = fs.GetFdoConnection(identifier);

                //I can get the Expression capabilities from the connection, but what do I do with that??
                IExpressionCapabilities expCaps = con.ExpressionCapabilities;
                ExpressionType[] types = expCaps.ExpressionTypes;
                FunctionDefinitionCollection funcs = expCaps.Functions;

                //Is this how to create the expression?
                //How do I pass the inputs into the expression?
                //How is a BLOB created from the raster?
                Expression wmsCmd = Expression.Parse("CLIP(raster, minX, minY, maxX, maxY)");

                //Do I somehow pass the expression into an ICommand???  No idea what command type is correct.
                ICommand cmd = con.CreateCommand(CommandType.CommandType_Select);
            }
        }
    }
}

Thank you for your assistance!


Keith Sowinski, P.E.
Civil 3D Implementation Engineer
Methods Development Unit
WisDOT Bureau of Project Development
Office: (920) 492-4132
wisconsindot.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20230613/6d73084f/attachment.htm>


More information about the mapguide-users mailing list