flacoman91 / react-18-vector-grid-example Goto Github PK
View Code? Open in Web Editor NEWExample project demonstrating how to get react-vectorgrid working with react 18 and leaflet
Example project demonstrating how to get react-vectorgrid working with react 18 and leaflet
@flacoman91 This is a continuation of the conversation on mhasbie/react-leaflet-vectorgrid#16
In this code from your VectorGrid.js file
react-18-vector-grid-example/src/Leaflet/VectorGrid.js
Lines 189 to 211 in d5e183c
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]
);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.