Skip to content

Commit

Permalink
Merge pull request #401 from NickPhura/ACRFD-13
Browse files Browse the repository at this point in the history
ACRFD-13: feature model update, unused code cleanup.
  • Loading branch information
NickPhura authored Jun 20, 2019
2 parents 6aaaffc + 5b79a3d commit 5bb7247
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ export class DetailsMapComponent implements AfterViewInit, OnDestroy {
// safety check
this.application.features.forEach(f => {
const feature = JSON.parse(JSON.stringify(f));
// needs to be valid GeoJSON
delete feature.geometry_name;
const featureObj: GeoJSON.Feature<any> = feature;
const layer = L.geoJSON(featureObj);
this.appFG.addLayer(layer);
Expand Down
17 changes: 10 additions & 7 deletions src/app/models/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
// this is the data structure as returned by Tantalis
//
export class Feature {
id: string;
type: string;
geometry: {
type: string;
coordinates: any;
geometries: [
{
type: string;
coordinates: any;
}
];
};
geometry_name: string;
id: string;
properties: {
CODE_CHR_STAGE: string;
CROWN_LANDS_FILE: string;
Expand All @@ -32,13 +37,11 @@ export class Feature {
TENURE_SUBTYPE: string;
TENURE_TYPE: string;
};
type: string;

constructor(obj?: any) {
this.geometry = (obj && obj.geometry) || null;
this.geometry_name = (obj && obj.geometry_name) || null;
this.id = (obj && obj.id) || null;
this.properties = (obj && obj.properties) || null;
this.type = (obj && obj.type) || null;
this.geometry = (obj && obj.geometry) || null;
this.properties = (obj && obj.properties) || null;
}
}
4 changes: 2 additions & 2 deletions src/app/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ export class ApiService {
// Features
//
getFeaturesByTantalisId(tantalisID: number): Observable<Feature[]> {
const fields = ['applicationID', 'geometry', 'geometryName', 'properties', 'type'];
const fields = ['applicationID', 'geometry', 'properties', 'type'];
const queryString = `feature?tantalisId=${tantalisID}&fields=${this.buildValues(fields)}`;
return this.http.get<Feature[]>(`${this.apiPath}/${queryString}`);
}

getFeaturesByApplicationId(applicationId: string): Observable<Feature[]> {
const fields = ['applicationID', 'geometry', 'geometryName', 'properties', 'type'];
const fields = ['applicationID', 'geometry', 'properties', 'type'];
const queryString = `feature?applicationId=${applicationId}&fields=${this.buildValues(fields)}`;
return this.http.get<Feature[]>(`${this.apiPath}/${queryString}`);
}
Expand Down

0 comments on commit 5bb7247

Please sign in to comment.