Edits history of script submission #6065 for ' Get latitude and longitude of address (windmill)'

  • python3
    import geocoder
    
    def main(address: str) -> dict:
        # Use geocoder to get the latitude and longitude of the given address
        g = geocoder.osm(address)  # Using OpenStreetMap provider
        if g.ok:
            return { "map": { "lat": 40, "lon": 0, "zoom": 3, "markers": [{"lat": g.lat, "lon": g.lng, "title": "Home", "radius": 5, "color": "yellow", "strokeWidth": 3, "strokeColor": "Black"}]}}
        else:
            return {'error': 'Unable to find the location'}

    Submitted by henri186 760 days ago