Questions tagged [rgeo]

RGeo is a geospatial data library for Ruby.

RGeo is a geospatial data library for Ruby.

https://github.com/rgeo/rgeo

121 questions
0
votes
1 answer

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. ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR:…
Salman Haseeb Sheikh
  • 1,122
  • 2
  • 12
  • 20
0
votes
1 answer

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", "1617491"), lon1 = c(-115.032623, -115.155029,…
user9302275
0
votes
1 answer

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 gist of my outline.geojson: I want the intersection…
zippyferguson
  • 57
  • 2
  • 10
0
votes
1 answer

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 and vice versa. How do I compute pairwise distances…
Tomas
  • 57,621
  • 49
  • 238
  • 373
0
votes
1 answer

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, ?)) FROM trips WHERE…
Patrick
  • 1,046
  • 2
  • 10
  • 31
0
votes
1 answer

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 => :environment do CSV.foreach("uploads/regions.tsv", :col_sep => "\t",…
Jerome
  • 5,583
  • 3
  • 33
  • 76
0
votes
1 answer

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.19369999999992 33.73596500000008,…
gioch
  • 99
  • 3
  • 11
0
votes
1 answer

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 results. I have created a lonlat column in my…
RonLugge
  • 5,086
  • 5
  • 33
  • 61
0
votes
2 answers

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)) * 10 r[r>8] <- NA pol <- rasterToPolygons(r,…
0
votes
1 answer

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 wrong result: Place.all.where("ST_Contains(poly,…
Dan Donaldson
  • 1,061
  • 1
  • 8
  • 21
0
votes
1 answer

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. In their documentation they have this…
wuliwong
  • 4,238
  • 9
  • 41
  • 69
0
votes
1 answer

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=>{"type"=>"Polygon", "coordinates"=>[[[-82.5721,…
sakurashinken
  • 3,940
  • 8
  • 34
  • 67
0
votes
1 answer

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 inside and does not return row when point is…
Piotr Galas
  • 4,518
  • 2
  • 21
  • 30
0
votes
0 answers

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 name', geom: RGeo::Geographic.spherical_factory(:srid…
Keith Johnson
  • 730
  • 2
  • 9
  • 19
0
votes
1 answer

setting up RoR with rgeo on Elastic Beanstalk

I am trying to get my RoR app up and running on Elastic Beanstalk and am struggling to get the rgeo gem working. The error I am getting on the web server is: I, [2015-09-28T11:26:54.982049 #21789] INFO -- : Completed 500 Internal Server Error…
Mike
  • 1,031
  • 14
  • 36
1 2 3
8 9