proj4 is not defined in TiledMapLayer
See original GitHub issue- Browser and version: Any browser you like
- Version of Leaflet (
L.version
): 1.2.0 - Version of esri Leaflet (
L.esri.VERSION
): 2.1.1 - Steps to reproduce the error:
- Use
Leaflet
andesri-leaflet
together withproj4leaflet
proj4leaflet
has a dependency ofproj4
- Import
proj4leaflet
AMD style without importingproj4
manually anywhere else sinceproj4leaflet
will pick it up from dependencies and will work fine
What happens is that when doing this I will get an error on this line https://github.com/Esri/esri-leaflet/blob/master/src/Layers/TiledMapLayer.js#L141 saying Uncaught ReferenceError: proj4 is not defined
.
I was expecting for this to work fine, since only the proj4leaflet
library is dependant on proj4
and esri-leaflet
is not.
It is quite hard to replicate this problem using jsbin
, since I use npm
and package.json
and webpack
.
- Optional: I’m not using the CDN, I’m loading/bundling the library using: Webpack
Adding this as a workaround helps to get it work and no errors are shown, but I think that should not be required for esri-leaflet
to work without issues.
import * as proj4 from 'proj4';
window['proj4'] = proj4;
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Using Proj4js in Openlayers - Proj4js is not defined
I get a javascript error: ReferenceError: Proj4js is not defined . When I look at the source specified at /cdnjs.cloudflare.com/ajax/libs/ ...
Read more >Solved: esri leaflet map services
I've set-up my map how I want it, added a few feature layers and ... tiledMapLayer({ url: 'https://services.geodataonline.no/arcgis/rest/ ...
Read more >Project and display a feature layer | Esri Leaflet
Project and display a feature layer. You can project a feature layer using non-Mercator tiles using L.esri.TiledMapLayer and the Proj4Leaflet plugin.
Read more >babeljs - Openlayers proj not defined issue - Stack Overflow
Openlayers (5.1.3) app bundled with browserify and babel: import {Map, View} from 'ol'; import TileLayer from 'ol/layer/Tile'; import OSM from ' ...
Read more >TiledMapLayer - FDOT GIS Framework
new TiledMapLayer(options: TiledMapLayerOptions): TiledMapLayer. Overrides TileLayer.constructor. Defined in src/typings/leaflet/esrileaflet.d.ts:129 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
thanks for the report. i’ll have to think about how we might make this check more friendly for bundlers.
luckily the issue is pretty benign (ie: we’re just logging an irrelevant error in the console in some situations where
proj4
is available).Yeap, you are right, we did use dynamicMapLayer and had issues…not sure if it was performance I have notified the data provider, thank you.