コード例 #1
0
        public static List <LayerGeoJson> GetConfiguredBoundaryLayersGeoJson(this IEnumerable <Organization> organizations)
        {
            var organizationsToShow =
                organizations?.Where(x => x.OrganizationBoundary != null && x.OrganizationType != null && x.OrganizationType.ShowOnProjectMaps).
                OrderBy(x => x.OrganizationName).ToList();

            if (organizationsToShow == null || !organizationsToShow.Any())
            {
                return(new List <LayerGeoJson>());
            }


            return(organizationsToShow.GroupBy(x => x.OrganizationType, (organizationType, organizationList) =>
            {
                return new LayerGeoJson(
                    $"{organizationType.OrganizationTypeName} {FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabelPluralized()}",
                    new FeatureCollection(organizationList.Select(organization =>
                {
                    var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(organization.OrganizationBoundary);
                    feature.Properties.Add("Hover Name", UrlTemplate.MakeHrefString(organization.GetDetailUrl(), organization.OrganizationShortName).ToHtmlString());
                    feature.Properties.Add(organizationType.OrganizationTypeName, UrlTemplate.MakeHrefString(organization.GetDetailUrl(), organization.OrganizationName).ToHtmlString());
                    return feature;
                }).ToList()),
                    organizationType.LegendColor, 1,
                    LayerInitialVisibility.GetInitialVisibility(organizationType.LayerOnByDefault)
                    );
            }).ToList());
        }
コード例 #2
0
ファイル: MapInitJson.cs プロジェクト: sitkatech/alevin
        public static List <LayerGeoJson> GetAllGeospatialAreaMapLayersForFullProjectMap()
        {
            var geospatialAreaTypes = HttpRequestStorage.DatabaseEntities.GeospatialAreaTypes.OrderBy(x => x.GeospatialAreaTypeName)
                                      .ToList();
            var layerGeoJsons = new List <LayerGeoJson>();

            foreach (var geospatialAreaType in geospatialAreaTypes)
            {
                layerGeoJsons.Add(geospatialAreaType.GetGeospatialAreaWmsLayerGeoJson("#59ACFF", 0.2m,
                                                                                      LayerInitialVisibility.GetInitialVisibility(geospatialAreaType.OnByDefaultOnProjectMap)));
            }

            return(layerGeoJsons);
        }