安装GoMap

参考:https://github.com/ehrudxo/GoMap

1、依赖go包安装

gorm包安装

直接在github首页搜索gorm,找到对应的gorm包:

 

然后打开本机cmd命令行窗口,切换到GOPATH对应的目录,运行安装命令:

go get github.com/jinzhu/gorm等待安装完成,若失败可多试几次;

draw2d安装

运行安装命令:

go get github.com/llgcode/draw2d,等待draw2d包安装完成

gormGIS安装

运行安装命令:

go get github.com/nferruzzi/gormGIS,等待gormGIS包安装完成

2、Revel框架安装

执行如下命令安装Revel网络开发框架,可能需要FQ才能成功下载依赖的go包

# get revel framework
go get github.com/revel/revel
 
# get 'revel' command
go get github.com/revel/cmd/revel
 
# get samples and run chat app
go get github.com/revel/samples
revel run github.com/revel/samples/chat

3、安装GoMap

可运行命令go get github.com/ehrudxo/GoMap下载GoMap项目,也可自行在github上下载该源码,放置在GOPATH中对应目录下,然后运行go get命令编译安装。

目前源码中有部分错误,无法编译通过,修改如下:

app\services\images.go文件中的draw2d包路径不对,改为前面下载的github.com/llgcode/draw2d即可;

app\controllers\app.go中的RenderJson()函数已经被遗弃,修改为RenderJSON()即可;

示例的toilet图层连接的是postgres数据库,会导致启动失败,是无法看到图层的,需连接部署好的postgres数据库,当然对应的地理数据表格和解析代码都需同步更新才行,数据库连接参数可参考http://doc.gorm.io/database.html#connecting-to-a-database

 

4、运行GoMap

go get github.com/ehrudxo/GoMap命令执行通过后,执行

revel run github.com/ehrudxo/GoMap运行GoMap实例,在浏览器中输入:http://localhost:9000/map查看地图

http://localhost:9000/atest?BBOX=4097100,-144250,4097900,-143805&WIDTH=750&HEIGHT=400&SRS=EPSG:3857 查看扩展的atest图层

 

5、打包部署GoMap

执行命令revel package github.com/ehrudxo/GoMap,将GoMap打包,在命令执行目录下(GOPATH目录)生成部署压缩文件: ,将其解压,运行其中的run.bat或者run.sh启动GoMap。

 

posted @ 2018-05-09 15:01  GISer-Li  阅读(521)  评论(0编辑  收藏  举报