react-simple-maps 3.0.0-beta.2 → 3.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
-
2
1
  <img src="https://img.shields.io/bundlephobia/minzip/react-simple-maps?color=%2328cb95&label=gzip" />
3
2
 
4
3
  # react-simple-maps
4
+
5
5
  Create beautiful SVG maps in react with d3-geo and topojson using a declarative api.
6
6
 
7
7
  Read the [docs](https://www.react-simple-maps.io/docs/getting-started/), or check out the [examples](https://www.react-simple-maps.io/examples/).
@@ -28,38 +28,36 @@ $ yarn add react-simple-maps
28
28
 
29
29
  ### Usage
30
30
 
31
- `React-simple-maps` exposes a set of components that can be combined to create svg maps with markers and annotations. In order to render a map you have to provide a reference to a valid topojson file. You can find example topojson files in the [`topojson-maps` folder](https://github.com/zcreativelabs/react-simple-maps/tree/master/topojson-maps) or on [topojson world-atlas](https://github.com/topojson/world-atlas). To learn how to make your own topojson maps from shapefiles, please read ["How to convert and prepare TopoJSON files for interactive mapping with d3"](https://hackernoon.com/how-to-convert-and-prepare-topojson-files-for-interactive-mapping-with-d3-499cf0ced5f) on medium.
31
+ `React-simple-maps` exposes a set of components that can be combined to create svg maps with markers and annotations. In order to render a map you have to provide a reference to a valid topojson file. You can find example topojson files on [here](https://github.com/topojson/world-atlas) or [here](https://github.com/deldersveld/topojson). To learn how to make your own topojson maps from shapefiles, please read ["How to convert and prepare TopoJSON files for interactive mapping with d3"](https://hackernoon.com/how-to-convert-and-prepare-topojson-files-for-interactive-mapping-with-d3-499cf0ced5f) on medium.
32
32
 
33
33
  ```jsx
34
- import React from "react"
35
- import ReactDOM from "react-dom"
36
- import {
37
- ComposableMap,
38
- Geographies,
39
- Geography,
40
- } from "react-simple-maps"
34
+ import React from "react";
35
+ import ReactDOM from "react-dom";
36
+ import { ComposableMap, Geographies, Geography } from "react-simple-maps";
41
37
 
42
38
  // url to a valid topojson file
43
39
  const geoUrl =
44
- "https://raw.githubusercontent.com/zcreativelabs/react-simple-maps/master/topojson-maps/world-110m.json"
40
+ "https://raw.githubusercontent.com/deldersveld/topojson/master/world-countries.json";
45
41
 
46
42
  const App = () => {
47
43
  return (
48
44
  <div>
49
45
  <ComposableMap>
50
46
  <Geographies geography={geoUrl}>
51
- {({geographies}) => geographies.map(geo =>
52
- <Geography key={geo.rsmKey} geography={geo} />
53
- )}
47
+ {({ geographies }) =>
48
+ geographies.map((geo) => (
49
+ <Geography key={geo.rsmKey} geography={geo} />
50
+ ))
51
+ }
54
52
  </Geographies>
55
53
  </ComposableMap>
56
54
  </div>
57
- )
58
- }
55
+ );
56
+ };
59
57
 
60
58
  document.addEventListener("DOMContentLoaded", () => {
61
- ReactDOM.render(<App />, document.getElementById("app"))
62
- })
59
+ ReactDOM.render(<App />, document.getElementById("app"));
60
+ });
63
61
  ```
64
62
 
65
63
  Check out the [live example](https://codesandbox.io/s/basic-map-wvlol)
@@ -68,5 +66,16 @@ The above will render a world map using the [equal earth projection](https://obs
68
66
 
69
67
  For other examples and components, check out the [documentation](https://www.react-simple-maps.io/docs/getting-started).
70
68
 
69
+ ### Map files
70
+
71
+ React-simple-maps does not restrict you to one specific map and relies on custom map files that you can modify in any way necessary for the project. This means that you can visualise countries, regions, and continents in various resolutions, as long as they can be represented using geojson/topojson.
72
+
73
+ In order for this to work properly, you will however need to provide these valid map files to react-simple-maps yourself. Luckily, there are decent sources for map files on github and elsewhere. Here are some you can check out:
74
+
75
+ * [Natural Earth](https://github.com/nvkelso/natural-earth-vector)
76
+ * [Topojson maps by @deldersveld](https://github.com/deldersveld/topojson)
77
+ * [Topojson world atlas](https://github.com/topojson/world-atlas)
78
+
71
79
  ### License
80
+
72
81
  MIT licensed. Copyright (c) Richard Zimerman 2017. See [LICENSE.md](https://github.com/zcreativelabs/react-simple-maps/blob/master/LICENSE) for more details.