Skip to content

TypeError: Cannot read property 'protobuf' of undefined #14

Description

@0xmtn

Hello,

I'm trying to use react-leaflet-vectorgrid to render .mvt tiles from a remote server but I get the error below:

image

My code is:

import React, { Component } from "react";
import { 
  Path, 
  withLeaflet,                 
  GeoJSON,                     
  LayerGroup,                  
  LayersControl                
} from 'react-leaflet';        
  
import ReactDOM from "react-dom";
import L from "leaflet";
import VectorGridDefault from 'react-leaflet-vectorgrid';
            
import aladag from "./data/adana/aladag.json";
import ceyhan from "./data/adana/ceyhan.json";
const VectorGrid = withLeaflet(VectorGridDefault); 


class AdanaOverlays extends Component {
 
  constructor(){
    super(); 
  }

  render (){
    return (
      <LayersControl>
        <Overlay name="Aladag">
          <VectorGrid type="protobuf" url="http://localhost:8123/aladag/{z}/{x}/{y}.mvt" />
        </Overlay>

        <Overlay name="Ceyhan">
          <VectorGrid type="protobuf" url="http://localhost:8123/ceyhan/{z}/{x}/{y}.mvt" />
        </Overlay>
      </LayersControl>
    )
  }

export default AdanaOverlays;

I don't know if this is my mistake or something went wrong in installation. I deleted node_modules, cleared cache and installed everything from scratch, yet same thing happens.

How do I proceed to solve this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions