Markers do not align to the point.
See original GitHub issueconst sourcePoint =[55.1953125,24.686];
const destPoint = [78.662109375,13.23];
const data = {
type: 'Feature',
geometry: {
type: 'LineString',
coordinates: [
sourcePoint,
destPoint,
]
}
};
export default class MapBoxMap extends Component {
constructor(props) {
super(props);
this.state = {
viewport: {
zoom: 2,
latitude: sourcePoint[1],
longitude: sourcePoint[0],
bearing: 0,
pitch: 0,
width: 360,
height: 360,
fitBounds:true,
interactive:false,
}
};
}
render() {
const {viewport} = this.state;
return (
<MapGL
style={{ width: '100%', height: '400px' }}
accessToken={TOKEN}
onViewportChange={(viewport) => this.setState({ viewport })}
{...viewport}
>
<Source id="route" type="geojson" data={data} />
<Layer
id="route"
type="line"
source="route"
layout={{
'line-join': 'round',
'line-cap': 'round'
}}
paint={{
'line-color': '#888',
'line-width': 2
}}
/>
<Marker
latitude={destPoint[1]}
longitude={destPoint[0]}
>
<div>Chennai 👋</div>
</Marker>
<Marker
latitude={sourcePoint[1]}
longitude={sourcePoint[0]}
>
<div>Dubai 👋</div>
</Marker>
</MapGL>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Markers and connecting lines between markers not centered ...
One consistent issue I am having is that my markers and lines are not aligned perfectly. Instead, the markers are slightly to the...
Read more >marker vs. point based chunk alignment - Agisoft Metashape
The alignment using the markers does not seem to position the markers in the same location (within the 3d view of the point...
Read more >Why Markers points are not aligned with yAxis in Highcharts?
Your data points are plotting events at specific times during those days, and are placed accordingly. This is not weird behavior, it is...
Read more >Solved: Alignment markers - Autodesk Community - Civil 3D
Select the alignment and choose Edit Alignment Labels. There is a selection in the geometry points label type where you can choose which...
Read more >Marker based alignment in Agisoft Metashape - YouTube
Learn how to perform a marker based alignment in Agisoft Metashape Pro. Using the align and merge chunk tools in Agisoft allows you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@prakashsvmx
I have this issue also after code splitting (using react lazy). Try to include css styles
import 'mapbox-gl/dist/mapbox-gl.css'
The problem was corrected by making the following changes to index.html:
at the head:
<script src="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" />
at the body:
<script> mapboxgl.accessToken = "INSERT KEY"; var map = new mapboxgl.Map({ container: "map", style: "mapbox://styles/mapbox/streets-v11", // stylesheet location center: [-74.5, 40], // starting position [lng, lat] zoom: 9, // starting zoom }); </script>