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 1
1
import mapboxgl from 'mapbox-gl' ;
2
2
3
+ const equivalenceMap = {
4
+ 'EPSG:4490' : 'EPSG:4326' ,
5
+ 'EPSG:4326' : 'EPSG:4490' ,
6
+ 'EPSG:3857' : 'EPSG:900913' ,
7
+ 'EPSG:900913' : 'EPSG:3857'
8
+ } ;
3
9
export class CRSManager {
4
10
constructor ( proj4 ) {
5
11
this . proj4 = proj4 ;
6
12
this . builtInEPSG = [ 'EPSG:3857' , 'EPSG:4326' ] ;
7
13
}
8
14
9
15
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 ) ;
11
19
}
12
20
13
21
getProj4 ( ) {
Original file line number Diff line number Diff line change @@ -318,6 +318,8 @@ describe('mapboxgl-webmap3.0', () => {
318
318
existedMap . on ( 'load' , function ( ) {
319
319
mapstudioWebmap . initializeMap ( nextMapInfo , existedMap ) ;
320
320
} ) ;
321
+ const isSameCrs = extendOptions . crsManager . isSameProjection ( existedMap , 'EPSG:4326' ) ;
322
+ expect ( isSameCrs ) . toBe ( true ) ;
321
323
mapstudioWebmap . on ( 'mapcreatesucceeded' , ( { map } ) => {
322
324
expect ( mapstudioWebmap . _appendLayers ) . toBe ( true ) ;
323
325
expect ( map ) . toEqual ( existedMap ) ;
You can’t perform that action at this time.
0 commit comments