@@ -4,33 +4,39 @@ Fable bindings and helpers for [react-google-map](https://github.com/tomchentw/r
44
55## Installation
66
7- npm install --save react-google-maps # or
8- yarn add react-google-maps
7+ ```
8+ npm install --save react-google-maps # or
9+ yarn add react-google-maps
910
10- paket add Fable.ReactGoogleMap --project [yourproject]
11+ paket add Fable.ReactGoogleMap --project [yourproject]
12+ ```
1113
1214## Usage
1315
1416In your css add the following:
1517
16- .maploadercontainer,
17- .mapcontainer {
18- height: calc(100vh - 18rem);
19- width: 100%;
20- }
18+ ``` css
19+ .maploadercontainer ,
20+ .mapcontainer {
21+ height : calc (100vh - 18rem );
22+ width : 100% ;
23+ }
24+ ```
2125
2226and in your F# code you can create the map like this:
2327
24- let defaultCenter:Position = { lat = 40.6892494 ; lng = -74.0445004 }
28+ ``` fs
29+ let defaultCenter:Position = { lat = 40.6892494 ; lng = -74.0445004 }
2530
26- let myMap =
27- googleMap [
28- MapProperties.ApiKey googleMapApiKey
29- MapProperties.MapLoadingContainer "maploadercontainer"
30- MapProperties.MapContainer "mapcontainer"
31- MapProperties.DefaultZoom 9
32- MapProperties.DefaultCenter defaultCenter
33- MapProperties.Center defaultCenter ]
31+ let myMap =
32+ googleMap [
33+ MapProperties.ApiKey googleMapApiKey
34+ MapProperties.MapLoadingContainer "maploadercontainer"
35+ MapProperties.MapContainer "mapcontainer"
36+ MapProperties.DefaultZoom 9
37+ MapProperties.DefaultCenter defaultCenter
38+ MapProperties.Center defaultCenter ]
39+ ```
3440
3541## Traffic Layer
3642
@@ -46,36 +52,40 @@ Google Maps allows you to activate the traffic layer. The map component has a si
4652
4753If you want to show markers on the map then you can create them like this:
4854
49- let markers =
50- locations
51- |> Array.map (fun location ->
52- marker [
53- MarkerProperties.Key location.ID
54- MarkerProperties.Position (Coordinates.newPos location.X location.Y)
55- MarkerProperties.Icon (sprintf "Images/markers/%s.png" location.Color)
56- MarkerProperties.Title location.Title] []))
55+ ``` fs
56+ let markers =
57+ locations
58+ |> Array.map (fun location ->
59+ marker [
60+ MarkerProperties.Key location.ID
61+ MarkerProperties.Position (Coordinates.newPos location.X location.Y)
62+ MarkerProperties.Icon (sprintf "Images/markers/%s.png" location.Color)
63+ MarkerProperties.Title location.Title] []))
5764
5865
59- let myMap =
60- googleMap [
61- MapProperties.ApiKey googleMapApiKey
62- // ..
63- MapProperties.Markers (unbox markers) ]
66+ let myMap =
67+ googleMap [
68+ MapProperties.ApiKey googleMapApiKey
69+ // ..
70+ MapProperties.Markers (unbox markers) ]
71+ ```
6472
6573## MarkerClusterer
6674
6775The map component allows you to use a [ MarkerClusterer] ( https://tomchentw.github.io/react-google-maps/#markerclusterer ) :
6876
69- let clustered =
70- markers
71- |> markerClusterer [
72- MarkerClustererProperties.AverageCenter true
73- MarkerClustererProperties.MaxZoom 15
74- MarkerClustererProperties.EnableRetinaIcons true
75- MarkerClustererProperties.GridSize 60.]
76-
77- let myMap =
78- googleMap [
79- MapProperties.ApiKey googleMapApiKey
80- // ..
81- MapProperties.Markers clustered ]
77+ ``` fs
78+ let clustered =
79+ markers
80+ |> markerClusterer [
81+ MarkerClustererProperties.AverageCenter true
82+ MarkerClustererProperties.MaxZoom 15
83+ MarkerClustererProperties.EnableRetinaIcons true
84+ MarkerClustererProperties.GridSize 60.]
85+
86+ let myMap =
87+ googleMap [
88+ MapProperties.ApiKey googleMapApiKey
89+ // ..
90+ MapProperties.Markers clustered ]
91+ ```
0 commit comments