-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
RGeo::Geographic::SphericalPointImpl return nil #289
Comments
In pgadmin I can get "lonlat" : In my console or in rails I can't get "lonlat" : I don't understand why @poi = Poi.find(13) |
@Tioneb12 maybe this will help you find the issue: In an IRB console, try something like this: irb(main):007:0> parser = RGeo::WKRep::WKBParser.new
irb(main):008:0> parser.parse("0101000000959636C1DCE30740BFF1B567964F4640")
=> #<RGeo::Geos::CAPIPointImpl:0x2b14ab6c48b0 "POINT (2.9862609 44.6217775)"> You might also paste the actual WKB rather than an image of WKB. When I try with your WKB of irb(main):009:0> parser = RGeo::WKRep::WKBParser.new
irb(main):010:0> parser.parse('0101000020E6100000959636C1DCE30740BFF1B567964F4640')
Traceback (most recent call last):
1: from (irb):10
RGeo::Error::ParseError (Unknown type value: 536870913.) What projection is the data in? Not sure what it means at the moment, but some of the first bytes of WKB are different from your vs my working example:
Wonder what the different characters |
Thanks Pedros for your help. I use Rgeo 1.2.2 with srid 4326 Initializer.rb :
and I don't know what's "536870913" maybe my initializer is not good. I found this answer on the web : What must I do ? |
@Tioneb12 So does this work for you? parser = RGeo::WKRep::WKBParser.new
parser.parse("0101000000959636C1DCE30740BFF1B567964F4640") What is the output of In What happens if you delete your initializer, start a new console and try to Open a |
In config/database.yml, I have adapter: postgis If I delete my initializer I always have p.lonlat=nil
|
This is strange because, for example, this method (and others) works well :
|
Have you tried this initializer from the rgeo-activerecord README? # config/initializers/rgeo.rb
RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config|
# By default, use the GEOS implementation for spatial columns.
config.default = RGeo::Geos.factory_generator
# But use a geographic implementation for point columns.
config.register(RGeo::Geographic.spherical_factory(srid: 4326), geo_type: "point")
end |
I just tried to do that, but always have p.lonlat =nil |
I tried to do something about it :
It works !! Maybe, the problem would come from my method for set lonlat ?
But after update, if I go to my rails app, lonlat stay nill |
pry(main)> p = Poi.last
"lonlat" is not empty but...
pry(main)> p.lonlat => nil
for some method, "lonlat" work fine... for other not, for exemple :
return :
Why ? What's wrong ?
Thanks for your help
The text was updated successfully, but these errors were encountered: