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

Cannot read properties of null (reading 'containerPointToLayerPoint') #112

Open
abhishek73magar opened this issue Apr 11, 2024 · 0 comments

Comments

@abhishek73magar
Copy link

my code:


  useEffect(() => {
    if (map) {
      // const url = `https://onaci.github.io/leaflet-velocity/wind-global.json`;
      const url = 'http://localhost:3000/wind.json'
      axios
        .get(url, { withCredentials: false })
        .then((res) => {
          console.log(res);
          console.count('run:')
          if(windRef.current) {
            map.removeLayer(windRef.current)
          }
          windRef.current = new L.velocityLayer({
            displayValues: true,
            displayOptions: {
              velocityType: "Wind",
              position: "bottomleft",
              emptyString: "No Wind data",
              showCardinal: true,
              speedUnit: "ms",
            },
            data: res.data,
            maxVelocity: 25,
            velocityScale: 0.01, // arbitrary default 0.005

            // colorScale: ["red", "blue"],
            paneName: "Wind Overlay Pane",
          })
          map.addLayer(windRef.current)
          console.log('--------done--------')
        })
        .catch((err) => console.error(err));
    }
  }, [map]);

  return null;
};

while removeing layer from map got error

Cannot read properties of null (reading 'containerPointToLayerPoint')
TypeError: Cannot read properties of null (reading 'containerPointToLayerPoint')
    at NewClass._onLayerDidMove (http://localhost:3000/static/js/vendors-node_modules_leaflet-velocity_dist_leaflet-velocity_js-node_modules_react-leaflet_lib-c3c173.chunk.js:53:29)
    at http://localhost:3000/static/js/vendors-node_modules_leaflet-velocity_dist_leaflet-velocity_js-node_modules_react-leaflet_lib-c3c173.chunk.js:86:12

is any once encounter such error if yes please help me

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

1 participant