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

Google maps example #1

Merged
merged 40 commits into from
Nov 21, 2023

Conversation

menusal
Copy link
Contributor

@menusal menusal commented Nov 8, 2023

Description

Replicate the following example: codesandbox in Google Maps

image

Bonus: add a slider control to filter by population
Interactivity as hover is required to show the name + pop

Shorcut: sc-361050

CHECKLIST

  • Google Maps
  • Tooltip
  • Slider to filter by population
  • Basemap selector, hide native

TODO

  • Update attribution info

Copy link

stackblitz bot commented Nov 8, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

This pull request has been linked to Shortcut Story #361050: Basemaps basic hello world.

@menusal menusal marked this pull request as draft November 8, 2023 16:38
@menusal menusal marked this pull request as ready for review November 8, 2023 20:43
@alasarr alasarr mentioned this pull request Nov 9, 2023
3 tasks
Copy link
Contributor

@alasarr alasarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there!

const satelliteButton = document.getElementById('satellite');
const hybridButton = document.getElementById('hybrid');

roadmapButton?.addEventListener('click', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using a map-type-id attribute at the button element to avoid repeating

...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also missing the other CARTO basemaps (positron, dark-matter, and voyager). Those are our versions of the basemaps for Google Maps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const GOOGLE_MAP_ID = import.meta.env.VITE_GOOGLE_MAP_IDS;
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL;
const accessToken = import.meta.env.VITE_API_ACCESS_TOKEN;
const connectionName = import.meta.env.VITE_API_CONNECTION_NAME;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, we will add another PR to include connectionName in all the examples

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I change it in the .env like this?

VITE_API_CONNECTION_NAME= # TODO, will be add another PR to include connectionName in all the examples

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove the connection name in this example and open another PR to include the connection name in all the examples

@alasarr alasarr merged commit f4975b8 into master Nov 21, 2023
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

Successfully merging this pull request may close these issues.

3 participants