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

MapView.getPointInView returns array instead of GeoJSON Point #600

Closed
brentforder opened this issue Jan 11, 2025 · 1 comment
Closed

MapView.getPointInView returns array instead of GeoJSON Point #600

brentforder opened this issue Jan 11, 2025 · 1 comment

Comments

@brentforder
Copy link

brentforder commented Jan 11, 2025

Steps to Trigger Behavior

  1. Get a reference to a MapView
  2. Execute MapView.getPointInView() with a GeoJSON.Position parameter containing geographic coordinates
  3. Check the output value with JSON.stringify or Array.isArray

Expected Behavior

Either:

  • A) Output is a GeoJSON.Point, as per the getPointInView method signature
  • B) The method signature is [number, number] or GeoJSON.Position

Actual Behavior

  • Output is an array of view coordinates, in defiance of it's method signature

Environment

  • Platform: Android
  • OS version: Android 15
  • Device type: Pixel 8
  • Emulator or Simulator: no
  • Development OS: Windows 11
  • @maplibre/maplibre-react-native Version: 10.0.0-beta.19
  • MapLibre Native Version: default
  • react-native Version: 0.76.6
  • expo Version: 52.0.25

Notes

I'm not sure yet if this is restricted to Android or due to a recent MLRN change.

In Typescript, a workaround is to cast the output of getPointInView to "unknown as [number, number]", i.e.

const mapViewPoint = mapViewReference.getPointInView(geographicCoordinates);
return mapViewPoint as unknown as [number, number];

... And then just treat it as [number, number] or GeoJSON.Position

GeoJSON implies geographic coordinates, so I think [number, number] makes more sense.

Copy link

🎉 This issue has been resolved in version 10.0.0-beta.20 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

2 participants