Giter Club home page Giter Club logo

react-18-vector-grid-example's People

Contributors

flacoman91 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

crazykidjack

react-18-vector-grid-example's Issues

Possibly unnecessary options

@flacoman91 This is a continuation of the conversation on mhasbie/react-leaflet-vectorgrid#16

In this code from your VectorGrid.js file

const vectorGrid = useMemo(
() => {
const options = {
rendererFactory: L.svg.tile,
interactive: true,
style: {
weight: 0.5,
opacity: 1,
color: '#ccc',
fillColor: '#390870',
fillOpacity: 0.6,
fill: true,
stroke: true
},
type: 'protobuf',
vectorTileLayerStyles: vectorTileStyling,
apikey: 'gCZXZglvRQa6sB2z7JzL1w'
};
return L.vectorGrid.protobuf(nextzenTilesUrl, options)
},
[nextzenTilesUrl, vectorTileStyling]
);

Lines 194-203 I think are unnecessary. You said in the previous conversation that you

just copy pasted the example from https://github.com/Leaflet/Leaflet.VectorGrid#dependencies

but I can't find any example like that and those options are not documented in the Leaflet.VectorGrid, react-leaflet, or leaflet documentation.

I tried just commenting out those lines entirely and the application still works as expected. To be clear, if you change the current code to look like this, it still worked for me:

const vectorGrid = useMemo( 
     () => { 
         const options = { 
             rendererFactory: L.svg.tile, 
             interactive: true, 
            /*
             style: { 
                 weight: 0.5, 
                 opacity: 1, 
                 color: '#ccc', 
                 fillColor: '#390870', 
                 fillOpacity: 0.6, 
                 fill: true, 
                 stroke: true 
             }, 
             type: 'protobuf', 
            */
             vectorTileLayerStyles: vectorTileStyling, 
             apikey: 'gCZXZglvRQa6sB2z7JzL1w' 
         }; 
  
         return L.vectorGrid.protobuf(nextzenTilesUrl, options) 
     }, 
     [nextzenTilesUrl, vectorTileStyling] 
 ); 

Lastly, even if you leave that code in, but modify it... it doesn't seem to change anything. For example, the following code renders a map that looks exactly the same as the current code:

const vectorGrid = useMemo( 
     () => { 
         const options = { 
             rendererFactory: L.svg.tile, 
             interactive: true, 
             style: { 
                 weight: 5.0, //notice this changed
                 opacity: 1, 
                 color: '#000', //notice this changed
                 fillColor: '#000000', //notice this changed
                 fillOpacity: 0.6, 
                 fill: true, 
                 stroke: true 
             }, 
             type: 'anything', //notice this changed
             vectorTileLayerStyles: vectorTileStyling, 
             apikey: 'gCZXZglvRQa6sB2z7JzL1w' 
         }; 
  
         return L.vectorGrid.protobuf(nextzenTilesUrl, options) 
     }, 
     [nextzenTilesUrl, vectorTileStyling] 
 ); 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.