React OpenLayers Fiber
IntroductionDocsExamples
/
GitHub
/
  • OpenLayers examples
    • Accessible Map
    • Bing Maps
    • Clustered Features
    • Draw and Modify Features
    • Draw Shapes
    • Dynamic Data
    • GeoJSON
    • Icon Symbolizer
    • Image Filters
    • Mapbox Vector Tiles
    • Popup
    • Preload Tiles
    • Image Reprojection
    • OpenStreetMap Reprojection
    • Select Features
    • Simple Map
    • Static Image
    • turf.js
    • Tiled WMS
    • XYZ Retina Tiles
    • XYZ
    • Zoomify
  • Advanced examples
    • Declaratively move view
    • Dynamic styles
    • Dynamic points
    • Retina
    • Performance
    • Kitchen Sink
  • Introduction
  • Docs
    • Getting Started
    • Components
    • Props
    • Imperative Fallback
  • Examples
    • OpenLayers examples
      • Accessible Map
      • Bing Maps
      • Clustered Features
      • Draw and Modify Features
      • Draw Shapes
      • Dynamic Data
      • GeoJSON
      • Icon Symbolizer
      • Image Filters
      • Mapbox Vector Tiles
      • Popup
      • Preload Tiles
      • Image Reprojection
      • OpenStreetMap Reprojection
      • Select Features
      • Simple Map
      • Static Image
      • turf.js
      • Tiled WMS
      • XYZ Retina Tiles
      • XYZ
      • Zoomify
    • Advanced examples
      • Declaratively move view
      • Dynamic styles
      • Dynamic points
      • Retina
      • Performance
      • Kitchen Sink

XYZ

See https://openlayers.org/en/latest/examples/xyz.html

import React from "react";
import "ol/ol.css";
import { Map } from "@react-ol/fiber";

export const key = process.env.NEXT_PUBLIC_THUNDERFOREST_KEY;

export const ExampleXYZ = () => {
  return (
    <Map>
      <olView initialCenter={[-472202, 7530279]} initialZoom={12} />
      <olLayerTile>
        <olSourceXYZ
          url={
            "https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png" +
            "?apikey=" +
            key
          }
        />
      </olLayerTile>
    </Map>
  );
};
XYZ Retina Tiles
Zoomify

    On This Page


Edit this page on GitHub
MIT 2022 © Vincent Lecrubier.