File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/mapboxgl/mapping/webmap Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 11import mapboxgl from 'mapbox-gl' ;
22
3+ const equivalenceMap = {
4+ 'EPSG:4490' : 'EPSG:4326' ,
5+ 'EPSG:4326' : 'EPSG:4490' ,
6+ 'EPSG:3857' : 'EPSG:900913' ,
7+ 'EPSG:900913' : 'EPSG:3857'
8+ } ;
39export class CRSManager {
410 constructor ( proj4 ) {
511 this . proj4 = proj4 ;
612 this . builtInEPSG = [ 'EPSG:3857' , 'EPSG:4326' ] ;
713 }
814
915 isSameProjection ( map , epsgCode ) {
10- return map . getCRS ( ) . epsgCode === epsgCode ;
16+ const mapEpsgCode = map . getCRS ( ) . epsgCode ;
17+ return mapEpsgCode === epsgCode ||
18+ ( equivalenceMap [ mapEpsgCode ] === epsgCode && equivalenceMap [ epsgCode ] === mapEpsgCode ) ;
1119 }
1220
1321 getProj4 ( ) {
Original file line number Diff line number Diff line change @@ -318,6 +318,8 @@ describe('mapboxgl-webmap3.0', () => {
318318 existedMap . on ( 'load' , function ( ) {
319319 mapstudioWebmap . initializeMap ( nextMapInfo , existedMap ) ;
320320 } ) ;
321+ const isSameCrs = extendOptions . crsManager . isSameProjection ( existedMap , 'EPSG:4326' ) ;
322+ expect ( isSameCrs ) . toBe ( true ) ;
321323 mapstudioWebmap . on ( 'mapcreatesucceeded' , ( { map } ) => {
322324 expect ( mapstudioWebmap . _appendLayers ) . toBe ( true ) ;
323325 expect ( map ) . toEqual ( existedMap ) ;
You can’t perform that action at this time.
0 commit comments