向geokey项目添加web资源

geokey-webresources的Python项目详细描述


PyPI PackageTravis CI Build StatusCoveralls Test Coverage

GeoKey网络资源

通过添加web资源扩展geokey项目:geojson和kml。

安装

GeoKey WebResources需要:

  • python 2.7版
  • GeoKey 1.6或更高版本

从pypi安装geokey webresources:

pip install geokey-webresources

或者从克隆存储库:

cd geokey-webresources
pip install -e .

将软件包添加到已安装的应用程序:

INSTALLED_APPS += (
    ...
    'geokey_webresources',
)

将模型迁移到数据库:

python manage.py migrate geokey_webresources

你现在可以走了!

更新

从pypi更新geokey webresources:

pip install -U geokey-webresources

将新模型迁移到数据库:

python manage.py migrate geokey_webresources

测试

运行测试:

python manage.py test geokey_webresources

检查代码覆盖范围:

pip install coverage
coverage run --source=geokey_webresources manage.py test geokey_webresources
coverage report -m --omit=*/tests/*,*/migrations/*

公共api

获取项目的所有web资源

GET /api/projects/:project_id/webresources/

请求参数:

ParameterTypeDescription
project_idIntegerA unique identifier for the project.

响应:

响应包含一个web资源数组。如果数组为空,则项目没有活动的Web资源。

[
    {
        "id": 46,
        "status": "active",
        "name": "Public Houses",
        "description": "All public houses in London.",
        "created": "2014-09-19T15:51:32.790Z",
        "modified": "2014-09-21T15:51:32.804Z",
        "dataformat": "KML",
        "url": "http://london.co.uk/public-houses.kml",
        "colour": "#000000",
        "symbol": null
    }
]

响应状态代码:

CodeReason
200The list of web resources has been returned successfully.
404The project was not found (or user has no access to it).

获取项目的单个web资源

GET /api/projects/:project_id/webresources/:webresource_id/

请求参数:

ParameterTypeDescription
project_idIntegerA unique identifier for the project.
webresource_idIntegerA unique identifier for the web resource.

响应:

{
    "id": 46,
    "status": "active",
    "name": "Train Stations",
    "description": "Train stations in Germany.",
    "created": "2015-09-15T09:40:01.747Z",
    "modified": "2016-01-10T07:12:01.827Z",
    "dataformat": "GeoJSON",
    "url": "https://germany.de/all-train-stations.geojson",
    "colour": "#ffc0cb",
    "symbol": '/media/webresources/symbols/train_stations.png'
}

响应状态代码:

CodeReason
200The web resource has been returned successfully.
404The project or web resource was not found.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何将cassandra中的行数据转换为与列相关的嵌套json   java如何使用jcr XPath在jcr:content/@jcr:data中搜索?   java在使用openCV进行安卓开发时如何利用手机的广角镜头   java解析扩展了接口,结束了一个潜在的无限循环   位置服务的@Override方法中存在java Android应用程序错误   java本地线程的用途和需求是什么   具有左右子访问的java节点树遍历   java验证JsonWebToken签名   JUL日志处理程序中的java日志记录   嵌入式Java读取给定时间段的串行数据。   java有没有办法从多个URL获取多个图像?   java线程通过等待intent阻止自己发送intent   java Spring MVC解析多部分内容请求   java JPA/Hibernate静态元模型属性未填充NullPointerException   java格式错误的字符(需要引号,得到I)~正在处理   java为什么PrintWriter对象抛出FileNotFoundException?   java Neo4j未正确保存标签   java IE不加载图像