Questions tagged [rgeo]
RGeo is a geospatial data library for Ruby.
110
questions
0
votes
0answers
17 views
Get closest point index on a line in rgeo or postgis
I'm trying to figure out if there is a method in rgeo or a way to calculate this in ruby or a way to do it in PostGis quickly.
I have a line that splits multiple polygons. I run a query in PostGis ...
0
votes
1answer
28 views
RStudio graphics device really slow for spatial objects on mac
I recently got a new macbook pro and am having some R graphics related problems on it. R is working insanely slowly when plotting sf objects. I found a thread that's a couple of years old on this ...
-1
votes
1answer
27 views
change projection on geom_sf map
I need to map the east coast of US and Canada with ggplot and geom_sf, but I want to do so with a projection that will make Florida to Nova Scotia less exaggerated from East to West, such as Lambert ...
1
vote
0answers
32 views
RGeo::Geos.supported? shows as false even with -dev packages and symlink in place
Trying to get the rgeo gem to recognise geos on an ubuntu 16.04 system.
I have the following packages installed:-
libgeos-dev, libgeos++-dev and libgeos-3.7.1
geos-config --version
3.7.1
I have a ...
1
vote
2answers
110 views
Is it possible to Azimuthal equidistant projection and create a buffer polygon in Ruby
I have found this code in stack overflow to do Azimuthal equidistant projection and create a buffer polygon in Python.
aeqd_proj = '+proj=aeqd +lat_0={lat} +lon_0={lon} +x_0=0 +y_0=0'
project =...
0
votes
1answer
86 views
NameError: uninitialized constant ActiveRecord::ConnectionAdapters::PostgreSQL::ColumnDefinition with gem activerecord-postgis-adapter
I want add to an existing data base the postgis extension with rails as an environment.
I have identified the rgeo gem associated with the activerecord-postgis-adapter gem
I did the classic bundle ...
1
vote
1answer
121 views
RGeo: How to transform a projected coordinate to lat/lon using SRID
I'd like to transform a point in projected coordinates to lat/lon.
I've read this blog post about transformations and I came up with the following code:
factory_25831 = RGeo::Cartesian.factory(:srid =...
0
votes
1answer
79 views
Postgis is not setting up in Rails application
I am integrating PostGIS in a rails application and following their documentation https://github.com/rgeo/activerecord-postgis-adapter.
At this step
rake db:create
I get the following error.
...
0
votes
1answer
70 views
Calculating the distance between two long/lat points in the same data.frame
For starters, here is the table structure I'm using:
df <- structure(list(customer_id = c(353808874L, 69516747L, 357032052L,
307735090L, 307767260L), id = c("8474", "8107",
"1617436", "7698", "...
0
votes
1answer
115 views
How to do an intersection of geojson with rgeo?
I am new to ruby and experimenting with rgeo.
I have 2 geojson files:
points.geojson contains a number of points
here is a gist of points.geojson
outline.geojson contains a single polygon
here is a ...
2
votes
2answers
762 views
Getting InvalidGeometry: LinearRing failed ring test after upgrading rgeo gem
After upgrading the rgeo gem from 0.6.0 to 2.1.1, we've started to get 'LinearRing failed ring test' on certain geometries that never caused us problems before. (The geometry data is generated from ...
2
votes
1answer
126 views
Rails RGeo::Geos.supported? false on rails c, but true on irb
I'm using the rgeo gem which gives me troubles on the production server, although it works on my local machine.
This outputs are same on both local MacOS and Ubuntu 16.04 production machine:
psql --...
1
vote
1answer
178 views
Find polygons contained inside polygon using RGeo, PostGIS and ST_Contains
I have two models: Search (geom saved on attribute area) and Land (geom saved on attribute geom).
Land is imported from an external service and is saved to DB with specific SRID. EG:
SRID=28992;...
1
vote
1answer
106 views
RGeo::Geos.supported? true in irb but false with bundler in macOS mojave
In macOS mojave gem install rgeo installs and in irb RGeo::Geos.supported? returns true
Now after doing bundle install and going to rails console via bundle exec rails c, it returns false.
How to ...
1
vote
0answers
51 views
How to separate POLYGONS from MULTIPOLYGON in Ruby
I was checking RGeo and did not find a way to check if a provided data in a GeoJSON in MultiPolygon is a inner ring or exterior ring (I was checking this to just separate out MultiPolygon into ...
0
votes
1answer
122 views
Calling PostGIS functions within Ruby
I need to execute the PostGIS function st_intersection within an SQL SELECT clause in Ruby. At the moment I am doing it as raw SQL query:
sql_query = "SELECT id, ST_ASEWKT(ST_INTERSECTION(geometry, ?)...
1
vote
1answer
252 views
How to find the Closest point of a line string to a given location - rgeo
My point coordinates are in geographic coordinate systems. They are in memory. I need to find the nearest point on the line string to a given point using RGeo library from Ruby.
My scenario is the ...
2
votes
1answer
214 views
RGeo::GeoJSON not decoding and returning geometry as_text for 'doughnut' polygon
Some geographical regions are areas that surround a major metropolitain city, where each is a distinct administrative area. This is the case of the capitals of Switzerland (de facto) and Brazil.
{"...
0
votes
1answer
15 views
quoting error importing JSON formatted column of geographical object via CSV into rails + postgresql/postgis
data structure:
create_table "regionpolygons", force: :cascade do |t|
t.geometry "rawdata", limit: {:srid=>0, :type=>"geometry"}
A CSV import file
task :load_geometry_data => :...
0
votes
1answer
151 views
Find record by lat / lon in rails-postgres-rgeo project
Having Table Neighborhoods, which looks like this:
id: 1,
title: "Sun City",
state: "CA",
geometry: "MULTIPOLYGON (((-117.1935499999999 33.74306900000005, -117.1935729999999 33.74198700000005, -117....
0
votes
2answers
641 views
Rails / PostGIS / RGeo Error: NoMethodError: undefined method `factory' for RGeo::GeoJSON::Feature
I am using Ruby on Rails and PostGIS to store GeoJSON map data in a model called, "Map". When I save an object loaded successfully with a simple GeoJSON feature I get the error, "NoMethodError: ...
0
votes
1answer
109 views
Why isn't POSTGIS / RGEO loading the right point type when reading location data from the DB?
So I'm trying to get up to speed on location based programming in Rails for a project. In summary, my database data appears to be correct, but I can't get the rails in-memory logic to get correct ...
0
votes
1answer
353 views
Try to use Rgeo with rails
I'm a newbie on rails and tried using Rgeo and GeoJSON.
I want to extract GeoJSON from my data to use in leaflet.
What is the proper way to install GeoJSON (and/or place).
Gemfile :
gem '...
0
votes
2answers
713 views
Dissolve output of rasterToPolygons
When using rasterToPolygons within the raster package each cell that meets the formula criteria becomes its own polygon:
library(raster)
r <- raster(nrow=18, ncol=36)
r[] <- runif(ncell(r)) * ...
1
vote
0answers
210 views
PostGIS not working properly on Heroku
Added postGIS to heroku database and checked if it is installed. But it does not recognize rgeo and postgis methods.
My coordinates are type :geometry. Local is all fine but on production WKT format ...
0
votes
1answer
402 views
RGeo contains? on Model
I need to find all the instances of a class Place where its polygon attribute contains a point supplied, as in Place.for_point(pt).
==== added ====
Ok, I can get this query to execute, but with the ...
5
votes
1answer
2k views
RGeo - fix self-intersections
I have a bunch of polygons that have self-intersection which causes some errors in further postprocessing them (in particular - I can't calculate intersection area of those polygons with other ...
1
vote
2answers
921 views
Convert Polygon to MultiPolygon using RGeo gem
I have a legacy areas data, where some records are in Polygon and some in MultiPolygon format stored in noSQL DB in JSON format. I need to migrate that data to a PostGIS database with area column, ...
0
votes
1answer
191 views
How to determine if a lat/lon pair is located inside of a shapefile polygon
I am using the rgeo and rgeo-shapefile gems in my Rails 5 application. My goal is to load in a shapefile of neighborhoods and determine which neighborhood a latitude/longitude point is located within.
...
0
votes
1answer
629 views
What is the best way to remove duplicate points from a geojson polygon in ruby?
I am using the rgeo ruby library to parse out geojson polygons. The behavior is to return nil when calling decode on a polygon with duplicate points as in the following example:
geom = {:geom=>{"...
2
votes
3answers
2k views
Point in polygon rgeo
I need to know if a point is in a polygon or not, in my rails app, in order to to that I wan to use rgeo gem.
To install this geme i folowed the instructions on rgeo git
Then I'm sure that GEOS and ...
1
vote
1answer
150 views
How to output geojson from a collection
I want to output a geojson file from my rails app using rgeo-geojson. I have a table of points each with lat and long.
I have my controller set up in the standard way
respond_to do |format|
...
3
votes
1answer
1k views
Simplifying polygons in rgeos and maintaining data in SpatialPolygonsDataFrame
Background
I'm interested in simplifying polygons with use of the gSimplify function available through the rgeos package.
Reproducible example
A reproducible example can be generated with use of ...
0
votes
1answer
228 views
How to find all polygons thats includes special lat long point
I use rgeo and activerecord-postgis-adapter gem. I want to find all records where special point is included in polygon. I marked rectangular on google map and expect that sql return row if point is ...
1
vote
1answer
722 views
I want to save GeoJSON polygon
I want to save a polygon.
This is Geojson enter link description here
str1 = "geojson....."
geom = RGeo::GeoJSON.decode(str1, json_parser: :json)
l = Limit.new
l.multipoligono = geom
l.save
...
2
votes
1answer
319 views
How to edit GeoJSON data in rails view?
I want to have ability to edit GeoJSON data as text, in edit page. I use Rails, PostgreSQL with activerecord-postgis-adapter. For encoding data I use rgeo-geojson.
My show view works fine, I encode:
...
2
votes
2answers
506 views
Using activerecord-postgis-adapter and point is not cast as spherical
I'm trying to create a basic app using the activerecord-postgis-adapter gem and am following the instructions in the readme.
According to the readme, a point is supposed to use the spherical factory, ...
2
votes
0answers
83 views
ArgumentError when storing point using RGeo
I'm having some trouble storing a point in RGeo.
initializer/rgeo.rb
RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config|
# By default, use the GEOS implementation for spatial columns.
...
5
votes
1answer
346 views
RGeo The union of two MultyPolygons is returning nil
I want to create a new MultiPolygon from the union of two geometries, but it returns nil.
multipolygon_1 = RGeo::Geos.factory(srid: 4326).parse_wkt("MULTIPOLYGON ...")
multipolygon_2 = RGeo::Geos....
4
votes
2answers
965 views
Problems with RGeo intersection functions
I'm getting strange/incorrect results from RGeo polygon intersection functions (Ruby 2.3.0, RGeo 0.5.3)
EXAMPLE 1:
I have two polygons which I believe share a boundary but do not share any internal ...
2
votes
1answer
997 views
Storing Google Maps geo data with Rails / PostGIS / RGeo
Having trouble implementing Daniel Azuma's solution for handling Google Maps geo data with RGeo / Rails.
SETUP
locations table:
create_table "locations", force: :cascade do |t|
t.string &...
3
votes
1answer
569 views
Installing GEOS on Heroku
I'm trying to deploy a Rails app (ruby 2.3.0, rails 4.2.6) to Heroku that uses the RGeo gem, but I'm having no luck installing the underlying GEOS library upon which the RGeo gem relies (See https://...
2
votes
1answer
502 views
How to set up a postgis-adaptered Ruby on Rails app for Heroku deployment?
I have the following:
Gems:
gem 'pg', '~> 0.18'
gem 'activerecord-postgis-adapter', '4.0.0'
gem 'rgeo-geojson'
Initializer: config/initializers/rgeo.rb
require 'rgeo-activerecord'
RGeo::...
1
vote
0answers
300 views
How to save google.maps.Data.MultiPolygon to geometry datatype column in postgres database in rails?
I am a beginner in rails framework, so please pardon my naive question. I have a google.maps.Data.MultiPolygon object on my frontend which I want to save in my database. The table searches creates a ...
2
votes
2answers
888 views
polygon 'contains' and other operations on geometries not supported
I'm quite new to postgis and rgeo. I suspect I may be tackling things in the wrong way but I have been a bit surprised to find out a few operations, in particular contains & within, aren't ...
1
vote
0answers
248 views
R polygons within boundaries
I am trying to get all polygons that are within leaflet map boundaries. No need to bother about leaflet, the question is more about rgeos or other methods (or primarily about correct function). I ...
0
votes
0answers
63 views
Rgeo, activerecord-postgis-adapter does't fire SQL statements for attributes of type point
So I'm running rgeo with activerecord-postgis-adapter and have a Rails 4 app's db.yml file set up correctly.
But when I set the attributes of a ActiveRecord model like:
Place
.create(name: 'some ...
2
votes
1answer
418 views
Order by Nearest using PostGIS, RGeo, Spatial Adapter
I'm asking this question because the answers I've found in Order by nearest - PostGIS, GeoRuby, spatial_adapter wasn't able to provide a solution. I'm trying to create a controller method that can ...
6
votes
1answer
336 views
RGeo convex hull of list of points
RGeo has convex hull method available, but no documentation at all in this matter.
Given set of Points, how to I find their convex hull?
2
votes
0answers
270 views
RGEo cast error after update Rails
I updated Rails version to 4.2 and then my test are failing when Rgeo gem is used. It seems that there is something wrong with the attributes types on the tables.
can't cast RGeo::Geographic::...