Created
April 9, 2015 14:45
-
-
Save blackrez/a7b00b5a9fd5f3b553d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Le résultat retourné par BANO | |
result = '{"attribution": "BANO", "licence": "ODbL", "query": "8 bd du port", "type": "FeatureCollection", "version": "draft", "features": [{"properties": {"context": "80, Somme, Picardie", "housenumber": "8", "label": "8 Boulevard du Port 80000 Amiens", "postcode": "80000", "id": "800216590L", "score": 0.3351181818181818, "name": "8 Boulevard du Port", "city": "Amiens", "type": "housenumber"}, "geometry": {"type": "Point", "coordinates": [2.29009, 49.897446]}, "type": "Feature"}]}' | |
# On charge le résultat | |
resultjsoon = JSON.load(result) | |
# La partie geojson du json de bano est chargé pour obtenir un point | |
point = RGeo::GeoJSON.decode(resultjson["features"][0]["geometry"], :json_parser => :json) | |
entreprise = Entreprise.new() | |
# Correspondance entre le point et le champs géométrique de la base de données. | |
entreprise.geom = point | |
entreprise.save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment