ruby on rails - Database layout for an application with geocoding features using geokit -


I am developing a real estate web catalog and want to geocode every ad using geokit gem. My question is, what would be the best database layout from the display point, if I want to search the country, city of the selected country, administrative area or the nearest metro station of the selected city. Available countries, cities, administrative areas and metro sations should be defined by the administrator of the list and should be validated by geocoding

I came up with a single table.

  create_table "Geo_locations",: force = & gt; Is true T | . T.integer "geo_location_id" #parent Ground Locations ("Country" parent country of the former country city t.string is the ground location: Null => False #necessary for any geo location t.string "city" For #not the city is inaccessible and it is "premise_number" #thaus administrative_area t.string "administrative_area" for the geo location of the children and the children t.string metro station or street name for the place "thoroughfare_name" #not is null and this is t.float "LNG" number of children t.string: null => false t.float "lat" ,: null => false t.float "bound_sw_lat" ,: null = Gt; T.float "bound_sw_lng" ,: null => false t.float "bound_ne_lat" ,: null => false t.float "bound_ne_lng" ,: null => false t.integer "mappable_id" t .string "mappable_type" T.string "Type" #country, city, administrative area, metro station or end of address  

Address of the last geolocation marker on the marker of the real estate advertisement on it Map contains all the necessary information. But I'm still stuck on search functionality.

Any help would be highly appreciated.

You think that there is a look at the spinks, in which the geo-search has been supported. How do I do this?

  class company & lt; ActiveRecord :: Base define_index do index: name, sortable => true 'RADIANS (lat)',: as =>: latitude, type =>: 'radiance (lng)' in float ,: as =>: longitude companies Search for, find the nearest company first: "banana" ,: geo => [latitude, lng]:   :: type =>: float end  < / Pre> 
  order => "@Jodist ASC, @lelegence DESC"  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -