Skip to content

Commit

Permalink
Merge pull request #88 from xiaogu-space/main
Browse files Browse the repository at this point in the history
update buffer func
  • Loading branch information
xiaogu-space authored Aug 30, 2022
2 parents e099886 + a42b871 commit 9f552b3
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 50 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Change Log

## [1.1.3] - 2022-08-30
### Fixed
- Fixed some buffer analysis method bugs
## [1.1.2] - 2022-07-28
### Added
- Added a method to check the geometry struct is correct.
## [1.1.1.1] - 2022-07-22
### Added
- Added a method to repair the self intersection of a polygon.
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# 更新日志
## [1.1.3] - 2022-08-30
### 修复
- 修复部分缓冲区分析方法bug
## [1.1.2] - 2022-07-22
### 新增
- 增加了检查空间数结构方法
## [1.1.1.1] - 2022-07-22
### 新增
- 增加了面自相交的修复方法
Expand Down
55 changes: 30 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ All comments and suggestions are welcome!
http://www.spatial-go.com

## Contents

- [Structure](#Structure)
- [Documentation](#Documentation)
- [Maintainer](#Maintainer)
- [Contributing](#Contributing)
- [License](#License)
- [Guides](#guides)
- [Contents](#contents)
- [Structure](#structure)
- [Documentation](#documentation)
- [Maintainer](#maintainer)
- [Contributing](#contributing)
- [License](#license)



Expand All @@ -27,30 +28,34 @@ Example: Calculating `area` via `Geoos`
package main
import (
"encoding/json"
"fmt"
"github.com/spatial-go/geoos"
"github.com/spatial-go/geoos/encoding/wkt"
"github.com/spatial-go/geoos/geojson"
"github.com/spatial-go/geoos/planar"
"bytes"
"fmt"
"github.com/spatial-go/geoos/geoencoding"
"github.com/spatial-go/geoos/planar"
)
func main() {
// First, choose the default algorithm.
strategy := planar.NormalStrategy()
// Secondly, manufacturing test data and convert it to geometry
const polygon = `POLYGON((-1 -1, 1 -1, 1 1, -1 1, -1 -1))`
geometry, _ := wkt.UnmarshalString(polygon)
// Last, call the Area () method and get result.
area, e := strategy.Area(geometry)
if e != nil {
fmt.Printf(e.Error())
}
fmt.Printf("%f", area)
// First, choose the default algorithm.
strategy := planar.NormalStrategy()
// Secondly, manufacturing test data and convert it to geometry
const polygon = `POLYGON((-1 -1, 1 -1, 1 1, -1 1, -1 -1))`
// geometry, _ := wkt.UnmarshalString(polygon)
buf0 := new(bytes.Buffer)
buf0.Write([]byte(polygon))
geometry, _ := geoencoding.Read(buf0, geoencoding.WKT)
// Last, call the Area () method and get result.
area, e := strategy.Area(geometry)
if e != nil {
fmt.Printf(e.Error())
}
fmt.Printf("%f", area)
// get result 4.0
}
```
Example: geoencoding
Example: geoencoding
[example_encoding.go](https://github.com/spatial-go/geoos/example/example_encoding.go)

## Maintainer
Expand Down
54 changes: 29 additions & 25 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
欢迎大家使用并提出宝贵意见!

## 内容列表

- [目录结构](#目录结构)
- [使用说明](#使用说明)
- [维护者](#维护者)
- [如何贡献](#如何贡献)
- [使用许可](#使用许可)
- [内容列表](#内容列表)
- [目录结构](#目录结构)
- [使用说明](#使用说明)
- [维护者](#维护者)
- [如何贡献](#如何贡献)
- [使用许可](#使用许可)



Expand All @@ -22,30 +22,34 @@
package main
import (
"encoding/json"
"fmt"
"github.com/spatial-go/geoos"
"github.com/spatial-go/geoos/encoding/wkt"
"github.com/spatial-go/geoos/geojson"
"github.com/spatial-go/geoos/planar"
"bytes"
"fmt"
"github.com/spatial-go/geoos/geoencoding"
"github.com/spatial-go/geoos/planar"
)
func main() {
// First, choose the default algorithm.
strategy := planar.NormalStrategy()
// Secondly, manufacturing test data and convert it to geometry
const polygon = `POLYGON((-1 -1, 1 -1, 1 1, -1 1, -1 -1))`
geometry, _ := wkt.UnmarshalString(polygon)
// Last, call the Area () method and get result.
area, e := strategy.Area(geometry)
if e != nil {
fmt.Printf(e.Error())
}
fmt.Printf("%f", area)
// First, choose the default algorithm.
strategy := planar.NormalStrategy()
// Secondly, manufacturing test data and convert it to geometry
const polygon = `POLYGON((-1 -1, 1 -1, 1 1, -1 1, -1 -1))`
// geometry, _ := wkt.UnmarshalString(polygon)
buf0 := new(bytes.Buffer)
buf0.Write([]byte(polygon))
geometry, _ := geoencoding.Read(buf0, geoencoding.WKT)
// Last, call the Area () method and get result.
area, e := strategy.Area(geometry)
if e != nil {
fmt.Printf(e.Error())
}
fmt.Printf("%f", area)
// get result 4.0
}
```
Example: geoencoding
Example: geoencoding
[example_encoding.go](https://github.com/spatial-go/geoos/example/example_encoding.go)

## 维护者
Expand Down

0 comments on commit 9f552b3

Please sign in to comment.