Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(ogc filter) for Angular 6 and adjustements for minilib (new master branch) #186

Merged
merged 45 commits into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a3b2d8d
refactor(map) a more customizable way to add overlay
Sep 11, 2018
b1e580c
feat(wkt service) refactor and adding ways to return wkt objects
Sep 11, 2018
bce39c2
fix(ogc-fillter interface and class) refactor interfaces and operators
Sep 11, 2018
9dee1e7
refactor(ogc-filter) bing map to ogcfilter.
Sep 11, 2018
9796a1e
(feat) feature color used as a extent (0000 vs gray) and autorefresh
Sep 11, 2018
31b53dd
fix(download-service) with right properties
Sep 11, 2018
570e5ce
feat(ogc-filter) Autorefresh toggle feature extent and bind map
Sep 11, 2018
8030ea6
refactor(wfs) interface for outputFormatDownload
Sep 11, 2018
2abd8be
ui(ogc-filter) updating demo with proper params.
Sep 11, 2018
3c79393
fix(ogc-filter) Moving to angular 6 and selectionChange on select
Sep 11, 2018
e4fb466
i18n(ogc-filter) translation for feature extent.
Sep 11, 2018
5dbd052
feat(ogc-filter-form) AutoRefresh on change, feature extent overlay
Sep 11, 2018
3269064
refactor(*) sourcefields
Sep 12, 2018
c8e0e79
refactor(wms-datasource)managing sourcefield for wms
Sep 12, 2018
b864e7e
refactor(ogc-filter) isOgcFilterable/filtersAreEditable enabled/editable
Sep 12, 2018
e5d7228
fix(wfs) not using filters when filters are disabled.
Sep 12, 2018
aa2993d
refactor(ogc-filter) ogcFilters: {enabled: true,editable: true,...}
Sep 14, 2018
5428c6b
fix(wfs) default value for ogcfilters
Sep 14, 2018
5162ffa
ui(ogc-filter) cleaner example
Sep 18, 2018
e7f9493
ui(ogc-filter) refresh button removed due to autorefresh on change.
Sep 18, 2018
9b6c7f2
feat(ogc-filter) refactor and defining a cleaner way for refresh events
Sep 18, 2018
9f4066e
refactor(*)move wfs-service usage from ogc-filter.service to datasources
Sep 19, 2018
9623c76
fix(wkt-service) Wrong regex. Was excluding some SNRC
Sep 20, 2018
097b7c7
feat(datasource) providing data wfs-service to datasources
Sep 24, 2018
6f48f54
fix(download-service) Adjustement on interface and services params.
Sep 24, 2018
18a15dd
feat(wms wfs) wfs for wms source and common interfaces on wms and wfs
Sep 24, 2018
ea87b1b
fix(filterable-datasource) Let filterable layer apply active filters.
Sep 24, 2018
d141a3c
refactor(ogc-fliter) adjustements for wms with linked wfs
Sep 24, 2018
afce952
fix(ogc-filter) active filter geometry footprint on init
Sep 24, 2018
3df4caf
refactor(ogc-filter) various interfaces
Sep 24, 2018
6613b30
Merge branch 'master' into fixOgcFilter
pelord Sep 28, 2018
8d81b36
fix(ogc-filter) fixing wrong conflict resolution.
Sep 28, 2018
033d0fb
fic(ogc-filter-button) Fix button integration
Oct 10, 2018
7737f71
fix(ogc-filter-button) fix button integration into layer-list
Oct 11, 2018
82fb6aa
fix(ogc-filter-button) download button shown.
Oct 12, 2018
850c528
ui(ogc-filter) hide spatial extent button if no geometry active.
Oct 12, 2018
c697745
fix(ogc-filter-button) fix button integration into layer-list
Oct 15, 2018
e893bd7
Merge branch 'master' into fixOgcFilter
pelord Oct 15, 2018
41796fe
Update layer.component.ts
mbarbeau Oct 15, 2018
74bb16c
Update ogc-filter.component.ts
mbarbeau Oct 15, 2018
07bf5be
Merge branch 'master' into fixOgcFilter
mbarbeau Oct 16, 2018
f93e101
lint code
mbarbeau Oct 16, 2018
1343bbe
Update map.ts
mbarbeau Oct 16, 2018
8e10a3f
remove inused import
mbarbeau Oct 16, 2018
3cb852b
fix position buttons layer
mbarbeau Oct 16, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/src/app/geo/layer/layer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
floatLabel="never">

<ng-template #igoLayerItemToolbar let-layer="layer">
<igo-ogc-filter-button [map]="map" [layer]="layer"></igo-ogc-filter-button>
<igo-metadata-button [layer]="layer"></igo-metadata-button>
<igo-download-button [layer]="layer"></igo-download-button>
</ng-template>
Expand Down
39 changes: 39 additions & 0 deletions demo/src/app/geo/layer/layer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
LayerService,
WMSDataSourceOptions,
LayerOptions,
WFSDataSourceOptions,
OgcFilterableDataSourceOptions,
MetadataLayerOptions
} from '@igo2/geo';

Expand Down Expand Up @@ -47,6 +49,43 @@ export class AppLayerComponent {
);
});

interface WFSoptions
extends WFSDataSourceOptions,
OgcFilterableDataSourceOptions {}

const wfsDatasource: WFSoptions = {
type: 'wfs',
url: 'https://geoegl.msp.gouv.qc.ca/igo2/api/ws/igo_gouvouvert.fcgi',
params: {
featureTypes: 'vg_observation_v_autre_wmst',
fieldNameGeometry: 'geometry',
maxFeatures: 10000,
version: '2.0.0',
outputFormat: 'geojson_utf8',
outputFormatDownload: 'shp'
},
ogcFilters: {
enabled: true,
editable: true,
filters: {
operator: 'PropertyIsEqualTo',
propertyName: 'code_municipalite',
expression: '10043'
}
}
};

this.dataSourceService
.createAsyncDataSource(wfsDatasource)
.subscribe(dataSource => {
const layer: LayerOptions = {
title: 'WFS ',
visible: true,
source: dataSource
};
this.map.addLayer(this.layerService.createLayer(layer));
});

this.layerService
.createAsyncLayer({
sourceOptions: {
Expand Down
2 changes: 2 additions & 0 deletions demo/src/app/geo/layer/layer.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { IgoPanelModule } from '@igo2/common';
import {
IgoMapModule,
IgoLayerModule,
IgoFilterModule,
IgoMetadataModule,
IgoDownloadModule
} from '@igo2/geo';
Expand All @@ -26,6 +27,7 @@ import { AppLayerRoutingModule } from './layer-routing.module';
IgoPanelModule,
IgoMapModule,
IgoLayerModule,
IgoFilterModule,
IgoMetadataModule,
IgoDownloadModule
],
Expand Down
2 changes: 1 addition & 1 deletion demo/src/app/geo/ogc-filter/ogc-filter.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</igo-map-browser>

<igo-panel title="Layers">
<igo-ogc-filterable-list [layers]="map.layers">
<igo-ogc-filterable-list [map]="map" [layers]="map.layers">

</igo-ogc-filterable-list>
</igo-panel>
Expand Down
92 changes: 85 additions & 7 deletions demo/src/app/geo/ogc-filter/ogc-filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import {
IgoMap,
DataSourceService,
LayerService,
WMSDataSourceOptions,
WFSDataSourceOptions,
OgcFilterableDataSourceOptions
WFSDataSourceOptionsParams,
OgcFilterableDataSourceOptions,
AnyBaseOgcFilterOptions
} from '@igo2/geo';

@Component({
Expand Down Expand Up @@ -58,15 +61,43 @@ export class AppOgcFilterComponent {
fieldNameGeometry: 'geometry',
maxFeatures: 10000,
version: '2.0.0',
outputFormat: 'geojson'
outputFormat: 'geojson',
outputFormatDownload: 'SHP' // based on service capabilities
},
isOgcFilterable: true,
sourceFields: [
{ name: 'code_municipalite', alias: '# de la municipalitée' },
{ name: 'date_observation' },
{ name: 'urgence', values: ['immédiate', 'inconnue'] }
],
ogcFilters: {
filtersAreEditable: true,
enabled: true,
editable: true,
filters: {
operator: 'PropertyIsEqualTo',
propertyName: 'code_municipalite',
expression: '10043'
logical: 'Or',
filters: [
{
operator: 'PropertyIsEqualTo',
propertyName: 'code_municipalite',
expression: '10043'
},
{
operator: 'Intersects',
geometryName: 'the_geom',
wkt_geometry: `MULTIPOLYGON(((
-8379441.158019895 5844447.897707146,
-8379441.158019895 5936172.331649357,
-8134842.66750733 5936172.331649357,
-8134842.66750733 5844447.897707146,
-8379441.158019895 5844447.897707146
), (
-8015003 5942074,
-8015003 5780349,
-7792364 5780349,
-7792364 5942074,
-8015003 5942074
)))`
}
] as AnyBaseOgcFilterOptions[]
}
}
};
Expand All @@ -81,5 +112,52 @@ export class AppOgcFilterComponent {
})
);
});

interface WMSoptions
extends WMSDataSourceOptions,
OgcFilterableDataSourceOptions {}

const datasourceWms: WMSoptions = {
type: 'wms',
url: '/geoserver/wms',
urlWfs: '/geoserver/wfs',
params: {
layers: 'water_areas',
version: '1.3.0'
},
ogcFilters: {
enabled: true,
editable: true,
filters: {
operator: 'PropertyIsEqualTo',
propertyName: 'waterway',
expression: 'riverbank'
}
},
sourceFields: [
{ name: 'waterway', alias: 'Chemin d eau' },
{ name: 'osm_id' },
{ name: 'landuse', values: ['yes', 'no'] }
],
paramsWFS: {
featureTypes: 'water_areas',
fieldNameGeometry: 'the_geom',
maxFeatures: 10000,
version: '1.1.0',
outputFormat: 'application/json',
outputFormatDownload: 'application/vnd.google-earth.kml+xml'
} as WFSDataSourceOptionsParams
};

this.dataSourceService
.createAsyncDataSource(datasourceWms)
.subscribe(dataSource => {
this.map.addLayer(
this.layerService.createLayer({
title: 'Geoserver water_areas',
source: dataSource
})
);
});
}
}
1 change: 1 addition & 0 deletions projects/core/src/lib/request/error.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class ErrorInterceptor implements HttpInterceptor {
const translate = this.injector.get(LanguageService).translate;
const message = translate.instant('igo.core.errors.uncaught.message');
const title = translate.instant('igo.core.errors.uncaught.title');
this.httpError.error.caught = true;
this.messageService.error(message, title);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HttpClientModule } from '@angular/common/http';

import { CapabilitiesService } from './capabilities.service';
import { DataSourceService } from './datasource.service';
import { WFSService } from './wfs.service';
import { WFSService } from './datasources/wfs.service';

describe('DataSourceService', () => {
beforeEach(() => {
Expand Down
19 changes: 15 additions & 4 deletions projects/geo/src/lib/datasource/shared/datasource.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
XYZDataSourceOptions,
WFSDataSource,
WFSDataSourceOptions,
WFSService,
WMTSDataSource,
WMTSDataSourceOptions,
WMSDataSource,
Expand All @@ -33,7 +34,10 @@ import {
export class DataSourceService {
public datasources$ = new BehaviorSubject<DataSource[]>([]);

constructor(private capabilitiesService: CapabilitiesService) {}
constructor(
private capabilitiesService: CapabilitiesService,
private wfsDataSourceService: WFSService
) {}

createAsyncDataSource(context: AnyDataSourceOptions): Observable<DataSource> {
if (!context.type) {
Expand Down Expand Up @@ -104,7 +108,9 @@ export class DataSourceService {
private createWFSDataSource(
context: WFSDataSourceOptions
): Observable<WFSDataSource> {
return new Observable(d => d.next(new WFSDataSource(context)));
return new Observable(d =>
d.next(new WFSDataSource(context, this.wfsDataSourceService))
);
}

private createWMSDataSource(
Expand All @@ -114,11 +120,16 @@ export class DataSourceService {
return this.capabilitiesService
.getWMSOptions(context)
.pipe(
map((options: WMSDataSourceOptions) => new WMSDataSource(options))
map(
(options: WMSDataSourceOptions) =>
new WMSDataSource(options, this.wfsDataSourceService)
)
);
}

return new Observable(d => d.next(new WMSDataSource(context)));
return new Observable(d =>
d.next(new WMSDataSource(context, this.wfsDataSourceService))
);
}

private createWMTSDataSource(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export abstract class DataService {
abstract getData(): string;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import olSource from 'ol/source/Source';

import { DataSource } from './datasource';
import { DownloadOptions } from '../../../download/shared/download.interface';

export interface DataSourceOptions {
type?:
Expand All @@ -21,6 +22,8 @@ export interface DataSourceOptions {
// view?: ol.olx.layer.ImageOptions;
// displayField?: string;
ol?: olSource;
sourceFields?: SourceFieldsOptionsParams[];
download?: DownloadOptions;
}

export interface DataSourceLegendOptions {
Expand All @@ -31,3 +34,9 @@ export interface DataSourceLegendOptions {
style?: { [key: string]: string | number };
title?: string;
}

export interface SourceFieldsOptionsParams {
name: any;
alias?: any;
values?: any;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import {
DataSourceLegendOptions
} from './datasource.interface';

// import { DataService } from './data.service';
import { DataService } from './data.service';

export abstract class DataSource {
public id: string;
public ol: olSource;

constructor(
public options: DataSourceOptions = {} // protected dataSourceService?: DataService
public options: DataSourceOptions = {},
protected dataService?: DataService
) {
this.options = options;
this.id = this.generateId();
Expand Down
2 changes: 2 additions & 0 deletions projects/geo/src/lib/datasource/shared/datasources/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './data.service';
export * from './datasource';
export * from './datasource.interface';
export * from './feature-datasource';
Expand All @@ -8,6 +9,7 @@ export * from './xyz-datasource';
export * from './xyz-datasource.interface';
export * from './wfs-datasource';
export * from './wfs-datasource.interface';
export * from './wfs.service';
export * from './wms-datasource';
export * from './wms-datasource.interface';
export * from './wmts-datasource';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ export interface WFSDataSourceOptions
extends DataSourceOptions,
FeatureDataSourceOptions {
// type?: 'wfs';
params: WFSDataSourceOptionsParams;
params: WFSDataSourceOptionsParams; // Used by user
paramsWFS?: WFSDataSourceOptionsParams; // Used by code
urlWfs?: string; // Used by code
}

export interface WFSDataSourceOptionsParams {
version?: string;
featureTypes: string;
fieldNameGeometry: string;
maxFeatures?: Number;
outputFormat?: string;
outputFormat: string;
outputFormatDownload?: string;
srsname?: string;
xmlFilter?: string;
wfsCapabilities?: WFSCapabilitiesParams;
}

export interface WFSCapabilitiesParams {
xmlBody?: string;
GetPropertyValue?: boolean;
}
Loading