I am working on a map with different layers. My goal would be to display the information of the layers with a pop up as explained in the tutorial of openlayer. However testing the code I get as output:
Uncaught TypeError: map.on is not a function
Can anyone help me?
map.on
is not a function means that you have a map variable and it either does not have an on
member, or, if it has, on
is not a function
. Since the error is not telling you that you cannot use .on
of undefined
, we have to assume that map
is either incorrectly initialized or its initialization was not completed yet when you tried to call its on
. This answer cannot give you any further information unless you specify your problem further.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.