Moving from Google Maps

The SDK keeps Google Maps' names and shapes where it can, so most code moves over by renaming. Positions written as { lat, lng } and Google's own LatLng objects are accepted everywhere.

Loading

<!-- Before -->
<script src="https://maps.googleapis.com/maps/api/js?key=…&callback=initMap" async></script>

<!-- After: no callback needed, milsat is ready when the script has run -->
<script src="https://sdk.maps.milsat.africa/sdk/v1.js"></script>

Side by side

Google MapsMilsatMaps
new google.maps.Map(el, { center, zoom })new milsat.Map(el, { apiKey: "…", center, zoom })
new google.maps.Marker({ position, map, title })new milsat.Marker({ position, map, title })
new google.maps.InfoWindow({ content })new milsat.Popup({ text }), or html / element
infoWindow.open({ map, anchor: marker })new milsat.Marker({ …, popup })
new google.maps.Polygon({ paths, fillColor })new milsat.Polygon({ paths, fillColor })
new google.maps.Polyline({ path, strokeColor })new milsat.Polyline({ path, strokeColor })
map.data.addGeoJson(json)new milsat.GeoJSONLayer({ data: json, map })
marker.setMap(null)marker.setMap(null) or marker.remove()
map.addListener("click", fn)map.addListener("click", fn) or map.on
event.latLng.lat()event.lngLat.lat
map.getCenter().lat()map.getCenter().lat
map.setOptions({ styles })map.setStyle("dark"): three ready-made looks
new google.maps.Geocoder().geocode({ address })milsat.geocode(address)
Geocoder.geocode({ location })milsat.reverseGeocode(location)
AutocompleteService.getPlacePredictionsmilsat.places.autocomplete(input)
PlacesService.getDetails({ placeId })milsat.places.details(placeId)
DirectionsService.route({ origin, destination, travelMode })milsat.directions(origin, destination, { mode })
DirectionsRenderernew milsat.Polyline({ path: route.path, map })

What is different

There is no drop-in google.maps replacement: the calls are close enough that renaming is quicker and clearer than a compatibility layer.