Example #1
0
        public static LayerType AddToCapabilities(this DataSource dataSource, Capabilities capabilities)
        {
            string fileName = dataSource.name;//todo 需处理中文乱码
            string name     = Path.GetFileNameWithoutExtension(fileName);
            string projectionStr;
            double xMin, yMin, xMax, yMax;

            using (var layer = dataSource.GetLayerByIndex(0))
            {
                using (var sr = layer.GetSpatialRef())
                {
                    var ret = sr.ExportToWkt(out projectionStr);
                }
                layer.GetExtent(out xMin, out yMin, out xMax, out yMax);
            }
            LayerType layerType = CapabilitiesHelper.AddToCapabilities(capabilities, name, projectionStr, xMin, yMin, xMax, yMax);

            return(layerType);
        }