File tree 1 file changed +5
-31
lines changed
1 file changed +5
-31
lines changed Original file line number Diff line number Diff line change @@ -2777,39 +2777,13 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
2777
2777
case 'geojson' :
2778
2778
if ( Trace . isEnabled ( ) ) {
2779
2779
CLog ( CLogTypes . info , 'Mapbox:addSource(): before addSource with geojson' ) ;
2780
+ CLog ( CLogTypes . info , 'Mapbox:addSource(): before adding geoJSON to GeoJsonSource' ) ;
2780
2781
}
2781
2782
2782
- const geojsonString = JSON . stringify ( options . data ) ;
2783
-
2784
- const feature = com . mapbox . geojson . Feature . fromJson ( geojsonString ) ;
2785
-
2786
- if ( Trace . isEnabled ( ) ) {
2787
- CLog ( CLogTypes . info , 'Mapbox:addSource(): adding feature' ) ;
2788
- }
2789
-
2790
- source = new com . mapbox . mapboxsdk . style . sources . GeoJsonSource ( id , feature ) ;
2791
-
2792
- // To support handling click events on lines and circles, we keep the underlying
2793
- // feature.
2794
- //
2795
- // FIXME: There should be a way to get the original feature back out from the source
2796
- // but I have not yet figured out how.
2797
-
2798
- if ( options . data . geometry . type === 'LineString' ) {
2799
- this . lines . push ( {
2800
- type : 'line' ,
2801
- id,
2802
- feature,
2803
- } ) ;
2804
- } else if ( options . data . geometry . type === 'Point' ) {
2805
- // probably a circle
2806
-
2807
- this . circles . push ( {
2808
- type : 'line' ,
2809
- id,
2810
- center : options . data . geometry . coordinates ,
2811
- } ) ;
2812
- }
2783
+ const geoJsonSource = new com . mapbox . mapboxsdk . style . sources . GeoJsonSource ( id ) ;
2784
+ const geoJsonString = JSON . stringify ( options . data ) ;
2785
+ geoJsonSource . setGeoJson ( geoJsonString ) ;
2786
+ source = geoJsonSource ;
2813
2787
2814
2788
break ;
2815
2789
You can’t perform that action at this time.
0 commit comments