Advertisement
Guest User

react+yandex-map+leaflet

a guest
Mar 20th, 2019
3,841
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component, Fragment } from "react";
  2. import ReactDom from "react-dom";
  3. import { Map, Marker, Popup, TileLayer } from "react-leaflet";
  4. import { CRS } from "leaflet";
  5.  
  6. const position = [51.505, -0.09];
  7. class Text extends Component {
  8.   render() {
  9.     return (
  10.       <Fragment>
  11.         <h1>leaflet</h1>
  12.         <Map center={position} zoom={13} crs={CRS.EPSG3395}>
  13.           <TileLayer
  14.             subdomains={["01", "02", "03", "04"]}
  15.             attribution='<a http="yandex.ru" target="_blank">Яндекс</a>'
  16.             url="http://vec{s}.maps.yandex.net/tiles?l=map&v=4.55.2&z={z}&x={x}&y={y}&scale=2&lang=ru_RU"
  17.           >
  18.             <Marker position={position}>
  19.               <Popup>
  20.                 A pretty CSS3 popup.
  21.                 <br />
  22.                 Easily customizable.
  23.               </Popup>
  24.             </Marker>
  25.           </TileLayer>
  26.         </Map>
  27.       </Fragment>
  28.     );
  29.   }
  30. }
  31.  
  32. ReactDom.render(<Text />, document.getElementById("app"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement