Skip to content

jackbit/gmaps2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gmaps2

Main Example

go run main.go s2trip --start '-33.43535986456468, -70.70988860468003' --end '-33.46268514612078, -70.68886433781532' --pickup '-33.447130720203354, -70.70814176197621' --drop '-33.43672804765354, -70.6861326682225' --radius 13 --tripmaxlevel 16 --tripminlevel 16 --tripmaxcell 50

Video Explanation:

https://youtube.com/watch?v=vmJxjaTARRY

https://www.youtube.com/watch?v=_-ewGKC4ZRM

Setup

go mod tidy
go run main.go -h

Usage:
  gmaps2 [flags]
  gmaps2 [command]

Available Commands:
  direction   search direction from google map api
  geojson     geojson convert google direction result to geojson format
  help        Help about any command

Flags:
  -h, --help   help for gmaps2

Use "gmaps2 [command] --help" for more information about a command.

Google Direction

search direction from google map api
go run main.go direction -h

Usage:
  gmaps2 direction -o '7.123,144.567' -d '7.456,144.890' -w '7.234,144.678|7.345,144.789' [flags]

Flags:
  -a, --avoid string           avoid=tolls|highways|ferries
  -c, --configfile string      config file
  -t, --departuretime string   departure time in unixtimestamp
  -d, --destination string     destination latitude,longitude
  -h, --help                   help for direction
  -o, --origin string          origin latitude,longitude
  -w, --waypoints string       waypoint addrlatitude,longitude with '|' as separator

GeoJSON

geojson convert google direction result to geojson format
go run main.go geojson -h

Usage:
  gmaps2 geojson -t 'multiboxes' -f 'input/multiboxes.json' [flags]

Flags:
  -f, --file string   json source for geo convertion
  -h, --help          help for geojson
  -t, --type string   type=line|multilines|multiboxes (default "line")

Convert LineString to MultiPolygon

 go run main.go geojson -t multipolygon -f input/linestring.json -r 0.2 -u km

Convert LineString to 1D Polygon

go run main.go geojson -t linetogon -f input/linestring.json

Convert Origin and Destination to Polygon

go run main.go geojson -t multiboxes -f input/multiboxes.json

Convert Google Direction to Linestring and Destination to Polygon

go run main.go geojson -t line -f input/direction.json

S2Polyline

s2polyline convert geojson linestring to s2polyline
go run main.go s2polyline -h

Usage:
  gmaps2 s2polyline -f 'input/linestring.json' [flags]

Flags:
  -c, --contain string     contain s2.cell from lat,lng
  -f, --file string        json source for geo convertion
  -h, --help               help for s2polyline
  -i, --intersect string   intersect s2.cell from lat,lng

GEOS

geos convert linestring to polygon by GEOS

Installation

The project depends on geos (GEOS is a C++ port of the ​JTS Topology Suite), you need to complete the installation of geos first. The installation of geos:

  1. Mac OS X(via brew)
$ brew install geos
  1. Ubuntu or Debian
$ apt-get install libgeos-dev
  1. Build from source code
$ wget http://download.osgeo.org/geos/geos-3.9.0.tar.bz2
$ tar xvfj geos-3.9.0.tar.bz2
$ cd geos-3.9.0
$ ./configure
$ make
$ sudo make install

Usage

go run main.go geos -h


Usage:
  gmaps2 geos -f 'input/linestring.json' -s 2 [flags]

Flags:
  -f, --file string     json source for geo convertion
  -h, --help            help for geos
  -s, --sample string   example operation in integer (s=1,2,3)
Result polyline from google direction

polyline

Result conversion to polygon

Result conversion to polygon

Comparison polyline and polygon

Comparison polyline and polygon

Radius polygon to polyline

Radius polygon to polyline

Diameter polygon

Diameter polygon

S2 Polygon

Diameter polygon

About

Experimental Google S2 and Google Direction

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages