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

feat: Programatically add dots to map #10225

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rafaeelaudibert
Copy link
Member

@rafaeelaudibert rafaeelaudibert commented Dec 26, 2024

Not many people online, and I chose to work on something fun today :)

Instead of having a hardcoded list of dots in our map, we're now collecting the latitude/longitude information from the information we're already collecting from everyone working at PostHog. We're doing some geocoding to transform that information into lat/long pairs.

There are some problems with the fact that there isn't much uniformity in the way everyone stores their information, so some dots are extremely inaccurate.

I've attempted the following pairs and they don't work that well

  • Location
  • Location, Country
  • Location | Country

I ultimately settled with the last one because it looks the most accurate, but there are still errors.

My suggestion: we should suggest everyone to fill their "Location" field with either a "city, country" tuple or simply the long form of their country name, which should make the map more accurate.

Before After
image image

Copy link

vercel bot commented Dec 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog ✅ Ready (Inspect) Visit Preview Jan 2, 2025 7:54pm

{
resolve: `gatsby-mapbox-locations`,
options: {
mapboxToken: process.env.MAPBOX_TOKEN,
Copy link
Member Author

Choose a reason for hiding this comment

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

My biggest concern is this.

I set this on Vercel already, I'm using a private token, but I'm happy to create a PostHog one. They have 50,000 requests/month for free, so we shouldn't hit that from production alone, but everytime we run this locally and/or create a preview environment, we'll fetch all of the latitude/longitudes. I'm pretty sure we'll eventually go over 50k/month if we do that. I'm not really sure it's worth it, though.

Other solutions:

  • Just add a new latitude/longitude field to our Squeak profile and fetch it from there
  • Use their enterprise plan and cache requests, should make it free IIUC?

Instead of having a hardcoded list of dots in our map, we're now collecting the latitude/longitude information from the information we're already collecting from everyone working at PostHog. We're doing some geocoding to transform that information into lat/long pairs.

There are some problems with the fact that there isn't much uniformity in the way everyone stores their information, so some dots are extremely innacurate.

I've attempted the following pairs and they don't work that well
- Location
- Location, Country
- Location | Country

I ultimately settled with the last one because it looks the most accurate - but there are errors still.

My suggestion: we should suggest everyone to fill their "Location" field with either a "city, country" tuple or simply the long form of their country name, which **should** make the map more accurate.
@rafaeelaudibert rafaeelaudibert force-pushed the programatically-add-dots-to-map branch from a875221 to ef6f749 Compare December 26, 2024 22:49
@rafaeelaudibert
Copy link
Member Author

Minor minor minor

BTW, there's room to add more people to that map, the code is ready already, we just need a competition to figure out who are the (un)lucky few :)

image

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.

1 participant