anlek/mongify

Can't find geoencoding

Opened this issue · 7 comments

I tried searching for geo-location in mongify but it isn't there
i have two different columns as LAT and LONG

table "tbb_buddy_group" do
column "buddyGroupId", :integer
column "userId", :integer
column "LAT", :float
column "LNG", :float
column "groupId", :integer
column "floating_LAT", :float
column "floating_LNG", :float
end
how can i do geo-location using mongify ?

anlek commented

Wow, that's a great point, there isn't any geo-location setup, you might be able to do it via a before_save method.

before_Save do |row|
row.LAT = Array[row.LAT,row.LNG]
end

is this the right way ?
all i want is to merge LAT LNG in a single array

anlek commented

You might want to remove the original values from the record

before_save do |row|
  row.location = Array(row.delete(:LAT), row.delete(:LNG))
end

The value will be stored in your db under location

thanks for the update yesterday i did thanks for the delete row.delete
before_save do |row|
row.loc = Array[row.LAT,row.LNG]
end

anlek commented

Did it work out for you? If so, I can try adding it to the docs.

Yes yes I worked perfectly and please do add it in the docs
As it will be really helpful

Thanks 😊

hi everybody,
i need this also, the information provided here was helpful.
i will test this with my database and provide you with feedback.