Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the postgis adapter #117

Closed
wants to merge 1 commit into from
Closed

Support for the postgis adapter #117

wants to merge 1 commit into from

Conversation

babasbot
Copy link

The activerecord-postgis-adapter provides access to features of the PostGIS geospatial database from ActiveRecord. It extends the standard postgresql adapter to provide support for the spatial data types and features added by the PostGIS extension.

Changelog

  • Adds support for the postgis adapter.

Closes #116

POW(#{lng_degree_units}*(#{origin.lng}-#{qualified_lng_column_name}),2))
|
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected.

def flat_distance_sql(origin, lat_degree_units, lng_degree_units)
%|
SQRT(POW(#{lat_degree_units}*(#{origin.lat}-#{qualified_lat_column_name}),2)+
POW(#{lng_degree_units}*(#{origin.lng}-#{qualified_lng_column_name}),2))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [82/80]


def flat_distance_sql(origin, lat_degree_units, lng_degree_units)
%|
SQRT(POW(#{lat_degree_units}*(#{origin.lat}-#{qualified_lat_column_name}),2)+

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [87/80]

SIN(#{lat})*SIN(RADIANS(#{qualified_lat_column_name}))))*#{multiplier})
|
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected.

%|
(ACOS(least(1,COS(#{lat})*COS(#{lng})*COS(RADIANS(#{qualified_lat_column_name}))*COS(RADIANS(#{qualified_lng_column_name}))+
COS(#{lat})*SIN(#{lng})*COS(RADIANS(#{qualified_lat_column_name}))*SIN(RADIANS(#{qualified_lng_column_name}))+
SIN(#{lat})*SIN(RADIANS(#{qualified_lat_column_name}))))*#{multiplier})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [81/80]

def sphere_distance_sql(lat, lng, multiplier)
%|
(ACOS(least(1,COS(#{lat})*COS(#{lng})*COS(RADIANS(#{qualified_lat_column_name}))*COS(RADIANS(#{qualified_lng_column_name}))+
COS(#{lat})*SIN(#{lng})*COS(RADIANS(#{qualified_lat_column_name}))*SIN(RADIANS(#{qualified_lng_column_name}))+

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [120/80]


def sphere_distance_sql(lat, lng, multiplier)
%|
(ACOS(least(1,COS(#{lat})*COS(#{lng})*COS(RADIANS(#{qualified_lat_column_name}))*COS(RADIANS(#{qualified_lng_column_name}))+

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [134/80]

module Geokit
module Adapters
class PostGIS < Abstract

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected.

@@ -0,0 +1,22 @@
module Geokit

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing frozen string literal comment.

@coveralls
Copy link

coveralls commented Jan 19, 2017

Coverage Status

Coverage decreased (-0.6%) to 48.81% when pulling b6854d4 on babasbot:feature/postgis-adapter into 2a5dc8b on geokit:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 49.398% when pulling b6854d4 on babasbot:feature/postgis-adapter into 2a5dc8b on geokit:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 49.398% when pulling b6854d4 on babasbot:feature/postgis-adapter into 2a5dc8b on geokit:master.

@ylecuyer
Copy link

Why use PostGIS if you don't use the provided functions ST_Distance ST_Distance_Sphere...

@mnoack
Copy link
Member

mnoack commented Jul 22, 2017

Sorry @babasbot for not getting around to this. I've rebuilt the PR so it's now passing, the last remaining issues stopping me merging it are that it reduces coverage (so we should have a test to ensure this code doesn't just work now, but works well into the future).

And finally it would be good to address the comment made by another user here.

But otherwise I'm happy to merge.

@mnoack
Copy link
Member

mnoack commented Aug 6, 2017

Sorry @babasbot - Closing this as it hasn't been active. Feel free to write the test case and I'm happy to re-look at it (and most likely merge it)

@mnoack mnoack closed this Aug 6, 2017
@jon-sully
Copy link

I too ended up forking this repo just to add the duplicate postgis file. Worked fine. Given the dynamic require, there's no way to monkey-patch this from a code level — had to do the full fork process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for postgis adapter
6 participants