Skip to content

Commit 98d1577

Browse files
kekel87davinkevin
authored andcommitted
feat(source): add Image ArcGIS source (#209)
1 parent d789ccf commit 98d1577

File tree

6 files changed

+85
-0
lines changed

6 files changed

+85
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Component, forwardRef, Host, Input, OnInit } from '@angular/core';
2+
import { source, ProjectionLike, Attribution, ImageLoadFunctionType } from 'openlayers';
3+
import { LayerImageComponent } from '../layers/layerimage.component';
4+
import { SourceComponent } from './source.component';
5+
6+
@Component({
7+
selector: 'aol-source-imagearcgisrest',
8+
template: `
9+
<ng-content></ng-content>
10+
`,
11+
providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceImageArcGISRestComponent) }],
12+
})
13+
export class SourceImageArcGISRestComponent extends SourceComponent implements OnInit {
14+
instance: source.ImageArcGISRest;
15+
16+
@Input() projection: ProjectionLike | string;
17+
@Input() url: string;
18+
@Input() attributions: Attribution[];
19+
@Input() crossOrigin?: string;
20+
@Input() imageLoadFunction?: ImageLoadFunctionType;
21+
@Input() params?: { [k: string]: any };
22+
@Input() ratio = 1;
23+
@Input() resolutions?: number[];
24+
@Input() logo?: string | olx.LogoOptions;
25+
26+
constructor(@Host() layer: LayerImageComponent) {
27+
super(layer);
28+
}
29+
30+
ngOnInit() {
31+
this.instance = new source.ImageArcGISRest(this);
32+
this.host.instance.setSource(this.instance);
33+
}
34+
}

projects/ngx-openlayers/src/public_api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { SourceTileJSONComponent } from './lib/sources/tilejson.component';
2323
import { SourceGeoJSONComponent } from './lib/sources/geojson.component';
2424
import { SourceImageStaticComponent } from './lib/sources/imagestatic.component';
2525
import { SourceImageWMSComponent } from './lib/sources/imagewms.component';
26+
import { SourceImageArcGISRestComponent } from './lib/sources/imagearcgisrest.component';
2627
import { SourceRasterComponent } from './lib/sources/raster.component';
2728
import { FeatureComponent } from './lib/feature.component';
2829
import {
@@ -93,6 +94,7 @@ export {
9394
SourceImageStaticComponent,
9495
SourceImageWMSComponent,
9596
SourceRasterComponent,
97+
SourceImageArcGISRestComponent,
9698
FeatureComponent,
9799
GeometryLinestringComponent,
98100
GeometryPointComponent,
@@ -164,6 +166,7 @@ const COMPONENTS = [
164166
SourceGeoJSONComponent,
165167
SourceImageStaticComponent,
166168
SourceImageWMSComponent,
169+
SourceImageArcGISRestComponent,
167170
SourceRasterComponent,
168171
FeatureComponent,
169172
GeometryLinestringComponent,

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { SwipeComponent } from './swipe/swipe.component';
2323
import { OverlayComponent } from './overlay/overlay.component';
2424
import { ColorSelectHoverComponent } from './color-select-hover/color-select-hover.component';
2525
import { MarkerComponent } from './marker/marker.component';
26+
import { ArcgisImageComponent } from './arcgis-image/arcgis-image.component';
2627

2728
@NgModule({
2829
declarations: [
@@ -43,6 +44,7 @@ import { MarkerComponent } from './marker/marker.component';
4344
OverlayComponent,
4445
ColorSelectHoverComponent,
4546
MarkerComponent,
47+
ArcgisImageComponent,
4648
],
4749
imports: [BrowserModule, FormsModule, AppRoutingModule, AngularOpenlayersModule, ReactiveFormsModule],
4850
providers: [],

src/app/app.routing.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { SwipeComponent } from './swipe/swipe.component';
1616
import { OverlayComponent } from './overlay/overlay.component';
1717
import { ColorSelectHoverComponent } from './color-select-hover/color-select-hover.component';
1818
import { MarkerComponent } from './marker/marker.component';
19+
import { ArcgisImageComponent } from './arcgis-image/arcgis-image.component';
1920

2021
const routes: Routes = [
2122
{ path: '', component: ExamplesListComponent },
@@ -37,6 +38,7 @@ const routes: Routes = [
3738
{ path: 'marker', component: MarkerComponent },
3839
{ path: 'cluster', component: ClusterComponent },
3940
{ path: 'raster', component: RasterComponent },
41+
{ path: 'arcgis-image', component: ArcgisImageComponent },
4042
],
4143
},
4244
{ path: '**', redirectTo: '' },
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-root',
5+
template: `
6+
<aol-map>
7+
<aol-interaction-default></aol-interaction-default>
8+
<aol-control-defaults></aol-control-defaults>
9+
<aol-control-fullscreen></aol-control-fullscreen>
10+
<aol-view [zoom]="zoom"> <aol-coordinate [x]="-10997148" [y]="4569099"></aol-coordinate> </aol-view>
11+
<aol-layer-tile> <aol-source-osm></aol-source-osm> </aol-layer-tile>
12+
13+
<aol-layer-image>
14+
<aol-source-imagearcgisrest
15+
projection="EPSG:3857"
16+
url="https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer"
17+
></aol-source-imagearcgisrest>
18+
</aol-layer-image>
19+
</aol-map>
20+
`,
21+
styles: [
22+
`
23+
:host {
24+
display: flex;
25+
}
26+
27+
aol-map {
28+
width: 70%;
29+
height: 100%;
30+
}
31+
`,
32+
],
33+
})
34+
export class ArcgisImageComponent {
35+
public zoom = 4;
36+
public opacity = 1.0;
37+
}

src/app/example-list.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,11 @@ export const examplesList = [
7878
title: 'Raster',
7979
routerLink: 'raster',
8080
},
81+
{
82+
title: 'Image ArcGIS',
83+
description:
84+
'Example of using aol-source-imagearcgisrest. This example display exported image of MapServer ArcGis endpoint.',
85+
routerLink: 'arcgis-image',
86+
openLayersLink: 'https://openlayers.org/en/latest/examples/arcgis-image.html',
87+
},
8188
];

0 commit comments

Comments
 (0)