🌐
GitHub
github.com › visgl › react-map-gl › issues › 242
Getting map bounds · Issue #242 · visgl/react-map-gl
May 16, 2017 - visgl / react-map-gl Public · Notifications · You must be signed in to change notification settings · Fork 1.4k · Star 8.4k · New issueCopy link · New issueCopy link · Closed · Closed · Getting map bounds#242 · Copy link · G2Jose · opened · on May 16, 2017 ·
Published   May 16, 2017
Author   G2Jose
🌐
Stack Overflow
stackoverflow.com › questions › 53442394 › uber-react-map-gl-getmap-exposed-mapbox-api
uber/react-map-gl getMap & exposed Mapbox API - Stack Overflow
import MapGL from 'react-map-gl'; export default class App extends Component { constructor(props) { super(props); this.mapRef= React.createRef(); } componentDidMount() { let data = this.mapRef.getMap().getBounds(); <---- } render() { <MapGL {...viewport} width="100%" height="100%" mapStyle={MapStyle} onViewportChange={this._updateViewport} ref={map => this.mapRef = map} mapboxApiAccessToken={TOKEN} > } }
Discussions

Using LngLatBounds
I am trying to use LngLatBounds. Importing it from the mapbox library directly generates many errors (I am using NextJS), such as "self is not defined". But I feel like it's related t... More on github.com
🌐 github.com
3
May 10, 2020
How to constrain React-mapbox-gl to its container?
They are not out of bounds they are on the map but they keep moving as I pan around and keep moving as soon as the map hits a maxBound wall, if that makes sense, you are correct I'll raise another question 2021-06-29T16:12:06.71Z+00:00 ... I think I found the solution to my problem here: github.com/visgl/react-map-gl... More on stackoverflow.com
🌐 stackoverflow.com
Feature Request - getBounds()
I have seen getBounds() in the mapboxgl js docs and it would be so useful to have this exposed at the React level. More on github.com
🌐 github.com
5
November 24, 2017
How to get visible map bounds in mapbox js? - Stack Overflow
I'm working website which uses a lot of markers. And for performance reasons I'm going to render only visible markers after each move. I'm using mapbox js library via react-mapbox-gl react library.... More on stackoverflow.com
🌐 stackoverflow.com
🌐
DEV Community
dev.to › ivanbtrujillo › fit-viewport-to-markers-using-react-map-gl-3ig1
Fit viewport to markers using react-map-gl - DEV Community
December 20, 2020 - As recommendation, you can move all the map logic inside a custom hook (useMap), and getBounds and getMinOrMax to an utilities file (for example mapUtils). Here the full example: https://codesandbox.io/s/react-map-gl-fit-to-markers-lq1mp
🌐
React Map GL
visgl.github.io › tips and tricks
Tips and Tricks | react-map-gl
const vehiclesGeoJSON = useMemo(() => { return { type: 'FeatureCollection', features: vehicles.map(vehicle => turf.point(vehicle.coordinates, vehicle)) }; }, [vehicles]); return ( <Map {...viewState} onMove={onMove} mapStyle="mapbox://styles/mapbox/streets-v9" > > <Source id="vehicles" type="geojson" data={vehiclesGeoJSON}> <Layer type="symbol" layout={{ 'icon-image': 'vehicle-icon', 'icon-size': 1, 'text-field': ['get', 'id'] }} /> </Source> </Map> ); There are some situations where you want to know if a point is currently visible on the map. Checking this is simple and can be done like so: const mapRef = useRef<MapRef>(); const checkIfPositionInViewport = (lat, lng) => { const bounds = mapRef.current.getBounds(); return bounds.contains([lng, lat]); } return <Map ref={mapRef} ...
🌐
GitHub
github.com › visgl › react-map-gl › discussions › 1521
getBounds on map move · visgl/react-map-gl · Discussion #1521
I'm using V3, is there any way to get mapbox bounds while moving the map? Beta Was this translation helpful? Give feedback. 1 · You must be logged in to vote · All reactions · Comment options · There was an error while loading. Please reload this page. Something went wrong. There was an error while loading. Please reload this page. Quote reply · - https://visgl.github.io/react-map-gl/docs/api-reference/web-mercator-viewport#getboundsoptions ·
Author   visgl
🌐
Snyk
snyk.io › advisor › react-map-gl › functions › react-map-gl.fitbounds
How to use the react-map-gl.fitBounds function in react-map-gl | Snyk
August 19, 2022 - uber / react-map-gl / test / utils / fit-bounds.spec.js View on Github · test('fitBounds', (t) => { for (const [{viewport, bounds, options}, expected] of FITBOUNDS_TEST_CASES) { const result = fitBounds(viewport, bounds, options); t.ok(Number.isFinite(result.longitude), 'get valid longitude'); t.ok(Number.isFinite(result.latitude), 'get valid latitude'); t.ok(Number.isFinite(result.zoom), 'get valid zoom'); t.deepEqual( toLowPrecision(result), toLowPrecision(expected), 'valid viewport returned' ); } t.end(); }); React components for MapLibre GL JS and Mapbox GL JS ·
🌐
GitHub
github.com › visgl › react-map-gl › issues › 1099
Using LngLatBounds · Issue #1099 · visgl/react-map-gl
May 10, 2020 - Importing it from the mapbox library directly generates many errors (I am using NextJS), such as "self is not defined". But I feel like it's related to the fact that I am using MapBox through React Map GL, and therefore, the real instance is somewhere else. Ideally, I would have preferred to get LngLatBounds from React Map GL, but I don't see this anywhere.
Published   May 10, 2020
Author   jordymeow
🌐
DEV Community
dev.to › kyle12jung › finding-bounding-box-using-mapbox-gl-on-react-native-3nma
Finding Bounding Box using Mapbox GL on React Native - DEV Community
July 16, 2022 - Since it is just maintained by volunteers and is constantly updating, some examples of the props or the functions of the existing components were not clear enough. The function I was trying to use was getVisibleBounds() of the MapView component. ...
Find elsewhere
🌐
GitHub
github.com › visgl › react-map-gl › issues › 442
Set max bounds for pan · Issue #442 · visgl/react-map-gl
January 18, 2018 - <MapGL { ...viewport } onViewportChange={ this._onViewportChange.bind( this ) } maxBounds={ [ [ ..., ... ], [ ..., ... ] ] } > ... </MapGL> ... _onPan( event ) { const viewport = this.getMapState()._viewportProps; // only if within bounds if ( ...
🌐
GitHub
github.com › alex3165 › react-mapbox-gl › issues › 456
Feature Request - getBounds() · Issue #456 · alex3165/react-mapbox-gl
November 24, 2017 - Hi, I have seen getBounds() in the mapboxgl js docs and it would be so useful to have this exposed at the React level. At the moment I am getting the MapboxGl.Map object manually and using the getBounds() on that, but I don't like bypass...
Author   iambalaam
🌐
CodeSandbox
codesandbox.io › p › sandbox › visgl-react-map-gl-zoom-to-bounds-x0zl5
visgl/react-map-gl: zoom-to-bounds
CodeSandbox is a cloud development platform that empowers developers to code, collaborate and ship projects of any size from any device in record time.
🌐
npm
npmjs.com › package › react-map-gl-alt
react-map-gl-alt - npm
February 18, 2020 - Mapbox GL JS has recommended this approach since version 0.25.0. ... Clone the example to your local fs. The example shows a simple full screen interaction controlled by this component (built using webpack etc). ... You can provide a number of props to help control the location of the map. This includes providing center, longitude latitude or a bounds.
      » npm install react-map-gl-alt
    
Published   Feb 18, 2020
Version   1.1.1
Author   Cam Manderson
🌐
GitHub
github.com › visgl › react-map-gl › issues › 496
Getting map bounds · Issue #496 · visgl/react-map-gl
April 5, 2018 - I'd like to get the visible bounds of a map from within the component rendering the map. I referred initially to #242 but the proposed solution in that conversation seems no longer to be viable. I am using V3.2.1 and this is what my code looks like · const MapBoxRender = ReactMapboxGl({ ...
Author   AriLFrankel
🌐
Stack Overflow
stackoverflow.com › questions › 52911719 › locate-to-specific-bound-by-using-fitbounds-of-react-mapbox-gl
reactjs - Locate to specific bound by using fitBounds of react-mapbox-gl - Stack Overflow
October 21, 2018 - Are there any solution to make this function with react-mapbox-gl? ... everyone! I solved it myself. When using the fitBounds, need to use the center of that bound.
🌐
Stack Overflow
stackoverflow.com › questions › 74850416 › fit-bounds-with-padding-deck-gl-mapbox
reactjs - Fit bounds with padding deck.gl mapbox - Stack Overflow
<Map initialViewState={{ bounds: getBoundingBox(fitLocations), fitBoundsOptions: { padding: 60 }, }} > ... </Map> For generating the bounding box we can use the same code provided by on Ar26.
🌐
getBounds
getbounds.com › index.html
getBounds
getBounds | Spatial Solutions for the Web getBounds provides geospatial consulting services for data analysis and visualization, using tools such as PostgreSQL/PostGIS, Mapbox GL & MapLibre, and React/Next JS, as well as custom web development.