kml_polygon

所属分类:嵌入式/单片机/硬件编程
开发工具:Ruby
文件大小:0KB
下载次数:0
上传日期:2017-01-08 20:42:12
上 传 者sh-1993
说明:  Ruby Gem,仅为中心点(经度、纬度)和半径创建KML正多边形(方形、六边形、圆形、星形等)。,
(Ruby Gem to create a KML regular polygon (square, hexagon , circle, star etc.) for only a centre-point (longitude, latitude) and radius.,)

文件列表:
Gemfile (96, 2016-01-17)
LICENSE.txt (1098, 2016-01-17)
Rakefile (28, 2016-01-17)
kml_polygon.gemspec (1005, 2016-01-17)
lib/ (0, 2016-01-17)
lib/kml_polygon.rb (6265, 2016-01-17)
lib/kml_polygon/ (0, 2016-01-17)
lib/kml_polygon/version.rb (42, 2016-01-17)

======= kml_polygon =========== Google earth doesn't provide polygon primitives, leaving you to generate them as a series of points. Given only a center-point (longitude/latitude) and radius, this Gem makes it easy to create (n) sided polygons (sufficient sides giving a circle) or stars, for inclusion in a KML file. All credit to Nick Galbreath for the original code, and for providing it in a portable format. Thanks! (http://blog.client9.com/2007/09/drawing-circles-and-stars-on-google.html) ## Installation Add this line to your application's Gemfile: gem 'kml_polygon' And then execute: $ bundle Or install it yourself as: $ gem install kml_polygon ## Usage kml_regular_polygon(longitude, latitude, radius, [sides=20, rotate=0]) kml_star(longitude, latitude, radius, inner_radius, [sides=10, rotate=0]) Returns a string suitable for adding into a KML file. ### kml_regular_polygon kml_regular_polygon(longitude, latitude, radius, [sides=0, rotate=0]) Regular polygon longitude, latitude - center point in decimal degrees radius - radius in meters segments - number of sides, > 20 looks like a circle (optional, default: 20) rotate - rotate polygon degrees (optional, default: 0) ### kml_star kml_star(longitude, latitude, radius, inner_radius, [sides=10, rotate=0]) Make a "star" or "burst" pattern longitude, latitude - center point in decimal degrees radius - radius in meters inner_radius - radius in meters, typically < outer_radius segments - number of "points" on the star (optional, default: 10) rotate - rotate polygon by degrees (optional, default: 0) ### For Example: # kml_polygon_example.rb include kml_polygon circle = kml_regular_polygon(-95, 50, 70000) star = kml_star(-95,45, 70000, 50000) puts " polygon1" << circle << " polygon2" << star << " " Outputs a minimal but funtional KML file with one circle and one star in semi-transparent colors. ## Contributing 1. Fork it (`git clone git://github.com/mbrookes/kml_polygon.git`) 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

近期下载者

相关文件


收藏者