gormgis

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

gormgis

This repository is a fork of the original gormGIS package, modified to provide enhanced PostGIS support for the GORM library in Go.

Overview

gormGIS adds PostGIS geometric type support to GORM, allowing you to easily work with geographic data in your Go applications using PostgreSQL's PostGIS extension.

Features

  • Support for PostGIS geometric types in GORM models
  • Simple and straightforward API
  • Compatible with GORM v2
  • Supports SRID 4326 (WGS 84) coordinate system

Supported Types

Currently supported PostGIS types:

  • geometry(Geometry,4326) - Geometric points with latitude and longitude

Usage Example

type Location struct {
    ID uint
    Point gormgis.Point `gorm:"type:geometry(Point,4326)"`
}
    // Create a new point
location := Location{
    Point: &gormgis.Point{
        Lng: -73.935242,
        Lat: 40.730610,
},
}

Installation

go get github.com/9ssi7/gormgis

Modifications from Original

This fork includes several modifications from the original package:

  • Simplified type handling
  • Focus on Point geometry type
  • SRID 4326 specific implementation

License

Apache License 2.0

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

type Point struct {
	Lng float64 `json:"lng"`
	Lat float64 `json:"lat"`
}

func (*Point) Scan

func (p *Point) Scan(val interface{}) error

func (*Point) String

func (p *Point) String() string

func (Point) Value

func (p Point) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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