0

I've been having trouble getting drawn polygon's geojson in production. When I run the app locally, draw:created fires and I can see the geojson in my requests. Here's the code:

const map = this.$refs.map.$refs.map;

map.mapObject.on("draw:created", (e) => {
      this.searchPolygon = e.layer.toGeoJSON();
    });
map.mapObject.on("draw:deleted", (e) => {
      this.searchPolygon = {};
    });

However, for some reason when running it in production, no geojson makes it into 'searchPolygon' after drawing a shape on the map. If i delete the shape I get "firing draw:deleted" in the console.

I'm running the same Docker image of my frontend locally and in production. I can see the mapObject in both environments and the layer is being created when I draw the shape, I've run out of ideas of where to look. Any ideas would be appreciated.

I've tried to change the refs, thinking maybe it's not finding the mapObject. But if I remove the refs, an error is thrown that "mapObject is not found". When i run the code like it is above, there are no errors thrown in console. Deleting the shape seems to fire draw:deleted since the codebase has a console.log that prints "firing draw:deleted".

0 Answers0