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

chore: integrate map libre #61

Merged
merged 9 commits into from
Jan 7, 2025
Merged

chore: integrate map libre #61

merged 9 commits into from
Jan 7, 2025

Conversation

cimigree
Copy link
Contributor

closes #43

  • Adds the basic map libre map. I imagine there are specifications somewhere about which map package styler we want to use, but at this juncture, I am not sure what they are. This is just a cartoon globe at this point.
  • Adds a location context. I am not sure if this is necessary as I imagine coordinates will come from observations but I am adding it for now
  • If we want to use the built in geolocation in production, it looks like we need a Google Cloud Api key, which is why I provided an alternative to try

GOOGLE_API_KEY
Geolocation support in Electron requires the use of Google Cloud Platform's geolocation webservice. To enable this feature, acquire a Google API key and place the following code in your main process file, before opening any browser windows that will make geolocation requests:

process.env.GOOGLE_API_KEY = 'YOUR_KEY_HERE'

By default, a newly generated Google API key may not be allowed to make geolocation requests. To enable the geolocation webservice for your project, enable it through the API library.

N.B. You will need to add a Billing Account to the project associated to the API key for the geolocation webservice to work.

@cimigree cimigree requested a review from ErikSin December 13, 2024 21:36
@awana-lockfile-bot
Copy link

awana-lockfile-bot bot commented Jan 6, 2025

package-lock.json changes

Summary

Status Count
ADDED 41
UPDATED 1
Click to toggle table visibility
Name Status Previous Current
@mapbox/geojson-rewind ADDED - 0.5.2
@mapbox/point-geometry ADDED - 0.1.0
@mapbox/tiny-sdf ADDED - 2.0.6
@mapbox/vector-tile ADDED - 1.3.1
@mapbox/whoots-js ADDED - 3.1.0
@types/geojson-vt ADDED - 3.2.5
@types/geojson UPDATED 7946.0.14 7946.0.15
@types/mapbox__point-geometry ADDED - 0.1.4
@types/mapbox__vector-tile ADDED - 1.3.4
@types/pbf ADDED - 3.0.5
@types/supercluster ADDED - 7.1.3
@vis.gl/react-maplibre ADDED - 1.0.0-alpha.4
arr-union ADDED - 3.1.0
assign-symbols ADDED - 1.0.0
bytewise-core ADDED - 1.2.3
bytewise ADDED - 1.1.0
earcut ADDED - 3.0.1
extend-shallow ADDED - 2.0.1
geojson-vt ADDED - 4.0.2
get-value ADDED - 2.0.6
gl-matrix ADDED - 3.4.3
is-extendable ADDED - 0.1.1
is-plain-object ADDED - 2.0.4
isobject ADDED - 3.0.1
kdbush ADDED - 4.0.2
kind-of ADDED - 6.0.3
maplibre-gl ADDED - 5.0.0
murmurhash-js ADDED - 1.0.0
pbf ADDED - 3.3.0
potpack ADDED - 2.0.0
protocol-buffers-schema ADDED - 3.6.0
resolve-protobuf-schema ADDED - 2.1.0
set-value ADDED - 2.0.1
sort-asc ADDED - 0.2.0
sort-desc ADDED - 0.2.0
sort-object ADDED - 3.0.3
split-string ADDED - 3.1.0
supercluster ADDED - 8.0.1
typewise-core ADDED - 1.2.0
typewise ADDED - 1.0.3
union-value ADDED - 1.0.1
vt-pbf ADDED - 3.1.3

@cimigree cimigree requested review from achou11 and removed request for ErikSin January 6, 2025 16:10
package.json Outdated Show resolved Hide resolved
src/renderer/src/components/Map.tsx Show resolved Hide resolved
src/renderer/src/contexts/SharedLocationContext.tsx Outdated Show resolved Hide resolved
@cimigree cimigree requested a review from achou11 January 7, 2025 14:39
src/renderer/src/components/Map.tsx Outdated Show resolved Hide resolved
src/renderer/src/components/Map.tsx Outdated Show resolved Hide resolved
src/renderer/src/components/Map.tsx Outdated Show resolved Hide resolved
src/renderer/src/components/Map.tsx Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

revert the renaming of this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops

src/renderer/src/components/Map.tsx Show resolved Hide resolved
scrollZoom={true}
doubleClickZoom={true}
style={{ width: '100%', height: '100%' }}
mapStyle="https://demotiles.maplibre.org/style.json"
Copy link
Member

@achou11 achou11 Jan 7, 2025

Choose a reason for hiding this comment

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

for posterity: although I initially suggested using the hook here, it turns out that MapLibre dropped support for mapbox:// urls, which our default online style currently contains. there's a way of fixing that by using https://github.com/rowanwins/maplibregl-mapbox-request-transformer but it requires the renderer needing access to the the access token, which isn't ideal and probably prone to breaking under other circumstances. Will file an issue to fix the mapbox-specific urls in core but for now, i think it's okay to use the MapLibre demotiles url for the mapStyle, like you were doing before.

added an issue in core for this: digidem/comapeo-core#982

@cimigree cimigree requested a review from achou11 January 7, 2025 18:35
@cimigree cimigree merged commit 7380da9 into main Jan 7, 2025
4 checks passed
@cimigree cimigree deleted the chore/install-map-libre branch January 7, 2025 20:11
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.

Integrate Map-Libre
2 participants