We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't know how to import L.WMS in React. I am new to this React and leaflet.
Here is the code:
import 'leaflet/dist/leaflet.css'; import L from 'leaflet.wms/lib/leaflet'; import 'leaflet.wms/dist/leaflet.wms'; import 'leaflet.wms/lib/require'; class App extends Component { componentDidMount() { var map1 = L.map("map").setView([27.664198, 85.361624], 5); var BaseOsm = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' }).addTo(map1); map1.setView([-29.764377375163114, 147.3486328125 ]); // var stComerciaisLayer= L.tileLayer.wms("http://localhost:8080/geoserver/nyc/wms", { // layers: 'nyc:wind_direction', // format: 'image/png', // transparent: true, // attribution: "Algum texto de teste" // }).addTo(map1); var source = L.WMS.source("http://localhost:8080/geoserver/nyc/wms", { 'transparent': true }); source.getLayer('nyc:wind_direction').addTo(map1); } render() { return ( <div style={{ width: 600, height: 600 }} id="map"> </div> ); } } export default App; ```
The text was updated successfully, but these errors were encountered:
The way we did this in our react application is by doing npm install of the library and importing it as such:
import LeafletWms from "leaflet.wms";
Now we can use it by doing
const layerSource = LeafletWms.source( "URL", {} ); layerSource.getLayer("LAYER_NAME").addTo(map)
Sorry, something went wrong.
The way we did this in our react application is by doing npm install of the library and importing it as such: import LeafletWms from "leaflet.wms"; Now we can use it by doing const layerSource = LeafletWms.source( "URL", {} ); layerSource.getLayer("LAYER_NAME").addTo(map)
The above also works for vue.
No branches or pull requests
Don't know how to import L.WMS in React. I am new to this React and leaflet.
Here is the code:
The text was updated successfully, but these errors were encountered: