Geolocation breaks when crossing longitude 180

Open
#873 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
50/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
frontend

Research direction

Reproduce the issue with any geoshape map by dragging a point across longitude 180°, then test selecting it again and using geofence behavior. Trace the geoshape map interaction and geofence handling; done means points remain editable, repeated crossings do not make them disappear, and shapes retain the expected geometry.

Written by the indexing model from the issue text.

Description

Expected Behaviour

It should be possible to create a shape that crosses over 180° longitude. Or if not, at least don't let me drag a point so that it breaks the UI.

Observed Behaviour

A few bugs...

  1. If you drag a point of a geoshape over the 180° then it wraps around to other side of the map (which is good) but then becomes uneditable.
  2. If you use geofence on this shape then it produces unexpected results, because the point you moved is now at a negative longitude, not a positive one, so the geofence algorithm inverts the shape. For example, imagine you had a triangle in the shape of an arrow head pointing the the right and had a point inside the geofence. Now if you drag the third point over the 180° line then it "flips" the arrow to point to the left, and the point is no longer inside the geofence. This is unexpected.
  3. If you drag a geopoint over, then it wraps to the other side of the map. If you drag it over the 180° a second time it disappears altogether.
  4. It's quite difficult to move a point near the 180° line because the map doesn't all you to scroll past the 180° line so certain places are always stuck in the corner. #mapswithoutnz
Image
Reproduction Steps

Form (XML or XLSX file): Any geoshape map

Steps:

  1. Create a shape
  2. Drag one of the points off to the right until it pops out of the left hand side
  3. Try and select and move the point again
Screenshots or Videos
Environment
  • Browser version: Firefox
  • OS: Linux
  • Web Forms version: 1.0.2
Additional Context
Dominant language
TypeScript
Stars
38
Forks
24
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getodk/web-forms

All issues in getodk/web-forms

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.