Skip to content

Commit 0b8c627

Browse files
committed
enable to run vector format(GeoJSON)
1 parent a6acb0a commit 0b8c627

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/gtt-client/init/layers.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,15 @@ function createLayers(this: any): void {
7676
if (config.source) {
7777
const SourceClass = olSource[config.source as keyof typeof olSource] as typeof olSource.Source;
7878
const sourceOptions = config.source_options;
79+
if (config.format) {
80+
const FormatClass = olFormat[config.format as keyof typeof olFormat] as any;
81+
const formatOptions = config.format_options;
82+
layerOptions['format'] = new FormatClass(formatOptions);
83+
(sourceOptions as { format?: any })['format'] = layerOptions['format'];
84+
}
7985
layerOptions['source'] = new SourceClass(sourceOptions);
8086
}
8187

82-
if (config.format) {
83-
const FormatClass = olFormat[config.format as keyof typeof olFormat] as any;
84-
const formatOptions = config.format_options;
85-
layerOptions['format'] = new FormatClass(formatOptions);
86-
}
8788

8889
const layer = new LayerClass(layerOptions);
8990

0 commit comments

Comments
 (0)