Git Product home page Git Product logo

georuby's People

Contributors

bitdeli-chef avatar dougcole avatar ericduminil avatar gitter-badger avatar icco avatar kdelchev avatar kueda avatar lasssim avatar marcusmateus avatar nofxx avatar nolman avatar rossettistone avatar schleyfox avatar spone avatar tjdett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

georuby's Issues

Redirection to RGeo

Hi,

It looks like the project has been stale for some time now. As a maintainer of RGeo, I understand that these kind of gems need great support and we'd love to have more of the community involved.

What do we say we explicitely redirect to rgeo and/or ffi-geos from this gem, and mark it as deprecated so community efforts are more likely to be focused?

As part of this, of course, any feature that is present here, missing in rgeo, and wanted by anyone could be asked for in rgeo.

Cheers,
Ulysse

On Ruby 2.1.0 the HexEWKBParser fails to give correct results

h = "01010000207B000000CDCCCCCCCCCC28406666666666A64640"

f2 = GeometryFactory::new
ep = EWKBParser::new(f2)
e = [h].pack("H*")
ep.parse(e)
f2.geometry.x
=> 12.4

f1 = GeometryFactory::new
hp = HexEWKBParser::new(f1)
hp.parse(h)
f1.geometry.x
=> -3.495080594483092e-247

How to output a GeoJSONFeatureCollection?

Edit: Now I found out this is due to a conflict between Rail's ActiveSupport to_json and the json gem. Usage outside Rails environment works as intended. How to get around this?

I'm not sure if I'm using this functionality correctly or not, but I'm having trouble outputting a valid GeoJSON collection.

Example:
GeoJSONFeature.new(point1).to_json

Output:

{  
   "type":"Feature",
   "geometry":{  
      "type":"Point",
      "coordinates":[  
         121.4412656998513,
         31.2108137285587
      ]
   },
   "properties":{  
   }
}

But when a GeoJSONFeature is inside an array, it skips over its own GeoJSONFeature#to_json method (double checked with byebug) and is missing the "type": "Feature" attribute.

Example:
[GeoJSONFeature.new(point1)].to_json

Output:

[  
   {  
      "geometry":{  
         "type":"Point",
         "coordinates":[  
            121.4412656998513,
            31.2108137285587
         ]
      },
      "properties":{  
      },
      "id":null
   }
]

Finally putting it together with a FeatureCollection:

    features = [
      GeoJSONFeature.new(start_point),
      GeoJSONFeature.new(end_point)
    ]
    GeoJSONFeatureCollection.new(features)

Output (not valid GeoJSON):

{  
   "type":"FeatureCollection",
   "features":[  
      {  
         "geometry":{  
            "type":"Point",
            "coordinates":[  
               121.4412656998513,
               31.2108137285587
            ]
         },
         "properties":{  
         },
         "id":null
      },
      {  
         "geometry":{  
            "type":"Point",
            "coordinates":[  
               121.4569708797648,
               31.219778491221284
            ]
         },
         "properties":{  
         },
         "id":null
      }
   ]
}

GeoRuby::SimpleFeatures::EWKBFormatError errors

When my model refreshes, I'm getting this error sometimes:

Screen Shot 2021-01-16 at 8 12 33 PM

      def read_point
        i = @position
        @position += 16
        fail EWKBFormatError.new('Truncated data') if @ewkb.length < @position
        @ewkb.unpack("@#{i}#{@double_mark}#{@double_mark}@*")
      end

I'm getting this in my production and I also get it in my test cases intermittently. My testcases are threaded which is why I thought they were happening.

But... they are also happening on production which is not using threading and it is just normal Rails / Puma. It seems like there is some kind of race condition being hit when the database records are being refresh.

I'm using Sequel orm which might be the source, but I don't think that is causing it.

Can someone give me some insight why this might be happening intermittently?

Empty attribute table

The code

` require 'geo_ruby/shp'

GeoRuby::Shp4r::ShpFile.open(shpfile) do |shp|
shp.each do |shape|
geom = shape.geometry #a GeoRuby SimpleFeature
att_data = shape.data #a Hash
shp.fields.each do |field|
puts att_data[field.name]
end
end
end`

Does seem to get the geometry nicely, but the att_data is completely empty (nil values all over)

gem fails to load?

I've done all the diagnosis I know how to do, but can't get any of the georuby classes to become available. What am I missing?

$ uname -a
Linux linux 3.13.0-20-generic #42-Ubuntu SMP Fri Mar 28 09:56:33 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

$ irb
irb(main):001:0> require 'georuby'
=> true
irb(main):002:0> p = Point.new
NameError: uninitialized constant Point
from (irb):2
from /usr/bin/irb:12:in `

'
irb(main):003:0>

undefined method `as_json' for Hash

Irked by this when using GeoRuby standalone to modify GeoJSON files.

/Users/parker/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/georuby-2.2.1/lib/geo_ruby/geojson.rb:40:in `as_json': undefined method `as_json' for #<Hash:0x007fb57a945958> (NoMethodError)
    from /Users/parker/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/georuby-2.2.1/lib/geo_ruby/geojson.rb:44:in `to_json'
    from /Users/parker/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/georuby-2.2.1/lib/geo_ruby/geojson.rb:70:in `to_json'
    from /Users/parker/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/georuby-2.2.1/lib/geo_ruby/geojson.rb:70:in `to_json'

Do I need ActiveSupport? ActiveModel? If so, how can I avoid it?

kml_spec.rb failure

I get the following error message when running the tests:

Failures:

  1) GeoRuby::KmlParser should parse a GeoRuby::SimpleFeatures::LineString correctly
     Failure/Error: g.as_kml.gsub(/\n/,'').should eql(LINEARRING)
     SystemStackError:
       stack level too deep
     # ./lib/geo_ruby/simple_features/linear_ring.rb:18:in `orig_kml_representation'
     # ./lib/geo_ruby/simple_features/linear_ring.rb:18:in `orig_kml_representation'
     # ./lib/geo_ruby/simple_features/linear_ring.rb:18:in `kml_representation'
     # ./lib/geo_ruby/simple_features/geometry.rb:139:in `as_kml'
     # ./spec/geo_ruby/kml_spec.rb:40

Unable to connect to postgres without postGIS installed

My app connects to multiple databases via activerecord, some of which have postGIS and some do not.

When I use an AR class which connects to a db without postGIS,
I get a PG::Error (relation "geometry_columns" does not exist)
at spatial_adapter/postgresql.rb:216 in column_spatial_info.

I've been getting past this by including the following module in my AR objects, but would prefer a real fix.

module SupressSpatialCalculation # Since we dont have postGIS installed on this DB def column_spatial_info(column_name) {} end end

Would it make sense to handle this error within GeoRuby? (and maybe even disable the extra georuby features for that class when it's encountered)

*.SHP, *.SHX *.DBF files not supported (File extensions are capitalized)

if you have Shapefiles that have file extensions that are capitalized (i.e. shape_file.SHP instead of shape_file.shp), it throws a MalformedShpException despite the file(s) actually existing and being valid.

@file_root = file.gsub(/.shp$/i, '')

works as to pulling the correct root file because you are ignoring case.

However

unless File.exist?(@file_root + '.shp') && File.exist?(@file_root + '.dbf') && File.exist?(@file_root + '.shx')

fails to pick up the files because you are looking for files with the lower cased extensions.

Renaming all files from *.SHP to *.shp (etc) resolves the issue now, but would be nice if the code could figure this out.

can't convert String into Float

Since you were so quick to help before, i hope you dont mind another issue :). ive looked at the GeoRuby code in the backtrace and i'm a bit lost. I also hope this is enough information to be useful.
`

Location.create({:user_id=>51,"latitude"=>"45.51163136959076", "longitude"=>"-122.61863350868225", "altitude"=>"37.0", "accuracy"=>"16.0", "heading"=>"0.0", "velocity"=>"0.0", "timestamp"=>"2010-10-12T21:53:07+0000", "batterylevel"=>"43"}).errors.full_messages
TypeError: can't convert String into Float
from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/GeoRuby-1.3.4/lib/geo_ruby/simple_features/point.rb:133:in pack' from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/GeoRuby-1.3.4/lib/geo_ruby/simple_features/point.rb:133:inbinary_representation'
from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/GeoRuby-1.3.4/lib/geo_ruby/simple_features/geometry.rb:66:in as_ewkb' from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/GeoRuby-1.3.4/lib/geo_ruby/simple_features/geometry.rb:76:inas_hex_ewkb'
from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/postgis_adapter-0.7.8/lib/postgis_adapter.rb:114:in quote' from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/activerecord-2.3.8/lib/active_record/base.rb:3033:inblock in attributes_with_quotes'
`

Not able to access Dbf

Hi,

I have georuby 2.5.2 loaded and DBF 2.0.7. When I require 'geo_ruby/shp', the constant that I see loaded if DBF (all caps) and there is no Field function available. Any ideas on what I can try to get access to the Dbf method to allow access to the custom functions?

Thanks,

Scott

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.