lib/ogr/geometry_extensions.rb in ffi-gdal-1.0.0.beta3 vs lib/ogr/geometry_extensions.rb in ffi-gdal-1.0.0.beta4

- old
+ new

@@ -1,23 +1,22 @@ require 'json' module OGR module GeometryExtensions - # @return [Hash] - def as_json + def as_json(options = nil) json = { coordinate_dimension: coordinate_dimension, - count: count, + geometry_count: geometry_count, dimension: dimension, is_empty: empty?, is_ring: ring?, is_simple: simple?, is_valid: valid?, name: name, point_count: point_count, - spatial_reference: spatial_reference.as_json, + spatial_reference: spatial_reference.nil? ? nil : spatial_reference.as_json(options), type: type_to_name, wkb_size: wkb_size } json.merge!(area: area) if respond_to? :area @@ -26,12 +25,12 @@ json end # @return [String] - def to_json - as_json.to_json + def to_json(options = nil) + as_json(options).to_json end def collection? false end @@ -40,16 +39,16 @@ driver = OGR::Driver.by_name(driver) data_source = driver.create_data_source(file_name) log "Creating layer #{layer_name}, type: #{type}" layer = data_source.create_layer(layer_name, geometry_type: type, - spatial_reference: spatial_reference) + spatial_reference: spatial_reference) - # field = Field.create('Name', :OFTString) + # field = FieldDefinition.new('Name', :OFTString) # field.width = 32 unless layer - raise OGR::InvalidLayer, "Unable to create layer '#{layer_name}'." + fail OGR::InvalidLayer, "Unable to create layer '#{layer_name}'." end feature = layer.create_feature(layer_name) feature.geometry = self