Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another map API? #55

Open
ChrisS-code opened this issue May 3, 2024 · 1 comment
Open

Another map API? #55

ChrisS-code opened this issue May 3, 2024 · 1 comment

Comments

@ChrisS-code
Copy link

Is it possible to use a map API, other than Mapbox? I would like to use other free map API's, but no map is showing when trying.

@deev3e
Copy link

deev3e commented Jun 5, 2024

Yes!

You can find many free maps providers here: https://leaflet-extras.github.io/leaflet-providers/preview/

When chosen your tiles provider do some edits:

  1. Edit the file client/src/components/WeatherMap/index.js. Find <TileLayer> tag and change the url parameter there, can look something like:
     <TileLayer
        attribution='   d-map'
        url={`https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png`}
      />
  1. Now enter the pi-weather-station/client directory. You'll find the webpack configuration file there. Before you run webpack you would probably want to npm install to get needed modules. Run webpack like:
webpack --config webpack.config.js
  1. Go back to main directory, run your server (npm start), you should see your free tiles
Screenshot 2024-06-05 at 23 49 20

Just in case - quick workaround for api settings - in Settings under Maps API key enter anything
Screenshot 2024-06-05 at 23 53 04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants