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
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.
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
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")
go run main.go geojson -t multipolygon -f input/linestring.json -r 0.2 -u km
go run main.go geojson -t linetogon -f input/linestring.json
go run main.go geojson -t multiboxes -f input/multiboxes.json
go run main.go geojson -t line -f input/direction.json
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
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
:
- Mac OS X(via brew)
$ brew install geos
- Ubuntu or Debian
$ apt-get install libgeos-dev
- 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
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)