-
Notifications
You must be signed in to change notification settings - Fork 515
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
{ | ||
resolve: `gatsby-mapbox-locations`, | ||
options: { | ||
mapboxToken: process.env.MAPBOX_TOKEN, |
There was a problem hiding this comment.
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.
a875221
to
ef6f749
Compare
@smallbrownbike I'm cleaning up some of my old-ish PRs, you think we'll be able to merge/look into this, or should I close it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a MapboxLocation
schema so the build will run without a Mapbox token. This allows us to run the repo locally without a Mapbox token and add the token to production builds only in Vercel. Thus, we only query Mapbox on production builds, so we don't have to worry about hitting the Mapbox API limits!
@smallbrownbike That's awesome, I'm not well-versed in Gatsby, so thank you for adding that! It's probably a good idea to create a PostHog token rather than using mine, though. Do you want me to handle this, or will you? |
@rafaeelaudibert Should be all set now! |
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
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.