Questions tagged [rgeo]

RGeo is a geospatial data library for Ruby.

Filter by
Sorted by
Tagged with
0 votes
1 answer
81 views

RGeo: Plotting a Great Circle on a Mercator Projection

I need to trace out multiple shapes on a map, each shape is specified as a type of line between two long/lat coordinates. I have been breaking/interpolating/splitting these lines into a series of ...
Ben M's user avatar
  • 1
0 votes
1 answer
70 views

point.in.poly function does not work because it is deprecated?

I've extracted coordinates for some address using Open Street Map in R and to ensure geocoding is correct, I want to check if the coordinates I found fall within the citys' boundaries. cities <- ...
kiyis_stats's user avatar
1 vote
0 answers
39 views

testing projects that use RGeo on GitHub Actions

For a project that uses RGeo, I can't for the life of me find the magic combination to get it to work on GitHub Actions. Please answer if you've actually got it working on GitHub Actions. Gemfile ... ...
jnicho02's user avatar
  • 2,597
0 votes
0 answers
14 views

Defining start point from a SpatialLineDataFrame

There's a SpatialLineDataFrame where It is needed to discover coordinates along it's extention by odometric position, e.g. what's the coordinate of the point 2525m from the beginning of the line? I ...
Diogo Bichon's user avatar
1 vote
1 answer
180 views

rgeo: distance calculation between a point and a line

I am working on a hotel application (using ruby on rails), and I am trying to calculate the distance between an hotel and the sea. I have gathered the geometry of the shoreline points in a geojson ...
Quentin Gaultier's user avatar
1 vote
0 answers
29 views

Multi_line_string stay nil after update

I added a multi_line_string field in my database : t.geometry "zmpath", limit: {:srid=>4326, :type=>"multi_line_string", :has_z=>true, :has_m=>true} If I update my ...
Ben's user avatar
  • 680
0 votes
1 answer
107 views

RGeo Points not saved in ActiveRecord Postgis table (nil)

I have a Rails 6.1.4.1 app using Postgis database (Docker image: postgis/postgis:13-3.1-alpine). I try to save geographic points in the attribute lonlat of my Branch model. ANY attempt to save my ...
Jan's user avatar
  • 13.9k
0 votes
1 answer
285 views

Issue with RGeo / GeoJSON / LinearRing failed ring test / EPSG 3857 vs EPSG: 4326

My overall goal is to answer, "Does this point intersect with this geojson object" I am attempting to do this with the following code: boundaries = {...} # geojson object point = RGeo::...
earnold's user avatar
  • 1,462
2 votes
2 answers
482 views

How do I find the nearest location in a separate list of coordinates in r?

Given a list of event locations: event.coords <- data.frame( event.id = letters[1:5], lats = c(43.155, 37.804, 26.71, 35.466, 40.783), lons = c(-77.616,-122.271, -80.064, -97.513, -73....
conflictcoder's user avatar
0 votes
1 answer
110 views

Why does rgeo have CAPI and FFI factories to achieve the same goal?

If I understand the Rgeo doc & code correctly, there's CAPIFactory which is supposed to link to GEOS and there is FFIFactory using ffi-geos gem which links to GEOS using FFI. Both of these seem to ...
Rahul's user avatar
  • 1,495
0 votes
1 answer
102 views

Convert from ESPG 4326 to ESPG 3758

I am having a problem with converting geometry data in my rails application project. Currently, I am having one database storing data with SRID 4326 and I need to move it to another database that uses ...
Sokmesa Khiev's user avatar
0 votes
1 answer
433 views

Calculating area with RGeo and Geojson

I have a multi-polygon defined in geojson. I am trying to calculate its area. When I traverse the ostensible code path, I am getting very confusing results. I suspect this is because I am using some ...
earnold's user avatar
  • 1,462
1 vote
1 answer
75 views

rgeo point near MULTILINESTRING

Having a geometry column wkb_geometry, srid 4326 that is a MULTILINESTRING I would like to determine which of these records are within a predetermined distance (say 5000m) of a geometry object POINT ...
Jerome's user avatar
  • 5,747
3 votes
3 answers
1k 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 ...
Jake L's user avatar
  • 987
0 votes
1 answer
1k 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 ...
Jake L's user avatar
  • 987
2 votes
2 answers
527 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 ...
user2099762's user avatar
1 vote
2 answers
505 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 =...
Sunil's user avatar
  • 3,434
0 votes
1 answer
926 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 ...
Maximilien de Weekendr's user avatar
1 vote
1 answer
835 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 =...
elkarel's user avatar
  • 723
0 votes
1 answer
235 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. ...
Salman Haseeb Sheikh's user avatar
0 votes
1 answer
232 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", "...
user avatar
0 votes
1 answer
460 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 ...
zippyferguson's user avatar
2 votes
2 answers
2k 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 ...
Yarin's user avatar
  • 176k
3 votes
2 answers
292 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 --...
Daniel Nadasan's user avatar
0 votes
1 answer
72 views

Compute pairwise distances between two layers

In R, I have polygon layer A and point layer B. Both have the same number of features, there is one-to-one correspondence (pairing): each polygon of the layer A has a corresponding point in layer B ...
Tomas's user avatar
  • 58.1k
1 vote
1 answer
505 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;...
Glenn's user avatar
  • 560
1 vote
1 answer
317 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 ...
millisami's user avatar
  • 9,969
1 vote
0 answers
122 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 ...
ZZzzZZzz's user avatar
  • 1,830
0 votes
1 answer
223 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, ?)...
Patrick's user avatar
  • 1,056
1 vote
1 answer
627 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 ...
channa ly's user avatar
  • 9,539
2 votes
1 answer
412 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. {"...
Jerome's user avatar
  • 5,747
0 votes
1 answer
25 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 => :...
Jerome's user avatar
  • 5,747
0 votes
1 answer
287 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....
gioch's user avatar
  • 99
1 vote
2 answers
1k 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: ...
Kale Manatee's user avatar
0 votes
1 answer
172 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 ...
RonLugge's user avatar
  • 5,106
1 vote
1 answer
586 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 '...
Ben's user avatar
  • 680
0 votes
2 answers
1k 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)) * ...
Forrest Williams's user avatar
0 votes
1 answer
641 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 ...
Dan Donaldson's user avatar
5 votes
1 answer
4k 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 ...
nattfodd's user avatar
  • 1,800
2 votes
2 answers
2k 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, ...
nattfodd's user avatar
  • 1,800
0 votes
1 answer
341 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. ...
wuliwong's user avatar
  • 4,278
0 votes
1 answer
930 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=>{"...
sakurashinken's user avatar
3 votes
3 answers
3k 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 ...
Facundo Laxalde's user avatar
1 vote
1 answer
308 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| ...
Will's user avatar
  • 4,554
4 votes
1 answer
2k 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 ...
Konrad's user avatar
  • 17.9k
0 votes
1 answer
347 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 ...
Piotr Galas's user avatar
  • 4,598
1 vote
1 answer
1k 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 ...
hguzman's user avatar
  • 311
2 votes
1 answer
430 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: ...
Chmen Nalivnik's user avatar
2 votes
2 answers
749 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, ...
wildrhombus's user avatar
2 votes
0 answers
130 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. ...
Ivan's user avatar
  • 93