gis-protobuf 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +2 -0
- data/Gemfile +6 -0
- data/README.md +249 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gis-protobuf.gemspec +28 -0
- data/lib/gis/protobuf.rb +111 -0
- data/lib/gis/protobuf/linestring_pb.rb +29 -0
- data/lib/gis/protobuf/point_pb.rb +31 -0
- data/lib/gis/protobuf/polygon_pb.rb +29 -0
- data/lib/gis/protobuf/version.rb +5 -0
- metadata +112 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: 46de2b123e6dc0eaf53c5ae5733a846b8c42c7ae
         | 
| 4 | 
            +
              data.tar.gz: 3e0e8cd81186c3dc858b9b5c623cc688b11accad
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: c232ac18f7d6a5d6e3018135db5c0505363cc635c800fca13659921a7914e712988617e49f3005a4206118626f46bfb33ae6358f30d28273600ceccbcb6f3d8d
         | 
| 7 | 
            +
              data.tar.gz: cb90b7f34d1af381f55e05b45958ba95b779189ab41e2fc65cab79b7f77376d2cf8b0a791c76c85757f62a5f9bf8fb3df1686bb53007ac0687b073f9ddf816f1
         | 
    
        data/.rspec
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,249 @@ | |
| 1 | 
            +
            # Gis::Protobuf
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## Installation
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            Add this line to your application's Gemfile:
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ```ruby
         | 
| 10 | 
            +
            gem 'gis-protobuf'
         | 
| 11 | 
            +
            ```
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            And then execute:
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ~~~sh
         | 
| 16 | 
            +
            bundle
         | 
| 17 | 
            +
            ~~~
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            Or install it yourself as:
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            ~~~sh
         | 
| 22 | 
            +
            gem install gis-protobuf
         | 
| 23 | 
            +
            ~~~
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            ## Additional functions
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            All messages has function `toGeoJSON` that returns a GeoJSON representation of a message.
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            ## Messages
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            ### Point
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            ~~~
         | 
| 34 | 
            +
            syntax = "proto3";
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            import "gis/protobuf/point.proto";
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            package test;
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            message Test {
         | 
| 41 | 
            +
              gis.protobuf.Point2D point2d = 1;
         | 
| 42 | 
            +
              gis.protobuf.Point3D point3d = 2;
         | 
| 43 | 
            +
              gis.protobuf.MultiPoint2D multi_point2d = 3;
         | 
| 44 | 
            +
              gis.protobuf.MultiPoint3D multi_point3d = 4;
         | 
| 45 | 
            +
            }
         | 
| 46 | 
            +
            ~~~
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            #### Point2D
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            Structure with two fields of type `float`: `x` and `y`.
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            GeoJSON representation of this message is
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            ~~~ruby
         | 
| 55 | 
            +
            { :type => 'Point', :coordinates => [x, y] }
         | 
| 56 | 
            +
            ~~~
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            #### Point3D
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            Structure with three fields of type `float`: `x`, `y` and `z`.
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            GeoJSON representation of this message is
         | 
| 63 | 
            +
             | 
| 64 | 
            +
            ~~~ruby
         | 
| 65 | 
            +
            { :type => 'Point', :coordinates => [x, y, z] }
         | 
| 66 | 
            +
            ~~~
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            #### MultiPoint2D
         | 
| 69 | 
            +
             | 
| 70 | 
            +
            Structure with one repeated field of type `gis.protobuf.Point2D`: `point`.
         | 
| 71 | 
            +
             | 
| 72 | 
            +
            GeoJSON representation of this message is
         | 
| 73 | 
            +
             | 
| 74 | 
            +
            ~~~ruby
         | 
| 75 | 
            +
            { :type => 'MultiPoint', :coordinates => [[x1, y1], [x2, y2]] }
         | 
| 76 | 
            +
            ~~~
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            #### MultiPoint3D
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            Structure with one repeated field of type `gis.protobuf.Point3D`: `point`.
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            GeoJSON representation of this message is
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            ~~~ruby
         | 
| 85 | 
            +
            { :type => 'MultiPoint', :coordinates => [[x1, y1, z1], [x2, y2, z2]] }
         | 
| 86 | 
            +
            ~~~
         | 
| 87 | 
            +
             | 
| 88 | 
            +
            ### LineString
         | 
| 89 | 
            +
             | 
| 90 | 
            +
            ~~~
         | 
| 91 | 
            +
            syntax = "proto3";
         | 
| 92 | 
            +
             | 
| 93 | 
            +
            import "gis/protobuf/linestring.proto";
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            package test;
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            message Test {
         | 
| 98 | 
            +
              gis.protobuf.LineString2D line_string2d = 1;
         | 
| 99 | 
            +
              gis.protobuf.LineString3D line_string3d = 2;
         | 
| 100 | 
            +
              gis.protobuf.MultiLineString2D multi_line_string2d = 3;
         | 
| 101 | 
            +
              gis.protobuf.MultiLineString3D multi_line_string3d = 4;
         | 
| 102 | 
            +
            }
         | 
| 103 | 
            +
            ~~~
         | 
| 104 | 
            +
             | 
| 105 | 
            +
            #### LineString2D
         | 
| 106 | 
            +
             | 
| 107 | 
            +
            Structure with one repeated field of type `gis.protobuf.Point2D`: `point`.
         | 
| 108 | 
            +
             | 
| 109 | 
            +
            GeoJSON representation of this message is
         | 
| 110 | 
            +
             | 
| 111 | 
            +
            ~~~ruby
         | 
| 112 | 
            +
            { :type => 'LineString', :coordinates => [[x1, y1], [x2, y2]] }
         | 
| 113 | 
            +
            ~~~
         | 
| 114 | 
            +
             | 
| 115 | 
            +
            #### LineString3D
         | 
| 116 | 
            +
             | 
| 117 | 
            +
            Structure with one repeated field of type `gis.protobuf.Point3D`: `point`.
         | 
| 118 | 
            +
             | 
| 119 | 
            +
            GeoJSON representation of this message is
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            ~~~ruby
         | 
| 122 | 
            +
            { :type => 'LineString', :coordinates => [[x1, y1, z1], [x2, y2, z2]] }
         | 
| 123 | 
            +
            ~~~
         | 
| 124 | 
            +
             | 
| 125 | 
            +
            #### MultiLineString2D
         | 
| 126 | 
            +
             | 
| 127 | 
            +
            Structure with one repeated field of type `gis.protobuf.LineString2D`: `line_string`.
         | 
| 128 | 
            +
             | 
| 129 | 
            +
            GeoJSON representation of this message is
         | 
| 130 | 
            +
             | 
| 131 | 
            +
            ~~~ruby
         | 
| 132 | 
            +
            { :type => 'MultiLineString', :coordinates => [[[x1, y1], [x2, y2]], [[x3, y3], [x4, y4]]] }
         | 
| 133 | 
            +
            ~~~
         | 
| 134 | 
            +
             | 
| 135 | 
            +
            #### MultiLineString3D
         | 
| 136 | 
            +
             | 
| 137 | 
            +
            Structure with one repeated field of type `gis.protobuf.LineString3D`: `line_string`.
         | 
| 138 | 
            +
             | 
| 139 | 
            +
            GeoJSON representation of this message is
         | 
| 140 | 
            +
             | 
| 141 | 
            +
            ~~~ruby
         | 
| 142 | 
            +
            { :type => 'MultiLineString', :coordinates => [[[x1, y1, z1], [x2, y2, z2]], [[x3, y3, z3], [x4, y4, z4]]] }
         | 
| 143 | 
            +
            ~~~
         | 
| 144 | 
            +
             | 
| 145 | 
            +
            ### Polygon
         | 
| 146 | 
            +
             | 
| 147 | 
            +
            ~~~
         | 
| 148 | 
            +
            syntax = "proto3";
         | 
| 149 | 
            +
             | 
| 150 | 
            +
            import "gis/protobuf/point.proto";
         | 
| 151 | 
            +
             | 
| 152 | 
            +
            package test;
         | 
| 153 | 
            +
             | 
| 154 | 
            +
            message Test {
         | 
| 155 | 
            +
              gis.protobuf.Polygon2D polugon2d = 1;
         | 
| 156 | 
            +
              gis.protobuf.Polygon3D polugon3d = 2;
         | 
| 157 | 
            +
              gis.protobuf.MultiPolygon2D multi_polugon2d = 3;
         | 
| 158 | 
            +
              gis.protobuf.MultiPolygon3D multi_polugon3d = 4;
         | 
| 159 | 
            +
            }
         | 
| 160 | 
            +
            ~~~
         | 
| 161 | 
            +
             | 
| 162 | 
            +
            #### Polygon2D
         | 
| 163 | 
            +
             | 
| 164 | 
            +
            Structure with one repeated field of type `gis.protobuf.Point2D`: `point`.
         | 
| 165 | 
            +
             | 
| 166 | 
            +
            GeoJSON representation of this message is
         | 
| 167 | 
            +
             | 
| 168 | 
            +
            ~~~ruby
         | 
| 169 | 
            +
            { :type => 'Polygon', :coordinates => [[[x1, y1], [x2, y2]]] }
         | 
| 170 | 
            +
            ~~~
         | 
| 171 | 
            +
             | 
| 172 | 
            +
            #### Polygon3D
         | 
| 173 | 
            +
             | 
| 174 | 
            +
            Structure with one repeated field of type `gis.protobuf.Point3D`: `point`.
         | 
| 175 | 
            +
             | 
| 176 | 
            +
            GeoJSON representation of this message is
         | 
| 177 | 
            +
             | 
| 178 | 
            +
            ~~~ruby
         | 
| 179 | 
            +
            { :type => 'Polygon', :coordinates => [[[x1, y1, z1], [x2, y2, z2]]] }
         | 
| 180 | 
            +
            ~~~
         | 
| 181 | 
            +
             | 
| 182 | 
            +
            #### MultiPolygon2D
         | 
| 183 | 
            +
             | 
| 184 | 
            +
            Structure with one repeated field of type `gis.protobuf.Polygon2D`: `polygon`.
         | 
| 185 | 
            +
             | 
| 186 | 
            +
            GeoJSON representation of this message is
         | 
| 187 | 
            +
             | 
| 188 | 
            +
            ~~~ruby
         | 
| 189 | 
            +
            { :type => 'MultiPolygon', :coordinates => [[[[x1, y1], [x2, y2]]], [[[x3, y3], [x4, y4]]]] }
         | 
| 190 | 
            +
            ~~~
         | 
| 191 | 
            +
             | 
| 192 | 
            +
            #### MultiPolygon3D
         | 
| 193 | 
            +
             | 
| 194 | 
            +
            Structure with one repeated field of type `gis.protobuf.Polygon3D`: `polygon`.
         | 
| 195 | 
            +
             | 
| 196 | 
            +
            GeoJSON representation of this message is
         | 
| 197 | 
            +
             | 
| 198 | 
            +
            ~~~ruby
         | 
| 199 | 
            +
            { :type => 'MultiPolygon', :coordinates => [[[[x1, y1, z1], [x2, y2, z2]]], [[[x3, y3, z3], [x4, y4, z4]]]] }
         | 
| 200 | 
            +
            ~~~
         | 
| 201 | 
            +
             | 
| 202 | 
            +
            ## Usage
         | 
| 203 | 
            +
             | 
| 204 | 
            +
            In `proto/test.proto` file:
         | 
| 205 | 
            +
             | 
| 206 | 
            +
            ~~~
         | 
| 207 | 
            +
            syntax = "proto3";
         | 
| 208 | 
            +
             | 
| 209 | 
            +
            import "gis/protobuf/point.proto";
         | 
| 210 | 
            +
             | 
| 211 | 
            +
            package test;
         | 
| 212 | 
            +
             | 
| 213 | 
            +
            message Test {
         | 
| 214 | 
            +
              gis.protobuf.Point2D point = 1;
         | 
| 215 | 
            +
            }
         | 
| 216 | 
            +
            ~~~
         | 
| 217 | 
            +
             | 
| 218 | 
            +
            Build:
         | 
| 219 | 
            +
             | 
| 220 | 
            +
            ~~~sh
         | 
| 221 | 
            +
            protoc --ruby_out=. -I /usr/include -I /usr/local/include -I . proto/test.proto
         | 
| 222 | 
            +
            ~~~
         | 
| 223 | 
            +
             | 
| 224 | 
            +
            Code:
         | 
| 225 | 
            +
             | 
| 226 | 
            +
            ~~~ruby
         | 
| 227 | 
            +
            require "gis/protobuf"
         | 
| 228 | 
            +
            require "proto/test_pb"
         | 
| 229 | 
            +
             | 
| 230 | 
            +
            point = Gis::Protobuf::Point2D.new x: 10, y: 20
         | 
| 231 | 
            +
             | 
| 232 | 
            +
            test = Proto::Test point: point
         | 
| 233 | 
            +
             | 
| 234 | 
            +
            puts test.point.toGeoJSON()
         | 
| 235 | 
            +
            ~~~
         | 
| 236 | 
            +
             | 
| 237 | 
            +
            ## Development
         | 
| 238 | 
            +
             | 
| 239 | 
            +
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         | 
| 240 | 
            +
             | 
| 241 | 
            +
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         | 
| 242 | 
            +
             | 
| 243 | 
            +
            ## Contributing
         | 
| 244 | 
            +
             | 
| 245 | 
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/tomi77/protobuf-gis.
         | 
| 246 | 
            +
             | 
| 247 | 
            +
            ## License
         | 
| 248 | 
            +
             | 
| 249 | 
            +
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require "bundler/setup"
         | 
| 4 | 
            +
            require "gis/protobuf"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            # You can add fixtures and/or initialization code here to make experimenting
         | 
| 7 | 
            +
            # with your gem easier. You can also use a different console, if you like.
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         | 
| 10 | 
            +
            # require "pry"
         | 
| 11 | 
            +
            # Pry.start
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            require "irb"
         | 
| 14 | 
            +
            IRB.start(__FILE__)
         | 
    
        data/bin/setup
    ADDED
    
    
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            # coding: utf-8
         | 
| 2 | 
            +
            lib = File.expand_path("../lib", __FILE__)
         | 
| 3 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            +
            require "gis/protobuf/version"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |spec|
         | 
| 7 | 
            +
              spec.name          = "gis-protobuf"
         | 
| 8 | 
            +
              spec.version       = Gis::Protobuf::VERSION
         | 
| 9 | 
            +
              spec.authors       = ["Tomasz Jakub Rup"]
         | 
| 10 | 
            +
              spec.email         = ["tomasz.rup@gmail.com"]
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              spec.summary       = "GIS ProtoBuf module"
         | 
| 13 | 
            +
              spec.homepage      = "https://github.com/tomi77/protobuf-gis/"
         | 
| 14 | 
            +
              spec.license       = "MIT"
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              spec.files         = `git ls-files -z`.split("\x0").reject do |f|
         | 
| 17 | 
            +
                f.match(%r{^(test|spec|features)/})
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
              spec.bindir        = "exe"
         | 
| 20 | 
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 21 | 
            +
              spec.require_paths = ["lib"]
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              spec.add_runtime_dependency "google-protobuf", "~> 3.3.0"
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              spec.add_development_dependency "bundler", "~> 1.15"
         | 
| 26 | 
            +
              spec.add_development_dependency "rake", "~> 10.0"
         | 
| 27 | 
            +
              spec.add_development_dependency "rspec", "~> 3.0"
         | 
| 28 | 
            +
            end
         | 
    
        data/lib/gis/protobuf.rb
    ADDED
    
    | @@ -0,0 +1,111 @@ | |
| 1 | 
            +
            require "gis/protobuf/point_pb"
         | 
| 2 | 
            +
            require "gis/protobuf/linestring_pb"
         | 
| 3 | 
            +
            require "gis/protobuf/polygon_pb"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Gis::Protobuf::Point2D.class_eval {
         | 
| 6 | 
            +
              def toGeoJSON()
         | 
| 7 | 
            +
                {
         | 
| 8 | 
            +
                  type: "Point",
         | 
| 9 | 
            +
                  coordinates: [self.x, self.y]
         | 
| 10 | 
            +
                }
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
            }
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            Gis::Protobuf::Point3D.class_eval {
         | 
| 15 | 
            +
              def toGeoJSON()
         | 
| 16 | 
            +
                {
         | 
| 17 | 
            +
                  type: "Point",
         | 
| 18 | 
            +
                  coordinates: [self.x, self.y, self.z]
         | 
| 19 | 
            +
                }
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
            }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            Gis::Protobuf::MultiPoint2D.class_eval {
         | 
| 24 | 
            +
              def toGeoJSON()
         | 
| 25 | 
            +
                {
         | 
| 26 | 
            +
                  type: "MultiPoint",
         | 
| 27 | 
            +
                  coordinates: self.point.map { |point| point.toGeoJSON()[:coordinates] }
         | 
| 28 | 
            +
                }
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
            }
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            Gis::Protobuf::MultiPoint3D.class_eval {
         | 
| 33 | 
            +
              def toGeoJSON()
         | 
| 34 | 
            +
                {
         | 
| 35 | 
            +
                  type: "MultiPoint",
         | 
| 36 | 
            +
                  coordinates: self.point.map { |point| point.toGeoJSON()[:coordinates] }
         | 
| 37 | 
            +
                }
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            }
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            Gis::Protobuf::LineString2D.class_eval {
         | 
| 42 | 
            +
              def toGeoJSON()
         | 
| 43 | 
            +
                {
         | 
| 44 | 
            +
                  type: "LineString",
         | 
| 45 | 
            +
                  coordinates: self.point.map { |point| point.toGeoJSON()[:coordinates] }
         | 
| 46 | 
            +
                }
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
            }
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            Gis::Protobuf::LineString3D.class_eval {
         | 
| 51 | 
            +
              def toGeoJSON()
         | 
| 52 | 
            +
                {
         | 
| 53 | 
            +
                  type: "LineString",
         | 
| 54 | 
            +
                  coordinates: self.point.map { |point| point.toGeoJSON()[:coordinates] }
         | 
| 55 | 
            +
                }
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
            }
         | 
| 58 | 
            +
             | 
| 59 | 
            +
            Gis::Protobuf::MultiLineString2D.class_eval {
         | 
| 60 | 
            +
              def toGeoJSON()
         | 
| 61 | 
            +
                {
         | 
| 62 | 
            +
                  type: "MultiLineString",
         | 
| 63 | 
            +
                  coordinates: self.line_string.map { |line_string| line_string.toGeoJSON()[:coordinates] }
         | 
| 64 | 
            +
                }
         | 
| 65 | 
            +
              end
         | 
| 66 | 
            +
            }
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            Gis::Protobuf::MultiLineString3D.class_eval {
         | 
| 69 | 
            +
              def toGeoJSON()
         | 
| 70 | 
            +
                {
         | 
| 71 | 
            +
                  type: "MultiLineString",
         | 
| 72 | 
            +
                  coordinates: self.line_string.map { |line_string| line_string.toGeoJSON()[:coordinates] }
         | 
| 73 | 
            +
                }
         | 
| 74 | 
            +
              end
         | 
| 75 | 
            +
            }
         | 
| 76 | 
            +
             | 
| 77 | 
            +
            Gis::Protobuf::Polygon2D.class_eval {
         | 
| 78 | 
            +
              def toGeoJSON()
         | 
| 79 | 
            +
                {
         | 
| 80 | 
            +
                  type: "Polygon",
         | 
| 81 | 
            +
                  coordinates: [self.point.map { |point| point.toGeoJSON()[:coordinates] }]
         | 
| 82 | 
            +
                }
         | 
| 83 | 
            +
              end
         | 
| 84 | 
            +
            }
         | 
| 85 | 
            +
             | 
| 86 | 
            +
            Gis::Protobuf::Polygon3D.class_eval {
         | 
| 87 | 
            +
              def toGeoJSON()
         | 
| 88 | 
            +
                {
         | 
| 89 | 
            +
                  type: "Polygon",
         | 
| 90 | 
            +
                  coordinates: [self.point.map { |point| point.toGeoJSON()[:coordinates] }]
         | 
| 91 | 
            +
                }
         | 
| 92 | 
            +
              end
         | 
| 93 | 
            +
            }
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            Gis::Protobuf::MultiPolygon2D.class_eval {
         | 
| 96 | 
            +
              def toGeoJSON()
         | 
| 97 | 
            +
                {
         | 
| 98 | 
            +
                  type: "MultiPolygon",
         | 
| 99 | 
            +
                  coordinates: self.polygon.map { |polygon| polygon.toGeoJSON()[:coordinates] }
         | 
| 100 | 
            +
                }
         | 
| 101 | 
            +
              end
         | 
| 102 | 
            +
            }
         | 
| 103 | 
            +
             | 
| 104 | 
            +
            Gis::Protobuf::MultiPolygon3D.class_eval {
         | 
| 105 | 
            +
              def toGeoJSON()
         | 
| 106 | 
            +
                {
         | 
| 107 | 
            +
                  type: "MultiPolygon",
         | 
| 108 | 
            +
                  coordinates: self.polygon.map { |polygon| polygon.toGeoJSON()[:coordinates] }
         | 
| 109 | 
            +
                }
         | 
| 110 | 
            +
              end
         | 
| 111 | 
            +
            }
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            # Generated by the protocol buffer compiler.  DO NOT EDIT!
         | 
| 2 | 
            +
            # source: gis/protobuf/linestring.proto
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            require 'google/protobuf'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            require 'gis/protobuf/point_pb'
         | 
| 7 | 
            +
            Google::Protobuf::DescriptorPool.generated_pool.build do
         | 
| 8 | 
            +
              add_message "gis.protobuf.LineString2D" do
         | 
| 9 | 
            +
                repeated :point, :message, 1, "gis.protobuf.Point2D"
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
              add_message "gis.protobuf.LineString3D" do
         | 
| 12 | 
            +
                repeated :point, :message, 1, "gis.protobuf.Point3D"
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
              add_message "gis.protobuf.MultiLineString2D" do
         | 
| 15 | 
            +
                repeated :line_string, :message, 1, "gis.protobuf.LineString2D"
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
              add_message "gis.protobuf.MultiLineString3D" do
         | 
| 18 | 
            +
                repeated :line_string, :message, 1, "gis.protobuf.LineString3D"
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
            end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            module Gis
         | 
| 23 | 
            +
              module Protobuf
         | 
| 24 | 
            +
                LineString2D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.LineString2D").msgclass
         | 
| 25 | 
            +
                LineString3D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.LineString3D").msgclass
         | 
| 26 | 
            +
                MultiLineString2D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.MultiLineString2D").msgclass
         | 
| 27 | 
            +
                MultiLineString3D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.MultiLineString3D").msgclass
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
            end
         | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            # Generated by the protocol buffer compiler.  DO NOT EDIT!
         | 
| 2 | 
            +
            # source: gis/protobuf/point.proto
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            require 'google/protobuf'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Google::Protobuf::DescriptorPool.generated_pool.build do
         | 
| 7 | 
            +
              add_message "gis.protobuf.Point2D" do
         | 
| 8 | 
            +
                optional :x, :float, 1
         | 
| 9 | 
            +
                optional :y, :float, 2
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
              add_message "gis.protobuf.Point3D" do
         | 
| 12 | 
            +
                optional :x, :float, 1
         | 
| 13 | 
            +
                optional :y, :float, 2
         | 
| 14 | 
            +
                optional :z, :float, 3
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
              add_message "gis.protobuf.MultiPoint2D" do
         | 
| 17 | 
            +
                repeated :point, :message, 1, "gis.protobuf.Point2D"
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
              add_message "gis.protobuf.MultiPoint3D" do
         | 
| 20 | 
            +
                repeated :point, :message, 1, "gis.protobuf.Point3D"
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
            end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            module Gis
         | 
| 25 | 
            +
              module Protobuf
         | 
| 26 | 
            +
                Point2D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.Point2D").msgclass
         | 
| 27 | 
            +
                Point3D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.Point3D").msgclass
         | 
| 28 | 
            +
                MultiPoint2D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.MultiPoint2D").msgclass
         | 
| 29 | 
            +
                MultiPoint3D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.MultiPoint3D").msgclass
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
            end
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            # Generated by the protocol buffer compiler.  DO NOT EDIT!
         | 
| 2 | 
            +
            # source: gis/protobuf/polygon.proto
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            require 'google/protobuf'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            require 'gis/protobuf/point_pb'
         | 
| 7 | 
            +
            Google::Protobuf::DescriptorPool.generated_pool.build do
         | 
| 8 | 
            +
              add_message "gis.protobuf.Polygon2D" do
         | 
| 9 | 
            +
                repeated :point, :message, 1, "gis.protobuf.Point2D"
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
              add_message "gis.protobuf.Polygon3D" do
         | 
| 12 | 
            +
                repeated :point, :message, 1, "gis.protobuf.Point3D"
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
              add_message "gis.protobuf.MultiPolygon2D" do
         | 
| 15 | 
            +
                repeated :polygon, :message, 1, "gis.protobuf.Polygon2D"
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
              add_message "gis.protobuf.MultiPolygon3D" do
         | 
| 18 | 
            +
                repeated :polygon, :message, 1, "gis.protobuf.Polygon3D"
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
            end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            module Gis
         | 
| 23 | 
            +
              module Protobuf
         | 
| 24 | 
            +
                Polygon2D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.Polygon2D").msgclass
         | 
| 25 | 
            +
                Polygon3D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.Polygon3D").msgclass
         | 
| 26 | 
            +
                MultiPolygon2D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.MultiPolygon2D").msgclass
         | 
| 27 | 
            +
                MultiPolygon3D = Google::Protobuf::DescriptorPool.generated_pool.lookup("gis.protobuf.MultiPolygon3D").msgclass
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,112 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: gis-protobuf
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 1.0.4
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Tomasz Jakub Rup
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: exe
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2017-08-19 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: google-protobuf
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - "~>"
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: 3.3.0
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - "~>"
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: 3.3.0
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: bundler
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '1.15'
         | 
| 34 | 
            +
              type: :development
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '1.15'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: rake
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - "~>"
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '10.0'
         | 
| 48 | 
            +
              type: :development
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - "~>"
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '10.0'
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: rspec
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - "~>"
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '3.0'
         | 
| 62 | 
            +
              type: :development
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - "~>"
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '3.0'
         | 
| 69 | 
            +
            description: 
         | 
| 70 | 
            +
            email:
         | 
| 71 | 
            +
            - tomasz.rup@gmail.com
         | 
| 72 | 
            +
            executables: []
         | 
| 73 | 
            +
            extensions: []
         | 
| 74 | 
            +
            extra_rdoc_files: []
         | 
| 75 | 
            +
            files:
         | 
| 76 | 
            +
            - ".rspec"
         | 
| 77 | 
            +
            - Gemfile
         | 
| 78 | 
            +
            - README.md
         | 
| 79 | 
            +
            - Rakefile
         | 
| 80 | 
            +
            - bin/console
         | 
| 81 | 
            +
            - bin/setup
         | 
| 82 | 
            +
            - gis-protobuf.gemspec
         | 
| 83 | 
            +
            - lib/gis/protobuf.rb
         | 
| 84 | 
            +
            - lib/gis/protobuf/linestring_pb.rb
         | 
| 85 | 
            +
            - lib/gis/protobuf/point_pb.rb
         | 
| 86 | 
            +
            - lib/gis/protobuf/polygon_pb.rb
         | 
| 87 | 
            +
            - lib/gis/protobuf/version.rb
         | 
| 88 | 
            +
            homepage: https://github.com/tomi77/protobuf-gis/
         | 
| 89 | 
            +
            licenses:
         | 
| 90 | 
            +
            - MIT
         | 
| 91 | 
            +
            metadata: {}
         | 
| 92 | 
            +
            post_install_message: 
         | 
| 93 | 
            +
            rdoc_options: []
         | 
| 94 | 
            +
            require_paths:
         | 
| 95 | 
            +
            - lib
         | 
| 96 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 97 | 
            +
              requirements:
         | 
| 98 | 
            +
              - - ">="
         | 
| 99 | 
            +
                - !ruby/object:Gem::Version
         | 
| 100 | 
            +
                  version: '0'
         | 
| 101 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 102 | 
            +
              requirements:
         | 
| 103 | 
            +
              - - ">="
         | 
| 104 | 
            +
                - !ruby/object:Gem::Version
         | 
| 105 | 
            +
                  version: '0'
         | 
| 106 | 
            +
            requirements: []
         | 
| 107 | 
            +
            rubyforge_project: 
         | 
| 108 | 
            +
            rubygems_version: 2.6.11
         | 
| 109 | 
            +
            signing_key: 
         | 
| 110 | 
            +
            specification_version: 4
         | 
| 111 | 
            +
            summary: GIS ProtoBuf module
         | 
| 112 | 
            +
            test_files: []
         |