Skip to content

Commit 5d59e6d

Browse files
author
Andrea Barbasso
committed
[UXP-155] fix marker not showing
1 parent 8b7a896 commit 5d59e6d

3 files changed

Lines changed: 4 additions & 12 deletions

File tree

src/app/shared/open-street-map/open-street-map.component.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ import { filter, map, tap } from 'rxjs/operators';
99
import { BehaviorSubject, Observable } from 'rxjs';
1010
import { TranslateService } from '@ngx-translate/core';
1111
import { isNotEmpty } from '../empty.util';
12-
import { latLng, LatLng, Layer, MapOptions, marker, tileLayer } from 'leaflet';
13-
14-
15-
export interface OpenStreetMapPointer {
16-
coordinates: LocationDDCoordinates,
17-
color: string,
18-
}
12+
import { icon, latLng, LatLng, Layer, MapOptions, marker, tileLayer } from 'leaflet';
1913

2014
@Component({
2115
selector: 'ds-open-street-map',
@@ -24,9 +18,6 @@ export interface OpenStreetMapPointer {
2418
})
2519
export class OpenStreetMapComponent implements OnInit {
2620

27-
// Spacial reference identifier
28-
SRID = 'EPSG:4326'; // World Geodetic System 1984
29-
3021
/**
3122
* The width of the map
3223
*/
@@ -175,7 +166,6 @@ export class OpenStreetMapComponent implements OnInit {
175166

176167
this.locationService.findPlaceAndDecimalCoordinates(position).subscribe({
177168
next: (place) => {
178-
console.log('PLACE', place);
179169
this.place.next(place);
180170
},
181171
error: (err) => {
@@ -214,7 +204,9 @@ export class OpenStreetMapComponent implements OnInit {
214204
this.leafletCenter = latLng(+coordinates.latitude, +coordinates.longitude);
215205
this.leafletLayers = [
216206
tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {maxZoom: 18, attribution: 'Leaflet'}),
217-
marker([+coordinates.latitude, +coordinates.longitude])
207+
marker(
208+
[+coordinates.latitude, +coordinates.longitude],
209+
{icon: icon({iconUrl: 'assets/images/marker-icon.png', shadowUrl: 'assets/images/marker-shadow.png'})})
218210
];
219211
}
220212
}

src/assets/images/marker-icon.png

1.43 KB
Loading
618 Bytes
Loading

0 commit comments

Comments
 (0)