How to use the react-leaflet.withLeaflet function in react-leaflet

To help you get started, we’ve selected a few react-leaflet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conveyal / analysis-ui / lib / components / map / isochrone.js View on Github external
/>}
      
    )
  }

  _handleDragend = (e: Event & {target: MapEvent}) => {
    this.props.setIsochroneLonLat(lonlat(e.target._latlng))
  }

  _handleDblclick = () => {
    this.props.remove()
  }
}

// Add leaflet to the props
export default withLeaflet(Isochrone)
github osmlab / maproulette3 / src / components / EnhancedMap / FitBoundsControl / FitBoundsControl.js View on Github external
})
}

/**
 * FitBoundsControl is a react-leaflet MapControl component intended to be used
 * as a child of a react-leaflet Map instance, such as EnhancedMap. When clicked,
 * the control fits the map to the bounds of the current features.
 */
export class FitBoundsControl extends MapControl {
  // props will be available as `options` field in the leaflet control
  createLeafletElement(props) {
    return new FitBoundsLeafletControl(props)
  }
}

export default WithKeyboardShortcuts(withLeaflet(injectIntl(FitBoundsControl)))
github foucdeg / x-plane-map-electron / src / client / components / GoogleMapLayer.js View on Github external
/* eslint class-methods-use-this: "off" */
import { GridLayer, withLeaflet } from 'react-leaflet';

class GoogleMapLayer extends GridLayer {
  createLeafletElement() {
    return L.gridLayer.googleMutant({
      type: 'roadmap',
    });
  }

  updateLeafletElement(fromProps, toProps) {
    super.updateLeafletElement(fromProps, toProps);
  }
}

export default withLeaflet(GoogleMapLayer);
github foucdeg / x-plane-map-electron / src / client / components / GoogleSatelliteLayer.js View on Github external
/* eslint class-methods-use-this: "off" */
import { GridLayer, withLeaflet } from 'react-leaflet';

class GoogleSatelliteLayer extends GridLayer {
  createLeafletElement() {
    return L.gridLayer.googleMutant({
      type: 'hybrid',
    });
  }

  updateLeafletElement(fromProps, toProps) {
    super.updateLeafletElement(fromProps, toProps);
  }
}

export default withLeaflet(GoogleSatelliteLayer);
github HSLdevcom / jore-map-ui / src / components / map / layers / RouteLayer.tsx View on Github external
return this.props.routes.map(route => {
            return (
                
            );
        });
    }
}

export default withLeaflet(RouteLayer);
github HSLdevcom / jore-map-ui / src / components / map / layers / edit / EditLinkLayer.tsx View on Github external
}

        this.drawEditableLink();

        return (
            <>
                {this.renderLinkDecorator()}
                {this.renderNodes()}
                {this.renderStartMarker()}
                {this.renderDashedLines()}
            
        );
    }
}

export default withLeaflet(EditLinkLayer);
github nasa / earthdata-search / static / src / js / components / Map / ShapefileLayer.js View on Github external
createLeafletElement(props) {
    return new ShapefileLayerExtended(props)
  }

  updateLeafletElement(fromProps, toProps) {
    const element = this.leafletElement

    const { shapefile } = toProps
    const { shapefileId, shapefileName } = shapefile
    if (!shapefileId && !shapefileName) {
      element.onRemovedFile()
    }
  }
}

export default withLeaflet(ShapefileLayer)
github nusmodifications / nusmods / website / src / views / components / map / ExpandMap.tsx View on Github external
<button type="button" aria-label="{label}">
            {this.props.isExpanded ?  : }
          </button>
        
      
    );
  }
}

export default withLeaflet(ExpandMap);
github nusmodifications / nusmods / www / src / js / views / components / map / ExpandMap.tsx View on Github external
<button type="button" aria-label="{label}">
            {this.props.isExpanded ?  : }
          </button>
        
      
    );
  }
}

export default withLeaflet(ExpandMap);
github opentripplanner / otp-react-redux / lib / components / map / distance-measure.js View on Github external
createLeafletElement (props) {
    return L.control.polylineMeasure({
      unit: 'landmiles',
      measureControlLabel: '&#x1f4cf;',
      backgroundColor: '#f3dd2d',
      clearMeasurementsOnStop: true
    })
  }

  componentDidMount () {
    const { map } = this.props.leaflet
    this.leafletElement.addTo(map)
  }
}

export default withLeaflet(DistanceMeasure)