{ "info": { "author": "Joway Wong", "author_email": "joway.w@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "Django-GeoField\n=====\n![](https://api.travis-ci.org/joway/django-geofield.svg?branch=master)\n\nA lightweight Django Geo Field to save and handle Geo Points. It supports to search the nearby points by their geohash.\n\nQuick start\n-----------\n\n0. Install django-geofield\n\n pip install django-geofield\n\n1. Define GeoPositionField in your Model like this::\n\n class Point(models.Model):\n ...\n position = GeoPositionField(db_index=True)\n\n2. Run `python manage.py makemigrations` and `python manage.py migrate` to make it effect\n\n3. The field will save a geo point with a string into database like this :\n\n Point.objects.create(\n position=GeoPosition(lat, lon, precision=6))\n\n 'wtmm7w,30.49145747305400533377905958332121372222900390625,120.042387425481223317547119222581386566162109375'\n\n4. If you want to query the points whose geohash is matched exactly with the given point , you can :\n\n pos = Point.objects.get(id=1)\n\n points_matched = Point.objects.filter(position__geoprecise=pos.position.geohash)\n\n\n The '__geoprecise' lookup will find all points have the same geohash.\n\n5. If you want to query the points in expand area to eliminate the geohash's marginal error, you can :\n\n pos = Point.objects.get(id=1)\n\n points_matched = Point.objects.filter(position__geosearch=pos.position.geohash)\n\n The '__geosearch' lookup will find all points have one of 9 ( 1 center point and 8 expand point) geohash .\n\n\n6. If you want to query the points within a specific range , you should lookup the geohash table to get the geohash length you want, then just search the cropped length.\n\n pos = Point.objects.get(id=1)\n\n points_matched = Point.objects.filter(position__geosearch=pos.position.geohash[0:4])\n\n ![](http://images.cnitblog.com/blog/522490/201309/09185913-9f6f65fc3d3c40ecb3328970831c625c.png)\n\n#### PS: \n\nIf you want to limit the distance strictly, you should writer your own codes to filter the result .\n\nAbout GeoHash\n------\n\n[Wikipedia](http://en.wikipedia.org/wiki/Geohash)\n\n\n\n\nSupport\n------\n\npython:\n - \"2.7\"\n - \"3.2\"\n - \"3.3\"\n - \"3.4\"\n - \"3.5\"\n - \"3.5-dev\" # 3.5 development branch\n - \"nightly\" # currently points to 3.6-dev\n\n\nThanks\n------\n\n[python-geohash](https://github.com/hkwi/python-geohash/blob/master/geohash.py)\n\nLicense\n------\n\nMIT", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/joway/django-geofield", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "django-geofield", "package_url": "https://pypi.org/project/django-geofield/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-geofield/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/joway/django-geofield" }, "release_url": "https://pypi.org/project/django-geofield/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "A lightweight Django Geo Field to save and handle Geo Points. It supports to search the nearby points by their geohash", "version": "0.0.2" }, "last_serial": 2134686, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "80f617eabe10bf008fdd84cef91c2c2b", "sha256": "c5ed5da846941b568d361d45c4c5d232e56abc641f24b5d53bb7dabadefe84c6" }, "downloads": -1, "filename": "django-geofield-0.0.1.tar.gz", "has_sig": false, "md5_digest": "80f617eabe10bf008fdd84cef91c2c2b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9356, "upload_time": "2016-05-25T09:51:51", "url": "https://files.pythonhosted.org/packages/25/78/aff9c1cd6edd79a92a0e5d7e2d0f60f72fab303e02abcb8b17faea84af54/django-geofield-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "59d8067ad2554c04f51b47782c118feb", "sha256": "469b00999736cf8efedda6c0eb5029a909e5cbdfd8b6281b2c3016b19f8d3c90" }, "downloads": -1, "filename": "django_geofield-0.0.2.tar.gz", "has_sig": false, "md5_digest": "59d8067ad2554c04f51b47782c118feb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8283, "upload_time": "2016-05-26T10:48:22", "url": "https://files.pythonhosted.org/packages/a3/f5/9f9f2c03538fa5126d79fc4487184eea321e2ad342cffafbff2e19387d3a/django_geofield-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "59d8067ad2554c04f51b47782c118feb", "sha256": "469b00999736cf8efedda6c0eb5029a909e5cbdfd8b6281b2c3016b19f8d3c90" }, "downloads": -1, "filename": "django_geofield-0.0.2.tar.gz", "has_sig": false, "md5_digest": "59d8067ad2554c04f51b47782c118feb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8283, "upload_time": "2016-05-26T10:48:22", "url": "https://files.pythonhosted.org/packages/a3/f5/9f9f2c03538fa5126d79fc4487184eea321e2ad342cffafbff2e19387d3a/django_geofield-0.0.2.tar.gz" } ] }