Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Uncaught Error createLeafletElement() must be implemented #1

Open
uptonking opened this issue Mar 8, 2017 · 2 comments
Open

Uncaught Error createLeafletElement() must be implemented #1

uptonking opened this issue Mar 8, 2017 · 2 comments

Comments

@uptonking
Copy link

I used this lib and run the example demo:

git clone https://github.com/Charmatzis/react-leaflet-shapefile.git
npm install
npm run example

the map dispalys successfully, but When I upload the sample .zip, the error shows in developer console.

Uncaught Error: createLeafletElement() must be implemented
    at ShapeFile.createLeafletElement (MapLayer.js:54)
    at ShapeFile.componentWillMount (MapLayer.js:66)
    at ShapeFile.componentWillMount (ShapeFile.js:12)
    at ReactCompositeComponent.js:348
    at measureLifeCyclePerf (ReactCompositeComponent.js:75)
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:347)
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:258)
    at Object.mountComponent (ReactReconciler.js:46)
    at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:371)
    at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:258)

It seems to be the problem with the change react-leaflet api, would you please update react-leaflet-shapefile to react-leafletv1.1.0 or later.
thanks

@Charmatzis
Copy link
Owner

Well, as far as I remember the upload of the zip file happens with a worker,
https://github.com/Charmatzis/react-leaflet-shapefile/blob/master/src/leaflet.shpfile.js#L18

so if you want to load a shp file at default, you have to change it so when the page initializes the worker will load the data.

@uptonking
Copy link
Author

@Charmatzis , thanks a lot. that solved my 2nd questions.
Would you please update the react-leaflet from 1.0.1 to 1.1.0 in package.json, the api has a sight change so the examples didn't work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants