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 Maps | MilsatMaps |
|---|---|
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.getPlacePredictions | milsat.places.autocomplete(input) |
PlacesService.getDetails({ placeId }) | milsat.places.details(placeId) |
DirectionsService.route({ origin, destination, travelMode }) | milsat.directions(origin, destination, { mode }) |
DirectionsRenderer | new milsat.Polyline({ path: route.path, map }) |
What is different
- Answers are plain values. Positions come back as
{ lng, lat }objects, not objects withlat()methods, and services return promises instead of taking callbacks. - Distances and times are numbers in metres and seconds; format them yourself.
- Directions cover driving and walking. Times are without traffic.
- Search does not yet split full street addresses into parts. Search for the street or the place.
- No street view or satellite imagery yet.
- Coverage is strongest in Nigeria, where MilsatMaps' own surveyed places are.
There is no drop-in google.maps replacement: the calls are close enough that renaming is quicker and clearer than a compatibility layer.