Created
March 15, 2018 15:00
-
-
Save januszm/b3b72a1ff2526d1f86e4744bb92d9844 to your computer and use it in GitHub Desktop.
Convert WKB data from PostGIS to GeoJSON
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
result = ActiveRecord::Base.connection.execute("select * from my_shapes_table limit 1;") | |
shape = parser.parse result.values.first.last # .first row , .last column | |
RGeo::GeoJSON.encode(shape).to_json | |
# => "{\"type\":\"MultiPolygon\",\"coordinates\":[[[[...]]]]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment