• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

JasonSanford/gitspatial: A spatial API for your GitHub-hosted GeoJSON

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

JasonSanford/gitspatial

开源软件地址:

https://github.com/JasonSanford/gitspatial

开源编程语言:

Python 66.1%

开源软件介绍:

GitSpatial

A spatial API for your GitHub-hosted GeoJSON.

Read more in a blog post.

Overview

GitHub now supports rendering GeoJSON files. This makes it easy to collaborate on geo data. GitSpatial provides a spatial API for GeoJSON hosted at GitHub.

How it Works

  1. Visit http://gitspatial.com
  2. Authorize the site to access your GitHub repos
  3. Sync the repos that have GeoJSON in them
  4. Sync individual GeoJSON files within these repos
  5. We add a post-receive hook to your GitHub repo so we get notified when you might have updated features
  6. Utilize the API to query your features

Search by Bounding Box

Find all parks within a map view:

http://gitspatial.com/api/v1/JasonSanford/mecklenburg-gis-opendata/parks?bbox=-81.025,35.023,-80.685,35.487

Search by Point and Radius

Find all parks within 3000 meters of a point:

http://gitspatial.com/api/v1/JasonSanford/mecklenburg-gis-opendata/parks?lat=35.255&lon=-80.855&distance=3000

Development

GitSpatial is a Django app that uses PostGIS as a backend to GeoDjango. So, you might run into trouble getting dependencies installed.

Non-Python dependencies

  • GEOS
  • GDAL
  • Proj

Virtual Environment

Create a virtual environment. I drop the virtual envrionment within the root of the project. The venv directory is in .gitignore.

virtualenv venv

Source to the virtual environment.

source venv/bin/activate

Install dependencies defined in requirements.txt.

pip install -r requirements.txt

Environment Variables

To keep secret keys, passwords and such out of version control, we store them in environment variables. Below are the variables required to run.

AWS_ACCESS_KEY_ID=my-aws-key
AWS_SECRET_ACCESS_KEY=super-secret-aws-secret-access-key
DATABASE_URL=postgis://user:password@host:port/db_name
GITHUB_APP_ID=not-a-secret
GITHUB_API_SECRET=super-secret

Database Stuff

Assuming you have a database already created and credentials are in the DATABASE_URL envrionment variable, we just need to syncdb to get the necessary tables created. Do not create a superuser if prompted.

python manage.py syncdb

Running the App

The django web server (gunicorn) and the celery process are defined in Procfile. Run with Foreman.

foreman start

Static Files

Static file deployment is handled by the collectstatic command. We're using a combination of django-store and boto to automatically collect/push static files to Amazon S3 during deployment.

All static files should be placed in the /static directory if they need to be deployed.

python manage.py collectstatic

Testing

Do it with fab

fab test

Deploying

Do it with fab

fab deploy



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap