예제 #1
0
        private static List <Point> GetPointsFromDbGeometry(DbGeometry geometry)
        {
            // since the bounding box is being sent TO the browser, we better reproject to Web Mercator if necessary
            if (geometry.CoordinateSystemId != CoordinateSystemHelper.WGS_1984_SRID)
            {
                geometry = CoordinateSystemHelper.ProjectCaliforniaStatePlaneVIToWebMercator(geometry);
            }


            var pointList = new List <Point>();

            if (!DbGeometryToGeoJsonHelper.CanParseGeometry(geometry))
            {
                return(pointList);
            }

            var pointCount = geometry.Envelope.ElementAt(1).PointCount.Value;
            var envelope   = geometry.Envelope.ElementAt(1);


            for (var i = 1; i <= pointCount; i++)
            {
                var dbGeometryPoint = envelope.PointAt(i);

                if (!dbGeometryPoint.XCoordinate.HasValue || !dbGeometryPoint.YCoordinate.HasValue)
                {
                    continue;
                }

                pointList.Add(new Point(envelope.PointAt(i).YCoordinate.Value, envelope.PointAt(i).XCoordinate.Value));
            }
            return(pointList);
        }
예제 #2
0
        private static LayerGeoJson GetMatchMakerAreaOfInterestGeoJson(Organization organization)
        {
            LayerGeoJson layer = null;

            // organization boundary layer
            if (organization.UseOrganizationBoundaryForMatchmaker && organization.OrganizationBoundary != null)
            {
                var organizationBoundaryToFeatureCollection = organization.OrganizationBoundaryToFeatureCollection();
                organizationBoundaryToFeatureCollection.Features.ForEach(x => x.Properties.Add("Hover Name", FieldDefinitionEnum.AreaOfInterest.ToType().GetFieldDefinitionLabel()));
                layer = new LayerGeoJson("Organization Boundary",
                                         organizationBoundaryToFeatureCollection, ProjectFirmaModels.Models.Organization.OrganizationAreaOfInterestMapLayerColor, 1,
                                         LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            }

            // custom areas of interest
            if (!organization.UseOrganizationBoundaryForMatchmaker &&
                organization.MatchMakerAreaOfInterestLocations.Any())
            {
                var areaOfInterestLayerGeoJsonFeatureCollection = DbGeometryToGeoJsonHelper.FeatureCollectionFromDbGeometry(organization.MatchMakerAreaOfInterestLocations.Select(x => x.MatchMakerAreaOfInterestLocationGeometry), "Area Of Interest", "User Set");
                areaOfInterestLayerGeoJsonFeatureCollection.Features.ForEach(x => x.Properties.Add("Hover Name", FieldDefinitionEnum.AreaOfInterest.ToType().GetFieldDefinitionLabel()));
                layer = new LayerGeoJson($"{FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()} {FieldDefinitionEnum.AreaOfInterest.ToType().GetFieldDefinitionLabel()} Geometries", areaOfInterestLayerGeoJsonFeatureCollection, ProjectFirmaModels.Models.Organization.OrganizationAreaOfInterestMapLayerColor, 1, LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            }

            return(layer);
        }
예제 #3
0
        public Feature MakeFeatureWithRelevantProperties()
        {
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(DNRUplandRegionLocation);

            feature.Properties.Add("Region", this.GetRegionDisplayNameAsUrl().ToString());
            return(feature);
        }
        public ViewResult InteractionEventDetail(InteractionEventPrimaryKey interactionEventPrimaryKey)
        {
            var interactionEvent = interactionEventPrimaryKey.EntityObject;

            var mapLocationFormID = GetMapLocationFormID(interactionEventPrimaryKey);

            //the following variables are plural because the MapInitJson constructor is expecting List<>s but InteractionEvents only have a single location point associated with them.
            var         layers           = new List <LayerGeoJson>();
            var         locationFeatures = new List <Feature>();
            BoundingBox boundingBox      = null;

            if (interactionEvent.InteractionEventLocationSimple != null)
            {
                locationFeatures.Add(DbGeometryToGeoJsonHelper.FromDbGeometry(interactionEvent.InteractionEventLocationSimple));
                boundingBox = new BoundingBox(new Point(interactionEvent.InteractionEventLocationSimple), 0.5m);
            }

            if (locationFeatures.Any())
            {
                layers.Add(new LayerGeoJson($"{FieldDefinition.InteractionEvent.FieldDefinitionDisplayName} Location",
                                            new FeatureCollection(locationFeatures), "yellow", 1,
                                            LayerInitialVisibility.Show));
            }

            var interactionEventLocationMapInitJson = new MapInitJson($"interactionEvent_{interactionEvent.InteractionEventID}_mapID", 10, layers, boundingBox);
            var viewData = new InteractionEventDetailViewData(CurrentPerson, interactionEvent, mapLocationFormID, interactionEventLocationMapInitJson);

            return(RazorView <InteractionEventDetail, InteractionEventDetailViewData>(viewData));
        }
        public static List <LayerGeoJson> GetBoundaryLayerGeoJson(this IEnumerable <StormwaterJurisdiction> jurisdictions, bool clickThrough)
        {
            var jurisdictionsToShow =
                jurisdictions?.Where(x => x.StormwaterJurisdictionGeometry != null)
                .ToList();

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


            return(jurisdictionsToShow.GroupBy(x => x.Organization.OrganizationType, (organizationType, jurisdictionList) =>
            {
                return new LayerGeoJson(
                    $"{organizationType.OrganizationTypeName} {FieldDefinitionType.Jurisdiction.GetFieldDefinitionLabelPluralized()}",
                    new FeatureCollection(jurisdictionList.Select(x =>
                {
                    var feature = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(x.StormwaterJurisdictionGeometry.Geometry4326);
                    feature.Properties.Add("Organization Name", UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.Organization.OrganizationName).ToHtmlString());
                    feature.Properties.Add("Short Name", UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.Organization.OrganizationName).ToHtmlString());
                    feature.Properties.Add("Target URL", x.GetDetailUrl());
                    return feature;
                }).ToList()),
                    organizationType.LegendColor, 1,
                    LayerInitialVisibility.Show,
                    clickThrough);
            }).ToList());
        }
예제 #6
0
        public static List <Point> GetPointsFromDbGeometry(DbGeometry geometry)
        {
            var pointList = new List <Point>();

            if (!DbGeometryToGeoJsonHelper.CanParseGeometry(geometry))
            {
                return(pointList);
            }

            var pointCount = geometry.Envelope.ElementAt(1).PointCount.Value;
            var envelope   = geometry.Envelope.ElementAt(1);


            for (var i = 1; i <= pointCount; i++)
            {
                var dbGeometryPoint = envelope.PointAt(i);

                if (!dbGeometryPoint.XCoordinate.HasValue || !dbGeometryPoint.YCoordinate.HasValue)
                {
                    continue;
                }

                pointList.Add(new Point(envelope.PointAt(i).YCoordinate.Value, envelope.PointAt(i).XCoordinate.Value));
            }
            return(pointList);
        }
예제 #7
0
        public static List <LayerGeoJson> GetBoundaryLayerGeoJson(this IEnumerable <Organization> organizations)
        {
            var organizationsToShow =
                organizations?.Where(x => x.OrganizationBoundary != null && x.OrganizationType != null)
                .ToList();

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


            return(organizationsToShow.GroupBy(x => x.OrganizationType, (organizationType, organizationList) =>
            {
                return new LayerGeoJson(
                    $"{organizationType.OrganizationTypeName} {FieldDefinition.Organization.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,
                    organizationType.ShowOnProjectMaps ? LayerInitialVisibility.Show : LayerInitialVisibility.Hide);
            }).ToList());
        }
예제 #8
0
        public Feature MakeFeatureWithRelevantProperties()
        {
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(PriorityLandscapeLocation);

            feature.Properties.Add("Priority Landscape", GetDisplayNameAsUrl().ToString());
            return(feature);
        }
        public static LayerGeoJson GetTransectLineLayerGeoJson(this OnlandVisualTrashAssessment onlandVisualTrashAssessment)
        {
            LayerGeoJson transsectLineLayerGeoJson;

            if (onlandVisualTrashAssessment.OnlandVisualTrashAssessmentArea?.TransectLine != null)
            {
                transsectLineLayerGeoJson = onlandVisualTrashAssessment.OnlandVisualTrashAssessmentArea
                                            .GetTransectLineLayerGeoJson();
            }
            else
            {
                var featureCollection = new FeatureCollection();
                var dbGeometry        = onlandVisualTrashAssessment.GetTransect();
                if (dbGeometry == null)
                {
                    return(null);
                }

                var feature = DbGeometryToGeoJsonHelper.FromDbGeometryWithReprojectionCheck(dbGeometry.ToSqlGeometry().MakeValid().ToDbGeometry());
                featureCollection.Features.AddRange(new List <Feature> {
                    feature
                });

                transsectLineLayerGeoJson = new LayerGeoJson("transectLine", featureCollection, "#000000",
                                                             1,
                                                             LayerInitialVisibility.Show);
            }

            return(transsectLineLayerGeoJson);
        }
        public static Feature MakeFeatureWithRelevantProperties(this GeospatialArea geospatialArea)
        {
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(geospatialArea.GeospatialAreaFeature);

            feature.Properties.Add(geospatialArea.GeospatialAreaType.GeospatialAreaTypeName,
                                   geospatialArea.GetDisplayNameAsUrl().ToString());
            return(feature);
        }
예제 #11
0
        public Feature MakeFeatureWithRelevantProperties()
        {
            var sqlGeom = GisFeatureGeometry.ToSqlGeometry().MakeValid();
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(sqlGeom.ToDbGeometryWithCoordinateSystem());

            feature.Properties.Add("GisFeature", GetDisplayNameAsUrl().ToString());
            return(feature);
        }
예제 #12
0
        public ContentResult UpstreamDelineation(TreatmentBMPPrimaryKey treatmentBMPPrimaryKey)
        {
            var dbGeometry = treatmentBMPPrimaryKey.EntityObject.GetCentralizedDelineationGeometry4326(HttpRequestStorage.DatabaseEntities);

            var feature = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(dbGeometry);

            return(Content(JObject.FromObject(feature).ToString(Formatting.None)));
        }
예제 #13
0
 public SearchMapSummaryData(string mapSummaryUrl, DbGeometry geometry, double?latitude, double?longitude, int entityID)
 {
     MapSummaryUrl = mapSummaryUrl;
     GeometryJson  = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(geometry);
     Latitude      = latitude;
     Longitude     = longitude;
     EntityID      = entityID;
 }
예제 #14
0
        private static GeoJSON.Net.Feature.Feature MakeFeatureWithRelevantProperties(County county)
        {
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometryWithReprojectionCheck(county.CountyFeature);

            feature.Properties.Add("State", county.StateProvince.StateProvinceAbbreviation);
            feature.Properties.Add("County", county.CountyName);
            return(feature);
        }
예제 #15
0
        public List <Feature> FocusAreaLocationToFeature()
        {
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(FocusAreaLocation);

            return(new List <Feature> {
                feature
            });
        }
        public static FeatureCollection GetAssessmentAreaFeatureCollection(this OnlandVisualTrashAssessment ovta)
        {
            var featureCollection = new FeatureCollection();
            var parcelGeoms       = ovta.GetParcelsViaTransect().Select(x => x.ParcelGeometry4326).ToList();
            var feature           = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(parcelGeoms.UnionListGeometries());

            featureCollection.Features.Add(feature);
            return(featureCollection);
        }
예제 #17
0
 public static GeoJSON.Net.Feature.FeatureCollection ToGeoJsonFeatureCollection(this IEnumerable <IProjectLocation> projectLocations)
 {
     return(new GeoJSON.Net.Feature.FeatureCollection(projectLocations.Where(x => DbGeometryToGeoJsonHelper.CanParseGeometry(x.ProjectLocationGeometry)).Select(x =>
     {
         var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(x.ProjectLocationGeometry);
         feature.Properties.Add("Info", x.ProjectLocationNotes);
         return feature;
     }).ToList()));
 }
예제 #18
0
        private static GeoJSON.Net.Feature.Feature MakeFeatureWithRelevantProperties(StormwaterJurisdiction stormwaterJurisdiction)
        {
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(stormwaterJurisdiction.StormwaterJurisdictionGeometry.Geometry4326);

            feature.Properties.Add("State", stormwaterJurisdiction.StateProvince.StateProvinceAbbreviation);
            feature.Properties.Add("County/City", stormwaterJurisdiction.Organization.OrganizationName);
            feature.Properties.Add("StormwaterJurisdictionID", stormwaterJurisdiction.StormwaterJurisdictionID);
            return(feature);
        }
예제 #19
0
        public FeatureCollection OrganizationBoundaryToFeatureCollection()
        {
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(OrganizationBoundary);

            feature.Properties.Add(OrganizationType.OrganizationTypeName, OrganizationName);
            return(new FeatureCollection(new List <Feature> {
                feature
            }));
        }
예제 #20
0
        public FeatureCollection FocusAreaLocationToFeatureCollection()
        {
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(FocusAreaLocation);

            //feature.Properties.Add(OrganizationType.OrganizationTypeName, OrganizationName);
            return(new FeatureCollection(new List <Feature> {
                feature
            }));
        }
예제 #21
0
        public ViewResult Detail()
        {
            var tenant                                = HttpRequestStorage.Tenant;
            var tenantAttribute                       = MultiTenantHelpers.GetTenantAttributeFromCache();
            var editBasicsUrl                         = new SitkaRoute <TenantController>(c => c.EditBasics()).BuildUrlFromExpression();
            var editBoundingBoxUrl                    = new SitkaRoute <TenantController>(c => c.EditBoundingBox()).BuildUrlFromExpression();
            var editClassificationSystemsUrl          = new SitkaRoute <TenantController>(c => c.EditClassificationSystems()).BuildUrlFromExpression();
            var editStylesheetUrl                     = new SitkaRoute <TenantController>(c => c.EditStylesheet()).BuildUrlFromExpression();
            var editTenantLogoUrl                     = new SitkaRoute <TenantController>(c => c.EditTenantLogo()).BuildUrlFromExpression();
            var deleteTenantStyleSheetFileResourceUrl = new SitkaRoute <TenantController>(c => c.DeleteTenantStyleSheetFileResource()).BuildUrlFromExpression();
            var deleteTenantSquareLogoFileResourceUrl = new SitkaRoute <TenantController>(c => c.DeleteTenantSquareLogoFileResource()).BuildUrlFromExpression();
            var deleteTenantBannerLogoFileResourceUrl = new SitkaRoute <TenantController>(c => c.DeleteTenantBannerLogoFileResource()).BuildUrlFromExpression();
            var boundingBoxLayer                      = new LayerGeoJson("Bounding Box",
                                                                         new FeatureCollection(new List <TenantAttribute> {
                tenantAttribute
            }.Select(x => DbGeometryToGeoJsonHelper.FromDbGeometry(x.DefaultBoundingBox)).ToList()),
                                                                         FirmaHelpers.DefaultColorRange[0],
                                                                         0.8m,
                                                                         LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var layers = MapInitJson.GetConfiguredGeospatialAreaMapLayers();

            layers.Add(boundingBoxLayer);
            var mapInitJson = new MapInitJson("TenantDetailBoundingBoxMap",
                                              10,
                                              layers,
                                              MapInitJson.GetExternalMapLayers(),
                                              BoundingBox.MakeBoundingBoxFromLayerGeoJsonList(new List <LayerGeoJson> {
                boundingBoxLayer
            }));
            var gridSpec = new DetailGridSpec {
                ObjectNameSingular = "Tenant", ObjectNamePlural = "Tenants", SaveFiltersInCookie = true
            };
            var gridName    = "Tenants";
            var gridDataUrl = new SitkaRoute <TenantController>(c => c.DetailGridJsonData()).BuildUrlFromExpression();
            var costTypes   = HttpRequestStorage.DatabaseEntities.CostTypes.ToList().Count > 0 ? string.Join(", ", HttpRequestStorage.DatabaseEntities.CostTypes.Select(x => x.CostTypeName).ToList()) : null;

            var viewData = new DetailViewData(CurrentFirmaSession,
                                              tenant,
                                              tenantAttribute,
                                              editBasicsUrl,
                                              editBoundingBoxUrl,
                                              deleteTenantStyleSheetFileResourceUrl,
                                              deleteTenantSquareLogoFileResourceUrl,
                                              deleteTenantBannerLogoFileResourceUrl,
                                              EditBoundingBoxFormID,
                                              mapInitJson,
                                              gridSpec,
                                              gridName,
                                              gridDataUrl,
                                              editClassificationSystemsUrl,
                                              editStylesheetUrl,
                                              editTenantLogoUrl,
                                              costTypes);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
예제 #22
0
        public ProjectDto(Project project)
        {
            ProjectID               = project.ProjectID;
            ProjectName             = project.ProjectName;
            PrimaryContact          = project.PrimaryContactPerson?.GetFullNameFirstLast();
            OwnerOrganizationID     = project.GetPrimaryContactOrganization()?.OrganizationID;
            ProjectStage            = project.ProjectStage.ProjectStageDisplayName;
            ImplementationStartYear = project.ImplementationStartYear;
            CompletionYear          = project.CompletionYear;
            var taxonomyTrunks = new List <string> {
                project.TaxonomyLeaf.TaxonomyBranch.TaxonomyTrunk.GetDisplayName()
            };

            if (project.SecondaryProjectTaxonomyLeafs.Any())
            {
                taxonomyTrunks.AddRange(project.SecondaryProjectTaxonomyLeafs.Select(x => x.TaxonomyLeaf.TaxonomyBranch.TaxonomyTrunk.GetDisplayName()));
            }
            TaxonomyTrunks = taxonomyTrunks.Distinct(StringComparer.InvariantCultureIgnoreCase).OrderBy(x => x).ToList();
            var taxonomyLeafs = new List <string> {
                project.TaxonomyLeaf.GetDisplayName()
            };

            if (project.SecondaryProjectTaxonomyLeafs.Any())
            {
                taxonomyLeafs.AddRange(project.SecondaryProjectTaxonomyLeafs.Select(x => x.TaxonomyLeaf.GetDisplayName()));
            }
            TaxonomyLeafs = taxonomyLeafs.OrderBy(x => x).ToList();
            var taxonomyLeafsShortened = new List <string> {
                project.TaxonomyLeaf.TaxonomyLeafCode
            };

            if (project.SecondaryProjectTaxonomyLeafs.Any())
            {
                taxonomyLeafsShortened.AddRange(project.SecondaryProjectTaxonomyLeafs.Select(x => x.TaxonomyLeaf.TaxonomyLeafCode));
            }
            TaxonomyLeafsShortened = taxonomyLeafsShortened.OrderBy(x => x).ToList();
            Classifications        = project.ProjectClassifications.Any() ? project.ProjectClassifications.Select(x => x.Classification.DisplayName).OrderBy(x => x).ToList() : new List <string>();
            var leadEntities = project.ProjectGeospatialAreas.Where(x => x.GeospatialArea.GeospatialAreaType.GeospatialAreaTypeName == "Lead Entity Management Area").ToList();

            LeadEntities       = project.ProjectGeospatialAreas.Any() ? leadEntities.Select(x => x.GeospatialArea.GeospatialAreaShortName).OrderBy(x => x).ToList() : new List <string>();
            DetailUrl          = $"/Project/Detail/{project.ProjectID}";
            EstimatedTotalCost = project.GetEstimatedTotalRegardlessOfFundingType();
            SecuredFunding     = project.GetSecuredFunding();
            TargetedFunding    = project.GetTargetedFunding();
            NoFundingSourceIdentifiedFunding = project.GetNoFundingSourceIdentifiedAmount();
            TotalExpenditures = project.TotalExpenditures;
            if (project.HasProjectLocationPoint(false)) // Don't include private locations in API results
            {
                LocationPointAsGeoJsonFeature = DbGeometryToGeoJsonHelper.FromDbGeometry(project.GetProjectLocationPoint(false));
            }
            LastUpdatedDate = project.LastUpdatedDate;

            ProjectCustomAttributes = project.ProjectCustomAttributes.OrderBy(x => x.ProjectCustomAttributeType.ProjectCustomAttributeTypeName).Select(x => new ProjectCustomAttributeDto(x)).ToList();

            IsActive = project.IsActiveProject();
        }
 public static FeatureCollection ToGeoJsonFeatureCollection(this IEnumerable <IProjectLocation> projectLocations)
 {
     return(new FeatureCollection(projectLocations.Where(x => DbGeometryToGeoJsonHelper.CanParseGeometry(x.GetProjectLocationGeometry())).Select(x =>
     {
         var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(x.GetProjectLocationGeometry());
         var annotation = !string.IsNullOrWhiteSpace(x.Annotation) ? x.Annotation : "No feature info available";
         feature.Properties.Add("Detailed Location Info", annotation);
         return feature;
     }).ToList()));
 }
        public static FeatureCollection SimpleLocationToGeoJsonFeatureCollection(this ProjectUpdate projectUpdate, FirmaSession firmaSession)
        {
            var featureCollection           = new FeatureCollection();
            var userCanViewPrivateLocations = firmaSession.UserCanViewPrivateLocations(projectUpdate);

            if ((projectUpdate.ProjectLocationSimpleType == ProjectLocationSimpleType.PointOnMap || projectUpdate.ProjectLocationSimpleType == ProjectLocationSimpleType.LatLngInput) &&
                projectUpdate.HasProjectLocationPoint(userCanViewPrivateLocations))
            {
                featureCollection.Features.Add(DbGeometryToGeoJsonHelper.FromDbGeometry(projectUpdate.GetProjectLocationPoint(userCanViewPrivateLocations)));
            }
            return(featureCollection);
        }
예제 #25
0
        public static FeatureCollection ToExportGeoJsonFeatureCollection(
            this IEnumerable <TreatmentBMP> treatmentBMPs)
        {
            var featureCollection = new FeatureCollection();

            featureCollection.Features.AddRange(treatmentBMPs.Select(x =>
            {
                var feature = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(x.LocationPoint4326);
                AddAllCommonPropertiesToTreatmentBMPFeature(feature, x);
                return(feature);
            }));
            return(featureCollection);
        }
    public static FeatureCollection ToGeoJsonFeatureCollection(this IEnumerable <OnlandVisualTrashAssessmentObservation> observations)
    {
        var featureCollection = new FeatureCollection();

        featureCollection.Features.AddRange(observations.Select(x =>
        {
            var feature = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(x.LocationPoint4326);
            feature.Properties.Add("ObservationID", x.OnlandVisualTrashAssessmentObservationID);
            feature.Properties.Add("FeatureColor", "#FF00FF");
            feature.Properties.Add("FeatureGlyph", "water");
            return(feature);
        }));
        return(featureCollection);
    }
예제 #27
0
        public static FeatureCollection ToGeoJsonFeatureCollection(this IEnumerable <Models.OnlandVisualTrashAssessmentArea> areas)
        {
            var featureCollection = new FeatureCollection();

            featureCollection.Features.AddRange(areas.Select(x =>
            {
                var feature = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(x.OnlandVisualTrashAssessmentAreaGeometry4326);
                feature.Properties.Add("OnlandVisualTrashAssessmentAreaID", x.OnlandVisualTrashAssessmentAreaID);
                feature.Properties.Add("OnlandVisualTrashAssessmentAreaName", x.OnlandVisualTrashAssessmentAreaName);
                feature.Properties.Add("StormwaterJurisdictionID", x.StormwaterJurisdictionID);
                return(feature);
            }));
            return(featureCollection);
        }
예제 #28
0
        public static List <LayerGeoJson> GetProjectLocationSimpleMapLayer(IProject project)
        {
            var layerGeoJsons = new List <LayerGeoJson>();

            if (project.ProjectLocationPoint != null)
            {
                layerGeoJsons.Add(new LayerGeoJson($"{FieldDefinition.ProjectLocation.GetFieldDefinitionLabel()} - Simple",
                                                   new FeatureCollection(new List <Feature>
                {
                    DbGeometryToGeoJsonHelper.FromDbGeometry(project.ProjectLocationPoint)
                }),
                                                   "#838383", 1, LayerInitialVisibility.Show));
            }
            return(layerGeoJsons);
        }
예제 #29
0
        public static LayerGeoJson MakeTreatmentBMPDelineationLayerGeoJson(TreatmentBMP treatmentBMP)
        {
            Check.Require(treatmentBMP.Delineation?.DelineationGeometry != null, "Tried to build delineation layer when delineation was null");
            var featureCollection = new FeatureCollection();
            var feature           = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(treatmentBMP.Delineation?.DelineationGeometry4326);

            featureCollection.Features.Add(feature);

            var treatmentBMPLayerGeoJson = new LayerGeoJson("Delineation", featureCollection, "blue", 1, LayerInitialVisibility.Show)
            {
                EnablePopups = false
            };

            return(treatmentBMPLayerGeoJson);
        }
예제 #30
0
        public static List <LayerGeoJson> GetProjectLocationSimpleMapLayer(IProject project, bool userCanViewPrivateLocations)
        {
            var layerGeoJsons = new List <LayerGeoJson>();

            if (project.HasProjectLocationPoint(userCanViewPrivateLocations))
            {
                layerGeoJsons.Add(new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()} - Simple",
                                                   new FeatureCollection(new List <Feature>
                {
                    DbGeometryToGeoJsonHelper.FromDbGeometry(project.GetProjectLocationPoint(userCanViewPrivateLocations))
                }),
                                                   "#838383", 1, LayerInitialVisibility.LayerInitialVisibilityEnum.Show));
            }
            return(layerGeoJsons);
        }