File tree Expand file tree Collapse file tree 1 file changed +5
-31
lines changed Expand file tree Collapse file tree 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 {
27772777 case 'geojson' :
27782778 if ( Trace . isEnabled ( ) ) {
27792779 CLog ( CLogTypes . info , 'Mapbox:addSource(): before addSource with geojson' ) ;
2780+ CLog ( CLogTypes . info , 'Mapbox:addSource(): before adding geoJSON to GeoJsonSource' ) ;
27802781 }
27812782
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 ;
28132787
28142788 break ;
28152789
You can’t perform that action at this time.
0 commit comments