# Generated from to_wkt_-0.1.3.gem by gem2rpm -*- rpm-spec -*- %global gem_name to_wkt_ Name: rubygem-%{gem_name} Version: 0.1.3 Release: 1%{?dist} Summary: # to_wkt_ Quickly and easily convert arrays to [Well-Known Text (WKT)] format. Which are commonly used in GIS Databases such as [PostGIS]. ## Installation Add this line to your application's Gemfile: gem 'to_wkt_' And then execute: $ bundle Or install it yourself as: $ gem install to_wkt_ ## Usage ToWkt automatically exposes the following methods on any instance of `Array`: - `#to_wkt_point` - converts an array to a WKT POINT - e.g. ```ruby [0,0].to_wkt_point # "POINT(0 0)" ``` - `#to_wkt_line_string` - converts an array to a WKT LINESTRING - e.g. ```ruby [ [0,0], [1,1], [1,2] ].to_wkt_line_string # "LINESTRING(0 0,1 1,1 2)" ``` - `#to_wkt_polygon` - converts an array to a WKT POLYGON - e.g. ```ruby polygon_array = [ [ [0,0], [4,0], [4,4], [0,4], [0,0] ], [ [1,1], [2,1], [2,2], [1,2], [1,1] ] ] polygon_array.to_wkt_polygon # "POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1))" ``` - `#to_wkt_multi_point` - converts an array to a WKT MULTIPOINT - e.g. ```ruby [ [0,0], [1,2] ].to_wkt_multi_point # "MULTIPOINT(0 0,1 2)" ``` - `#to_wkt_multi_line_string` - converts an array to a WKT MULTILINESTRING - e.g. ```ruby multi_line_array = [ [ [0,0], [1,1], [1,2] ], [ [2,3], [3,2], [5,4] ] ] multi_line_array.to_wkt_multi_line_string # "MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))" ``` - `#to_wkt_multi_polygon` - converts an array to a WKT MULTIPOLYGON - e.g. ```ruby multi_polygon_array = [ [ [[0,0], [4,0], [4,4], [0,4], [0,0]], [[1,1], [2,1], [2,2], [1,2], [1,1]] ], [ [[-1,-1], [-1,-2], [-2,-2], [-2,-1], [-1,-1]] ] ] multi_polygon_array.to_wkt_multi_polygon= "MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)),((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))" ``` ## Contributing ### ToDos WKT specs contain 18 different geometries; right now only 6 are implemented in **to_wkt_**. - Implemented - Point - LineString - Polygon - MultiPoint - MultiLineString - MultiPolygon - **Not Implemented** - Geometry - Triangle - CircularString - Curve - MultiCurve - CompoundCurve - CurvePolygon - Surface - MultiSurface - PolyhedralSurface - TIN - GeometryCollection Some of these will be easier to implement than others. ### How to Contribute 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request [Well-Known Text (WKT)]: http://en.wikipedia.org/wiki/Well-known_text [PostGIS]: http://postgis.refractions.net/documentation/manual-1.3SVN/ch04.html#id2726203 License: MIT URL: http://github.com/roadtrippers/to_wkt_ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem BuildRequires: ruby(release) BuildRequires: rubygems-devel BuildRequires: ruby # BuildRequires: rubygem(rspec) BuildArch: noarch %description Painlessly convert arrays to Well-Known Text (WKT) format. %package doc Summary: Documentation for %{name} Requires: %{name} = %{version}-%{release} BuildArch: noarch %description doc Documentation for %{name}. %prep %setup -q -n %{gem_name}-%{version} %build # Create the gem as gem install only works on a gem file gem build ../%{gem_name}-%{version}.gemspec # %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir # by default, so that we can move it into the buildroot in %%install %gem_install %install mkdir -p %{buildroot}%{gem_dir} cp -a .%{gem_dir}/* \ %{buildroot}%{gem_dir}/ %check pushd .%{gem_instdir} # rspec spec popd %files %dir %{gem_instdir} %exclude %{gem_instdir}/.gitignore %license %{gem_instdir}/LICENSE.txt %{gem_libdir} %exclude %{gem_cache} %{gem_spec} %files doc %doc %{gem_docdir} %{gem_instdir}/Gemfile %doc %{gem_instdir}/README.md %{gem_instdir}/Rakefile %{gem_instdir}/spec %{gem_instdir}/to_wkt_.gemspec %changelog * Thu Sep 16 2021 mockbuilder - 0.1.3-1 - Initial package