gogis

package module
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 9 Imported by: 0

README

github.com/awangga/gogis

Usage

Initialize your module
$ go mod init example.com/my-gogis-demo
Get the gogis module

Note that you need to include the v in the version tag.

$ go get github.com/awangga/gogis@v0.1.0
package main

import (
    "fmt"

    "github.com/awangga/gogis"
)

func main() {
    fmt.Println(GetPublicIP())
    var db MongoGeometry
	db.MongoString = "mongodb+srv://gogis:gogis@cluster0.wghp85v.mongodb.net/?retryWrites=true&w=majority"
	db.DBName = "location"
	db.CollectionName = "villages"
	db.LocationField = "border"
    fmt.Println(GetLocation(db, 107.57297533576039, -6.872079914985439))
}

Testing

$ go test

Tagging

develop and publish new version of gogis

$ git tag v0.1.2
$ git push origin --tags
$ go list -m github.com/awangga/gogis@v0.1.2

Environment

Setting up environment

GOPROXY=proxy.golang.org

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a int, b int) int

Returns the sum of two numbers

func GetLocation added in v0.1.7

func GetLocation(mongog MongoGeometry, long float64, lat float64) (loc interface{})

func MongoConnect added in v0.1.7

func MongoConnect(mongostring string, dbname string) (db *mongo.Database)

func Subtract

func Subtract(a int, b int) int

Returns the difference between two numbers

Types

type Desa added in v0.1.7

type Desa struct {
	ID           primitive.ObjectID `bson:"_id,omitempty"`
	Province     string             `bson:"province,omitempty"`
	District     string             `bson:"district,omitempty"`
	Sub_district string             `bson:"sub_district,omitempty"`
	Village      string             `bson:"village,omitempty"`
	Border       Geometry           `bson:"border,omitempty"`
}

type Geometry added in v0.1.7

type Geometry struct {
	Type        string      `json:"type" bson:"type"`
	Coordinates interface{} `json:"coordinates" bson:"coordinates"`
}

type IpApi added in v0.1.6

type IpApi struct {
	Status      string `json:"status,omitempty"`
	Country     string `json:"country,omitempty"`
	CountryCode string `json:"countryCode,omitempty"`
	Region      string `json:"region,omitempty"`
	RegionName  string `json:"regionName,omitempty"`
	City        string `json:"city,omitempty"`
	Lat         string `json:"lat,omitempty"`
	Lon         string `json:"lon,omitempty"`
	Timezone    string `json:"timezone,omitempty"`
	Isp         string `json:"isp,omitempty"`
	Org         string `json:"org,omitempty"`
	As          string `json:"as,omitempty"`
	Query       string `json:"query,omitempty"`
}

func GetPublicIP added in v0.1.4

func GetPublicIP() IpApi

type MongoGeometry added in v0.1.7

type MongoGeometry struct {
	MongoString    string
	DBName         string
	CollectionName string
	LocationField  string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL