backendgis

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 11 Imported by: 0

README

backendgis

backend golang geospatial

Package backend golang framework gin

PostGeoIntersects { "type": "Point", "coordinates": [103.60768133536988, -1.628526295003084] } { "type": "LineString", "coordinates": [ [103.63091641571147, -1.6020024943709927], [103.57608972562886, -1.6467275181335737] ] } { "type": "Polygon", "coordinates": [ [ [103.53962566807368, -1.6189297721911515], [103.52177261032824, -1.6385764460854517], [103.52937864676417, -1.654314771743401], [103.54860501664389, -1.6394214600113486], [103.53962566807368, -1.6189297721911515] ] ] }

PostGeoWithin

{ "type": "Polygon", "coordinates": [ [ [103.62892373959272, -1.616812371154296], [103.62890068598779, -1.616866839799556], [103.62896041578165, -1.616890931699615], [103.62898556516905, -1.6168364630550514], [103.62892373959272, -1.616812371154296] ] ] }

PostNear

{ "type": "Point", "coordinates": [103.6037314895799, -1.632582001101999], "max": 100, "min": 1 }

PostNearSphere

{ "type": "Point", "coordinates": [103.6037314895799, -1.632582001101999], "max": 100, "min": 1 }

PostBox

{ "coordinates": [ [103.54786554087926, -1.6487359545296698], [103.62772892345659, -1.6034217927083034] ] }

PostCenter

{ "coordinates": [103.62074450557095, -1.632735059500547], "radius": 0.003 }

PostCenterSphere

{ "coordinates": [103.62074450557095, -1.632735059500547], "radius": 0.00003 }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AmbilDataGeojson

func AmbilDataGeojson(mongoenv, dbname, collname string, r *http.Request) string

func Box

func Box(mconn *mongo.Database, collname string, coordinates Polyline) string

func Center

func Center(mconn *mongo.Database, collname string, coordinates Point) string

func CenterSphere

func CenterSphere(mconn *mongo.Database, collname string, coordinates Point) string

func Create2dsphere

func Create2dsphere(mconn DBInfo) (db *mongo.Database)

func DeleteDoc

func DeleteDoc(db *mongo.Database, collection string, filter bson.M) (result *mongo.DeleteResult)

func DeleteGeojson

func DeleteGeojson(mconn *mongo.Database, collname string, userdata User) interface{}

func DeleteOneDoc

func DeleteOneDoc(db *mongo.Database, collection string, filter bson.M) (result *mongo.DeleteResult)

func DocExists

func DocExists[T any](db *mongo.Database, collname string, filter bson.M, doc T) (result bool)

func GeoIntersects

func GeoIntersects(mconn *mongo.Database, collname string, coordinates Polygon) string

func GeoIntersectsPoint added in v0.0.4

func GeoIntersectsPoint(mconn *mongo.Database, collname string, coordinates PointInter) string

func GeoIntersectsPolyline added in v0.0.4

func GeoIntersectsPolyline(mconn *mongo.Database, collname string, coordinates Polyline) string

func GeoWithin

func GeoWithin(mconn *mongo.Database, collname string, coordinates Polygon) string

func GetAllDistinctDoc

func GetAllDistinctDoc(db *mongo.Database, filter bson.M, fieldname, collection string) (doc []any)

func GetAllDoc

func GetAllDoc[T any](db *mongo.Database, collection string) (doc T)

func GetAllDocByFilter

func GetAllDocByFilter[T any](db *mongo.Database, collection string, filter bson.M) (doc T)

func GetBoxDoc

func GetBoxDoc(db *mongo.Database, collname string, coordinates Polyline) (result string)

func GetCenterDoc

func GetCenterDoc(db *mongo.Database, collname string, coordinates Point) (result string)

func GetCenterSphereDoc

func GetCenterSphereDoc(db *mongo.Database, collname string, coordinates Point) (result string)

func GetGeoIntersectsDoc

func GetGeoIntersectsDoc(db *mongo.Database, collname string, coordinates Polygon) (result string)

func GetGeoIntersectsDocPoint added in v0.0.4

func GetGeoIntersectsDocPoint(db *mongo.Database, collname string, coordinates PointInter) (result string)

func GetGeoIntersectsDocPolyline added in v0.0.4

func GetGeoIntersectsDocPolyline(db *mongo.Database, collname string, coordinates Polyline) (result string)

func GetGeoWithinDoc

func GetGeoWithinDoc(db *mongo.Database, collname string, coordinates Polygon) (result string)

func GetNearDoc

func GetNearDoc(db *mongo.Database, collname string, coordinates Point) (result string)

func GetNearSphereDoc

func GetNearSphereDoc(db *mongo.Database, collname string, coordinates Point) (result string)

func GetOneDoc

func GetOneDoc[T any](db *mongo.Database, collection string, filter bson.M) (doc T)

func GetOneLatestDoc

func GetOneLatestDoc[T any](db *mongo.Database, collection string, filter bson.M) (doc T, err error)

func GetRandomDoc

func GetRandomDoc[T any](db *mongo.Database, collection string, size uint) (result []T, err error)

func InsertOneDoc

func InsertOneDoc(db *mongo.Database, collection string, doc interface{}) (insertedID interface{})

func MembuatGeojsonPoint

func MembuatGeojsonPoint(mongoenv, dbname, collname string, r *http.Request) string

func MembuatGeojsonPolygon

func MembuatGeojsonPolygon(mongoenv, dbname, collname string, r *http.Request) string

func MembuatGeojsonPolyline

func MembuatGeojsonPolyline(mongoenv, dbname, collname string, r *http.Request) string

func MongoConnect

func MongoConnect(mconn DBInfo) (db *mongo.Database)

func Near

func Near(mconn *mongo.Database, collname string, coordinates Point) string

func NearSphere

func NearSphere(mconn *mongo.Database, collname string, coordinates Point) string

func PostBox

func PostBox(mongoenv, dbname, collname string, r *http.Request) string

func PostCenter

func PostCenter(mongoenv, dbname, collname string, r *http.Request) string

func PostGeoIntersectsPoint added in v0.0.4

func PostGeoIntersectsPoint(mongoenv, dbname, collname string, r *http.Request) string

func PostGeoIntersectsPolygon added in v0.0.4

func PostGeoIntersectsPolygon(mongoenv, dbname, collname string, r *http.Request) string

func PostGeoIntersectsPolyline added in v0.0.4

func PostGeoIntersectsPolyline(mongoenv, dbname, collname string, r *http.Request) string

func PostGeoWithin

func PostGeoWithin(mongoenv, dbname, collname string, r *http.Request) string

func PostLinestring

func PostLinestring(mconn *mongo.Database, collection string, linestringdata GeoJsonLineString) interface{}

func PostNear

func PostNear(mongoenv, dbname, collname string, r *http.Request) string

func PostNearSphere

func PostNearSphere(mongoenv, dbname, collname string, r *http.Request) string

func PostPoint

func PostPoint(mconn *mongo.Database, collection string, pointdata GeoJsonPoint) interface{}

func PostPolygon

func PostPolygon(mconn *mongo.Database, collection string, polygondata GeoJsonPolygon) interface{}

func ReplaceOneDoc

func ReplaceOneDoc(db *mongo.Database, collection string, filter bson.M, doc interface{}) (updatereseult *mongo.UpdateResult)

func ReturnStruct

func ReturnStruct(DataStuct any) string

func SetConnection

func SetConnection(mongoenv, dbname string) *mongo.Database

func SetConnection2dsphere

func SetConnection2dsphere(mongoenv, dbname, collname string) *mongo.Database

Types

type CredentialUser

type CredentialUser struct {
	Status bool `json:"status" bson:"status"`
	Data   struct {
		Name     string `json:"name" bson:"name"`
		Username string `json:"username" bson:"username"`
		Role     string `json:"role" bson:"role"`
	} `json:"data" bson:"data"`
	Message string `json:"message,omitempty" bson:"message,omitempty"`
}

type DBInfo

type DBInfo struct {
	DBString       string
	DBName         string
	CollectionName string
}

type FullGeoJson

type FullGeoJson struct {
	ID         primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Type       string             `json:"type" bson:"type"`
	Properties Properties         `json:"properties" bson:"properties"`
	Geometry   Geometry           `json:"geometry" bson:"geometry"`
}

type GeoJson

type GeoJson struct {
	Type       string     `json:"type" bson:"type"`
	Properties Properties `json:"properties" bson:"properties"`
	Geometry   Geometry   `json:"geometry" bson:"geometry"`
}

func GetAllBangunan

func GetAllBangunan(mconn *mongo.Database, collname string) []GeoJson

type GeoJsonLineString

type GeoJsonLineString struct {
	Type       string     `json:"type" bson:"type"`
	Properties Properties `json:"properties" bson:"properties"`
	Geometry   struct {
		Coordinates [][]float64 `json:"coordinates" bson:"coordinates"`
		Type        string      `json:"type" bson:"type"`
	} `json:"geometry" bson:"geometry"`
}

type GeoJsonPoint

type GeoJsonPoint struct {
	Type       string     `json:"type" bson:"type"`
	Properties Properties `json:"properties" bson:"properties"`
	Geometry   struct {
		Coordinates []float64 `json:"coordinates" bson:"coordinates"`
		Type        string    `json:"type" bson:"type"`
	} `json:"geometry" bson:"geometry"`
}

type GeoJsonPolygon

type GeoJsonPolygon struct {
	Type       string     `json:"type" bson:"type"`
	Properties Properties `json:"properties" bson:"properties"`
	Geometry   struct {
		Coordinates [][][]float64 `json:"coordinates" bson:"coordinates"`
		Type        string        `json:"type,omitempty" bson:"type,omitempty"`
	} `json:"geometry" bson:"geometry"`
}

type Geometry

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

type LongLat

type LongLat struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type Payload

type Payload struct {
	Name     string    `json:"name"`
	Username string    `json:"username"`
	Role     string    `json:"role"`
	Exp      time.Time `json:"exp"`
	Iat      time.Time `json:"iat"`
	Nbf      time.Time `json:"nbf"`
}

type Pesan

type Pesan struct {
	Status  bool        `json:"status" bson:"status"`
	Message string      `json:"message" bson:"message"`
	Data    interface{} `json:"data,omitempty" bson:"data,omitempty"`
	Token   string      `json:"token,omitempty" bson:"token,omitempty"`
}

type Point

type Point struct {
	Coordinates []float64 `json:"coordinates" bson:"coordinates"`
	Max         int64     `json:"max,omitempty" bson:"max,omitempty"`
	Min         int64     `json:"min,omitempty" bson:"min,omitempty"`
}

type PointInter added in v0.0.4

type PointInter struct {
	Coordinates []float64 `json:"coordinates" bson:"coordinates"`
}

type Polygon

type Polygon struct {
	Coordinates [][][]float64 `json:"coordinates" bson:"coordinates"`
}

type Polyline

type Polyline struct {
	Coordinates [][]float64 `json:"coordinates" bson:"coordinates"`
}

type Properties

type Properties struct {
	Name string `json:"name" bson:"name"`
}

type User

type User struct {
	Name     string `json:"name" bson:"name"`
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
	Role     string `json:"role" bson:"role"`
}

Jump to

Keyboard shortcuts

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