Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of other map tiles not working #9

Open
gcarrero opened this issue Apr 19, 2017 · 12 comments
Open

Use of other map tiles not working #9

gcarrero opened this issue Apr 19, 2017 · 12 comments

Comments

@gcarrero
Copy link

Hi Allen, thanks for your work in this library. I'm trying to use this in a project but I've found some problems. For example I've found there is some problem using other tiles than default. When you create a Map, using react-openlayers as library, it works with no problem.

<Map>
     <Layers>
         <layer.Tile />
     </Layers>
     <Controls attribution={false} zoom={true}></Controls>
</Map>

But if you use different map tile:

<Map>
     <Layers>
         <layer.Tile source={new ol.source.Stamen({ layer: 'watercolor' })} />
     </Layers>
     <Controls attribution={false} zoom={true}></Controls>
</Map>

It doesn’t load the map and you can see an error in the console like this:

Uncaught TypeError: Cannot read property 'D' of null

Thanks for your help

@allenhwkim
Copy link
Owner

allenhwkim commented Apr 19, 2017

Are you using systemjs? It works with webpack, but could not make it with SystemJS with those error. Could not figure out why.

@gcarrero
Copy link
Author

I'm using webpack. It's very strange because seems a problem with openlayers library. If I debug and while in your class Tile reassign options.source to new source like new ol.source.Stamen({ layer: 'watercolor' }), while in console it works. But if it comes from the props doesn't.

@faeron
Copy link

faeron commented Jul 25, 2017

Same issue here. Using the default tiles it is working. But changing the source to a custom tile server gives me an error. Also using webpack

Uncaught TypeError: a.V is not a function
    at Hv.k.Nf (react-openlayers.umd.js:563)
    at eh (react-openlayers.umd.js:558)
    at Hv.k.Lf (react-openlayers.umd.js:563)
    at react-openlayers.umd.js:562
    at Array.forEach (<anonymous>)
    at D.k.forEach (react-openlayers.umd.js:460)
    at fh.k.Lf (react-openlayers.umd.js:562)
    at G.k.hp (react-openlayers.umd.js:702)
    at G.<anonymous> (react-openlayers.umd.js:689)
k.Nf @ react-openlayers.umd.js:563
eh @ react-openlayers.umd.js:558
k.Lf @ react-openlayers.umd.js:563
(anonymous) @ react-openlayers.umd.js:562
k.forEach @ react-openlayers.umd.js:460
k.Lf @ react-openlayers.umd.js:562
k.hp @ react-openlayers.umd.js:702
(anonymous) @ react-openlayers.umd.js:689

ol

a.V is really not defined. Just by guessing it could be one of the tile functions, that don't seem to be minified, but are called like they were?

Edit:
I got my tryout-project working, by configuring typescript and using src/index.tsx as entrypoint (not the compiled version from dist). I also had to install geo-coder module. Now custom source works. But of course this setup is not usable :)

@faeron
Copy link

faeron commented Jul 25, 2017

I debugged the minified source (formatted) in chrome, and probably found the original openlayers code, causing the problem.
ol2

This looks like the following code https://github.com/openlayers/openlayers/blob/9fc0fb5e74146cd9a0c99926bed1a0f51fc745ad/src/ol/layer/layer.js#L124-L127

This would mean the source.getSourceState() function is not defined (for whatever reason). Hope this helps narrowing down the problem

@shortwavedave
Copy link

I'm having the same problem

@AAllport
Copy link

AAllport commented Sep 2, 2017

I am also having this problem

@matiaslabra
Copy link

+1 😢

@ivesdebruycker
Copy link

I'm guessing it has something to do with the embedded version of Openlayers in this library vs. the project dependency needed for import * as ol from 'openlayers' (because the one in react-openlayer isn't accessible).
Maybe the instance of e.g. ol.source.vector (created with project OL) isn't compatible with the react-openlayer OL, possibly because of different uglification?

This could be fixed if we could use the embedded OL.

@allenhwkim
Copy link
Owner

@ivesdebruycker please make PR if you find a solution. I just try to wrap it, and I am not an openlayer expert. 😢

@allenhwkim allenhwkim mentioned this issue Jan 20, 2018
@martinmcneela
Copy link

@allenhwkim @ivesdebruycker Did you ever get a solution to this? I'm having the same issue.

@ivesdebruycker
Copy link

@martinmcneela I wrote a simple React component, which was sufficient for my needs:
https://gist.github.com/ivesdebruycker/814578d65cea8e6db40d3b54005395cb

@damienzonly
Copy link

anyone found a solution, integrated other components or found a workaround?

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

No branches or pull requests

9 participants