Used API keys from OpenStreetMap and implemented a city, Country based system.
Important functions used for /beatifymaps.
parseMapsCommand(text)
Reads what the user typed after /beatifymaps. It decides if the user wants help, place search, or distance mode.
geocodePlace(query)
Searches OpenStreetMap for a place like Tokyo, Japan or Los Angeles.
getNominatimHeaders()
Adds the required User-Agent header for OpenStreetMap Nominatim.
getDistanceMiles(fromPlace, toPlace)
Calculates distance between two places using their latitude and longitude.
buildPlaceResponse(query, place)
Creates the nice Slack Block Kit card for one searched place.
buildDistanceResponse(fromPlace, toPlace, distanceMiles)
Creates the nice Slack Block Kit card for distance between two places.
buildFlagImageUrl(countryCode)
Creates a flag image URL for the country.
getOpenStreetMapUrl(place)
Creates the “View Map” button link.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.