Skip to content

Cannot add valid geo json points #73

Description

@aunghtain

I have a location class and the only field is location.
class Address
include Mongoid::Document
include Mongoid::Geospatial

field :location, type: Point, sphere: true, delegate: true
spherical_index :location

end

Then, I try to create an address.

Address.create(location: Point.new(addr.lng, addr.lat).to_geo_json)

But it's giving an error, Hash must contain :x, :lon, :long, :lng, :longitude, 'x', 'lon', 'long', 'lng', 'longitude'

I need to use geo json point since I want to query for earth like sphere.

The issue is in point.rb where from_hash method isn't allowing the valid points.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions