Skip to main content

All Questions

Tagged with
0 votes
1 answer
876 views

Next JS Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)

Trying to get Leaflet JS working in Next JS, getting an error that element type is invalid. This is where is dynamically import my Map component. /components/MapDir/index.js import dynamic from 'next/...
OUallas's user avatar
-1 votes
1 answer
708 views

React-Leaflet: Marker has wrong position after zoom out

When I show a marker in the center of the map it is OK. But when I zoom out, the marker is like staying in the same place. Finally, its position is very wrong. Why is it not moving together with the ...
Audrey's user avatar
  • 430
1 vote
1 answer
2k views

Change Tile Size of Mapbox Tiles using React Leaflet

Is it possible to change the tile size of Mapbox tiles when using react-leaflet? The rendered tiles has text that look too tiny, which makes me think that these are 512px tiles being treated by ...
Nyxynyx's user avatar
  • 62.8k
0 votes
2 answers
923 views

Mapbox example as a React component

I am trying to use this fiddle code from Mapbox in my react app. Official code here So far, this is my code, I am getting this error TypeError: Cannot set property 'accessToken' of undefined I am new ...
Sanya's user avatar
  • 139
5 votes
0 answers
3k views

Testing mapbox-gl map fails in test because theres no WebGL

I use mapbox-gl, specifically mapbox-gl-leaflet, in React to create a map: import Leaflet from 'leaflet' import 'mapbox-gl/dist/mapbox-gl.css' import {} from 'mapbox-gl-leaflet' import 'leaflet/dist/...
Juuro's user avatar
  • 1,616
1 vote
1 answer
2k views

GeoJSON layers color change on mouseover

Hi I am trying to showcase a leaflet Map in my React page, and it was working a couple days ago but I just came back to it and it is not operating properly. I made a choropleth map and loaded the ...
rachelo's user avatar
  • 41
1 vote
1 answer
1k views

How to only enable map dragging in Leaflet when spacebar is held down?

The default behaviour of Leaflet maps is to drag the view around using only mouse-down. I'd like to enable dragging with the mouse only if spacebar is pressed as well. I need mouse dragging without ...
WisdomOfAPerson's user avatar
0 votes
2 answers
1k views

react-leaflet mapboxgl integration not working

following the answer in this page : Render mapbox vector tiles inside react-leaflet? When i export MapBoxGLLayer and import it to my main class, like import MapBoxGLLayer from './MapBoxGLLayer'; ...
BardZH's user avatar
  • 442
1 vote
1 answer
587 views

How to request new tiles in TileLayer (React Leaflet) every 30min?

This is what I have: const RL = require('react-leaflet'); var Map = RL.Map; var TileLayer = RL.TileLayer; <Map zoom={14} zoomSnap={0} style={{height: "100%"}} ref={(map) => { this.map =...
Joesy_Mosk's user avatar
0 votes
0 answers
1k views

How to add custom markers to mapbox-gl js?

I am trying to add markers in a map using mapbox gl. I checked mapbox gl example but they have set of default icons predefined in there style. I want to add my custom markers and their styling. And I ...
NitinD's user avatar
  • 499
-1 votes
1 answer
104 views

Mapbox.js not rendering properly in React

I've recently removed pauloborges:mapbox atmosphere package from my project and I'm trying to replace it with mapbox.js from npm. Instead of the map, I get a random mashup of tiles that gets out of ...
user2634633's user avatar
3 votes
4 answers
5k views

React and Leaflet

I'm trying to use Leaflet in my React App. I'm running into an issue. Leaflet.js requires the div component to pre-exist when initiating the map. React doesn't "create" the div until it renders the ...
balloway's user avatar
  • 161
0 votes
1 answer
2k views

How to get marker drag event on dragging marker with mapbox LeafLet

I have created custom create Marker button and onClick of that i am adding marker on map. I can drag that map but I am lot getting it's LatLng on dragging. I want to get latlng on marker drag event....
Kalashir's user avatar
  • 1,127
2 votes
1 answer
5k views

React.js and Mapbox: mapbox map not rendering properly when using react.js

I'm learning to use both react and mapbox,but am struggling with why my mapbox map is not rendering properly when loaded through React. When I load it normally (without React.js), there is no problem,...
bryant's user avatar
  • 2,041