mhasbie / react-leaflet-vectorgrid

React wrapper of Leaflet.VectorGrid. Display gridded vector data (sliced GeoJSON or protobuf vector tiles) in Leaflet.
MIT License
19 stars 10 forks source link

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

Open 0xmtn opened 4 years ago

0xmtn commented 4 years ago

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?

0xmtn commented 4 years ago

@mhasbie Do you still maintain this repo?