public IList <Guid> GetModifiedEntities(string geoJson) { FeatureWithID feature = GeoJSONReader.ReadFeatureWithID(new StringReader(geoJson)); if (String.IsNullOrEmpty(feature.Id)) { return(new List <Guid>()); } return(this.GetModifiedEntities(Guid.Parse(feature.Id), feature.Geometry)); }
public AchsenSegmentModel GenerateAchsenSegmentModelFromGeoJsonString(AchsenSegmentModel model) { string geoJSONString = model.FeatureGeoJSONString; FeatureWithID feature = GeoJSONReader.ReadFeatureWithID(new StringReader(model.FeatureGeoJSONString)); string invertedString = feature.Attributes[geoJSONAttribute_IsInverted] as string; bool? invertedbool = feature.Attributes[geoJSONAttribute_IsInverted] as bool?; model.IsInverted = (invertedString != null && invertedString.ToLower() == "true") || (invertedbool != null && invertedbool == true); //model.IsInverted = (bool)feature.Attributes[geoJSONAttribute_IsInverted]; model.Shape = feature.Geometry; model.Shape.SRID = GisConstants.SRID; return(model); }
public ReferenzGruppeDTO GenerateReferenzGruppeFromGeoJson(string geoJson) { List <FeatureWithID> childs = GeoJSONReader.ReadFeatureWithID(new StringReader(geoJson)).Attributes[geoJSONAttribute_childs] as List <FeatureWithID>; ReferenzGruppeDTO referenzGruppeModel = new ReferenzGruppeDTO(); foreach (FeatureWithID child in childs) { AchsenReferenzDTO newAchsenref = new AchsenReferenzDTO(); newAchsenref.AchsenSegmentDTO = dtoService.GetDTOByID <AchsenSegmentDTO>(Guid.Parse(child.Attributes[geoJSONAttribute_AchsenSegmentId].ToString())); newAchsenref.Shape = child.Geometry; newAchsenref.Shape.SRID = GisConstants.SRID; referenzGruppeModel.AddAchsenReferenz(newAchsenref); } return(referenzGruppeModel); }
private void ApplyGeojson(string geoJson) { if (string.IsNullOrEmpty(geoJson)) { zustandsabschnittViewModel.ReferenzGruppe = null; zustandsabschnittViewModel.Shape = null; } else { zustandsabschnittViewModel.ReferenzGruppe = geoJsonService.GenerateReferenzGruppeFromGeoJson(geoJson); zustandsabschnittViewModel.Shape = GeoJSONReader.ReadFeatureWithID(new StringReader(geoJson)).Geometry; zustandsabschnittViewModel.Shape.SRID = GisConstants.SRID; if (zustandsabschnittViewModel.Shape.IsEmpty) { zustandsabschnittViewModel.Shape = null; } } }
public IAbschnittGISModelBase GenerateModelFromGeoJsonString(IAbschnittGISModelBase model) { string geoJSONString = model.FeatureGeoJSONString; List <FeatureWithID> childs = GeoJSONReader.ReadFeatureWithID(new StringReader(model.FeatureGeoJSONString)).Attributes[geoJSONAttribute_childs] as List <FeatureWithID>; ReferenzGruppeModel referenzGruppeModel = new ReferenzGruppeModel(); foreach (FeatureWithID child in childs) { AchsenReferenzModel newAchsenref = new AchsenReferenzModel(); newAchsenref.AchsenSegmentModel = achsenSegmentService.GetById(Guid.Parse(child.Attributes[geoJSONAttribute_AchsenSegmentId].ToString())); newAchsenref.Shape = child.Geometry; newAchsenref.Shape.SRID = GisConstants.SRID; referenzGruppeModel.AddAchsenReferenz(newAchsenref); } model.Shape = GeoJSONReader.ReadFeatureWithID(new StringReader(model.FeatureGeoJSONString)).Geometry; model.Shape.SRID = GisConstants.SRID; model.ReferenzGruppeModel = referenzGruppeModel; return(model); }