import {Component} from '@angular/core'; import {template} from './app.template'; import {style} from './app.style'; // import {OwsSearchService} from './mocks/search/ows-search.service'; import {OwsSearchService} from './search/ows-search.service'; import {ISearchFilter, IEsSearchFilter} from './search/search-filter'; import {PouchDBService} from './database/pouchdb.service'; import {EsSearchService} from './search/es-search.service'; import * as turf from 'turf'; @Component( { selector: 'my-app', template: template, styles: [style], providers: [OwsSearchService, PouchDBService, EsSearchService] } ) export class AppComponent { private testDocType: string = 'pooling'; private testSearch: ISearchFilter = { aoi: '-97.6461801261424 35.1198437251722,' + '-97.3863679687645 35.1198437251722,' + '-97.3863679687645 35.3796558825501,' + '-97.6461801261424 35.3796558825501,' + '-97.6461801261424 35.1198437251722', timePeriod: '1-year' }; constructor( private searchService: OwsSearchService, private esSearchService: EsSearchService, private db: PouchDBService) {} onClick(): void { this.searchService.get(this.testDocType, this.testSearch) .subscribe(result => console.log(result)); } otcProd(): void { const coords = [[ [-97.6461801261424, 35.1198437251722], [-97.3863679687645, 35.1198437251722], [-97.3863679687645, 35.3796558825501], [-97.6461801261424, 35.3796558825501], [-97.6461801261424, 35.1198437251722] ]]; const geoJsonAoi = turf.polygon(coords); const searchFilter: IEsSearchFilter = { aoi: geoJsonAoi, dateQuery: 'now-10y' }; this.esSearchService.get('production', searchFilter) .subscribe(result => console.log(result)); } // getPoints(): void { // this.searchService.get(this.testDocType, this.testSearch) // .subscribe(result => { // console.log(result.getProperties('kml_centroid')) // }); // } // // getPolygons(): void { // this.searchService.get(this.testDocType, this.testSearch) // .subscribe(result => // console.log(result.getProperties('kml_polygon', // 'kml_centroid'))); // } testDatabase(): void { console.log(this.db); } }