Skip to content

Read persisted GeoJSON Point coordinates - #81

Merged
dblock merged 1 commit into
masterfrom
dblock/geojson-points
Nov 24, 2026
Merged

dblock merged 1 commit into
masterfrom
dblock/geojson-points

Conversation

@dblock

@dblock dblock commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #73.

GeoJSON input is already accepted during assignment, but Point demongoization treated persisted GeoJSON hashes as positional arguments. Extract coordinates when loading a GeoJSON hash or BSON document, while preserving the existing array path and storage format.

Adds coverage for symbol/string keys and BSON documents, GeoJSON assignment to a spherical field, and direct GeoJSON writes to MongoDB followed by reload and real spherical queries. Documents that sphere indexing does not require changing legacy point-array storage.

Independent of the RGeo factory fix in #80; both PRs target master directly.

Prepared by an AI on behalf of @dblock.

Version

This changes how persisted points are read, so it sets the next release to 7.5.0: Mongoid::Geospatial::VERSION goes from 7.4.3 to 7.5.0, and the CHANGELOG heading becomes ## 7.5.0 (Next) with its entries unchanged. 7.4.3 was never published; RubyGems has 7.4.2 as the latest.

Rebase onto master

This update was made by an AI (Claude) on behalf of @dblock.

)

expect(alarm.reload.spot.to_a).to eq([10, -9])
expect(Alarm.within([10, -9], 1).to_a.map { |match| match.spot.to_a }).to eq([[10, -9]])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Metrics/LineLength: Line is too long. [92/80]

@coveralls

coveralls commented Oct 18, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 98.623% (+0.004%) from 98.619% — dblock/geojson-points into master

Cover GeoJSON assignment, persisted BSON points, and real spherical queries without changing legacy array storage. Refs #73.

This changes how persisted points are read, so the next release becomes 7.5.0
instead of 7.4.3, which was never published. Combine the GeoJSON read with
the empty-array handling from #77, and add demongoize and demongoizes to the
spelling vocabulary and the #77 spec to the block-length exclusions so lint
passes again on master.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Gr21iR4JxWxGGyXdJ3uc9
@dblock
dblock force-pushed the dblock/geojson-points branch from 87d490f to 1ec7d78 Compare November 24, 2026 19:11
@dblock
dblock merged commit 58e70bb into master Nov 24, 2026
6 checks passed
@dblock
dblock deleted the dblock/geojson-points branch November 24, 2026 19:19
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.

Cannot add valid geo json points

3 participants