{ "info": { "author": "Ivan Del Mastro", "author_email": "info@adventure2italy.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "=====================\ndjango-geopositionmap\n=====================\n\nA model field that can hold a geoposition (latitude/longitude), and corresponding admin/form widget.\nPorting to GeoDjango Point type.\nGoogle map and OSM map widgets.\n\n\nPrerequisites\n-------------\n\ndjango-geopositionmap requires Django 1.4.10 or greater.\nGeoDjango gis contrib geospatial framework.\n\n\nInstallation\n------------\n\n- Use your favorite Python packaging tool to install ``geopositionmap``\n from `PyPI`_, e.g.::\n\n pip install django-geopositionmap\n\n- Add ``\"geopositionmap\"`` to your ``INSTALLED_APPS`` setting::\n\n INSTALLED_APPS = (\n # \u2026\n \"geopositionmap\",\n )\n\n- If you are still using Django <1.3, you are advised to install\n `django-staticfiles`_ for static file serving.\n\n\nUsage\n-----\n\n``django-geopositionmap`` comes with a model field that makes it pretty\neasy to add a geoposition field to one of your models. To make use of\nit:\n\n- In your ``myapp/models.py``::\n\n from django.db import models\n from geopositionmap.geoFields import LatLngField\n\n class POI(models.Model):\n name = models.CharField(max_length=100)\n position = LatLngField()\n\n- This enables the following simple API::\n\n >>> from myapp.models import POI\n >>> poi = POI.objects.get(id=1)\n >>> poi.position\n LatLng(52.522906,13.41156)\n >>> poi.position.lat\n 52.522906\n >>> poi.position.lng\n 13.41156\n\n- Some methods:\n\n >>> pos = LatLng(10.0, 11.0)\n >>> pos.geosPoint\n \n >>> type(pos.geosPoint)\n \n >>> pos\n LatLng(10.0,11.0)\n >>> pos = LatLng('10','11')\n >>> pos\n LatLng(10.0,11.0)\n >>> pos.lat\n 10.0\n >>> pos.lng\n 11.0\n >>> print pos\n +010.0000000000000000,+011.0000000000000000\n >>> type(pos)\n \n >>> pos.to_string()\n u'+010.0000000000000000,+011.0000000000000000'\n >>> type(pos.to_string())\n \n >>> pos.pos\n (10.0, 11.0)\n >>> type (pos.pos)\n \n >>> pos.lat = 14\n >>> pos.lng = -12\n >>> pos\n LatLng(14.0, -12.0)\n >>> pos.setPos(41,46)\n LatLng(41.0, 46.0)\n >>> pos.setPos('41.15 46.56')\n LatLng(41.15, 46.56)\n >>> \n >>> ne = LatLng('-13.0','-11.0')\n >>> pos = LatLng('-14.0','-12.3')\n >>> sw = LatLng('-15.0','-13.0')\n >>> pos.isBounded(ne,sw)\n LatLng(-14.0, -12.3)\n >>> pos = LatLng('-14.0','12.3')\n >>> pos.isBounded(ne,sw)\n False\n\n \n\nForm field and widget\n---------------------\n\nAdmin\n^^^^^\n\nIf you use a ``LatLngField`` in the admin it will automatically\nshow a `Google Maps`_ widget with a marker at the currently stored\nposition. You can drag and drop the marker with the mouse and the\ncorresponding latitude and longitude fields will be updated\naccordingly.\n\nIt looks like this:\n\n|geopositionmap-widget-admin|\n\n\nManager in models\n-----------------\n\nModels\n^^^^^^\n\nYou can use custom Manager to manage custom methods in your models object.\nLatLngField object is a geo position coordinate, thus you can find out if your point is right\ninto a boud area (NE,SW).\n\n- In your ``myapp/models.py``::\n\n from django.db import models\n from geopositionmap.geoFields import LatLngField\n from geopositionmap.geoManager import geoManager\n \n objects = geoManager()\n\n class POI(models.Model):\n name = models.CharField(max_length=100)\n position = LatLngField()\n \n def is_bounded(self):\n return self.position\n\n- This enables the following simple API::\n\n >>> from myapp.models import POI\n >>> POI.objects.bound('42,13','40,10') #retrive POIs into bound rectangle, if are active\n []\n >>> POI.objects.bound() #retrive all active POIs\n []\n\n \n- Active on map method\n\n from django.db import models\n from geopositionmap.geoFields import LatLngField\n from geopositionmap.geoManager import geoManager\n \n objects = geoManager()\n\n class POI(models.Model):\n name = models.CharField(max_length=100)\n position = LatLngField()\n \n def active_OnMap(self):\n return False #return 'True' to active is_bounded method\n \n def is_bounded(self):\n return self.position\n \n- Use active_OnMap method enables the following simple API::\n\n >>> from myapp.models import POI\n >>> POI.objects.bound('42,13','40,10')\n []\n >>> POI.objects.bound()\n []\n \n \nRegular Forms\n^^^^^^^^^^^^^\n\nUsing the map widget on a regular form outside of the admin requires\njust a little more work. In your template make sure that\n\n- `jQuery`_ is included\n- the static files (JS, CSS) of the map widget are included (just use\n ``{{ form.media }}``)\n\n**Example**::\n\n \n
{% csrf_token %}\n {{ form.media }}\n {{ form.as_p }}\n
\n\n\nSettings\n--------\n\nYou can customize the `MapOptions`_ and `MarkerOptions`_ used to initialize the\nmap and marker in JavaScript by defining ``GEOPOSITIONMAP_MAP_OPTIONS`` or\n``GEOPOSITIONMAP_MARKER_OPTIONS`` in your ``settings.py``.\nSet True GEOPOSITIONMAP_GOOGLE_VIEW.GOOGLE_VIEW and GEOPOSITIONMAP_OSM_VIEW.OSM_VIEW to view\nGoogle maps or view OSM maps.\n\n**Example**::\n\n GEOPOSITIONMAP_MAP_OPTIONS = {\n 'minZoom': 3,\n 'maxZoom': 15,\n }\n\n GEOPOSITIONMAP_MARKER_OPTIONS = {\n 'cursor': 'move'\n }\n\n GEOPOSITIONMAP_GOOGLE_VIEW = False # default is True\n GEOPOSITIONMAP_OSM_VIEW = False # default is True\n \nPlease note that you cannot use a value like ``new google.maps.LatLng(52.5,13.4)``\nfor a setting like ``center`` or ``position`` because that would end up as a\nstring in the JavaScript code and not be evaluated. Please use\n`Lat/Lng Object Literals`_ for that purpose, e.g. ``{'lat': 52.5, 'lng': 13.4}``.\n\nYou can also customize the height of the displayed map widget by setting\n``GEOPOSITION_MAP_WIDGET_HEIGHT`` to an integer value (default is 480).\n\n\nLicense\n-------\n\n`MIT`_\n\n\n.. _Google Maps: http://code.google.com/apis/maps/documentation/javascript/\n.. |geopositionmap-widget-admin| image:: docs/images/admin.jpg\n.. _jQuery: http://jquery.com\n.. _MIT: http://philippbosch.mit-license.org/\n.. _MapOptions: https://developers.google.com/maps/documentation/javascript/reference?csw=1#MapOptions\n.. _MarkerOptions: https://developers.google.com/maps/documentation/javascript/reference?csw=1#MarkerOptions\n.. _Lat/Lng Object Literals: https://developers.google.com/maps/documentation/javascript/examples/map-latlng-literal\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ivandm/django-geopositionmap", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-geopositionmap", "package_url": "https://pypi.org/project/django-geopositionmap/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-geopositionmap/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/ivandm/django-geopositionmap" }, "release_url": "https://pypi.org/project/django-geopositionmap/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "Django Geoposition, google and osm map. Model field that can hold a geoposition with bound method, gis Point type, and corresponding admin widget.", "version": "1.0.0" }, "last_serial": 1373043, "releases": { "0.0.1": [], "0.0.2": [ { "comment_text": "", "digests": { "md5": "f59a0b1ccb5d2cb8e9eb2804ea1447dc", "sha256": "048c054e7ef0c25b85fa09fa7ab361df1a18555f28848589a73d8318e3da1ef9" }, "downloads": -1, "filename": "django-geopositionmap-0.0.2.zip", "has_sig": false, "md5_digest": "f59a0b1ccb5d2cb8e9eb2804ea1447dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17177, "upload_time": "2014-12-08T07:53:06", "url": "https://files.pythonhosted.org/packages/33/63/1bcd1c718c91f7ce0685c7cdfbd2b29a43109cdc3635eb310aa53f365fc4/django-geopositionmap-0.0.2.zip" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "94d878098285cc3827cab86a74bc671f", "sha256": "722babffe22852339297589d69f91118aac0b3b30985d6cebbd14800d5730ff7" }, "downloads": -1, "filename": "django-geopositionmap-0.0.3.zip", "has_sig": false, "md5_digest": "94d878098285cc3827cab86a74bc671f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17326, "upload_time": "2014-12-08T16:06:22", "url": "https://files.pythonhosted.org/packages/28/a0/cbc70feb48af9a04242fbde51ef3ecb998f87f8bbe78b79f32be8b2177e3/django-geopositionmap-0.0.3.zip" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "b9f359d0b91f06a2842855484791ce61", "sha256": "8e95afacd030841c62cca17614eb3b45878934de72f8db713da7838cb112772a" }, "downloads": -1, "filename": "django-geopositionmap-0.0.4.zip", "has_sig": false, "md5_digest": "b9f359d0b91f06a2842855484791ce61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21505, "upload_time": "2014-12-08T17:26:33", "url": "https://files.pythonhosted.org/packages/f3/56/8e7792121408785d75d27dceea08f87a1ef2ef0f77a72b9e2121112a24d0/django-geopositionmap-0.0.4.zip" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "9b123e7f665ac59363cd534f332fa693", "sha256": "83cf8f5ee84abaabab198a8f2219b643ce6b646d64718bd82ec84fd322d453b1" }, "downloads": -1, "filename": "django-geopositionmap-0.0.5.zip", "has_sig": false, "md5_digest": "9b123e7f665ac59363cd534f332fa693", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21533, "upload_time": "2014-12-08T17:44:09", "url": "https://files.pythonhosted.org/packages/52/cb/c658c92d2c7a45ce35722a9fc5e21612ee4d8c2c2f78f2c511062f4f629b/django-geopositionmap-0.0.5.zip" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "28ced4402139b56016603d4095f448d6", "sha256": "3eab2d98daaed4ea9d591aeed1b78ab911df6f8cafc3748b9ad8e5cac291cad1" }, "downloads": -1, "filename": "django-geopositionmap-0.0.6.zip", "has_sig": false, "md5_digest": "28ced4402139b56016603d4095f448d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22069, "upload_time": "2014-12-12T15:41:05", "url": "https://files.pythonhosted.org/packages/6f/53/acfbc3691e6fed17fd24bedb7bdf1c1df26b271ac29f54ad3d5502b619ae/django-geopositionmap-0.0.6.zip" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "3967ca24eda3225ed4f74f0b853d31d8", "sha256": "0346c884277c30d0eb7a221f5d0fec581bd2f918e512d814e6c7b6ae87246732" }, "downloads": -1, "filename": "django-geopositionmap-0.0.7.zip", "has_sig": false, "md5_digest": "3967ca24eda3225ed4f74f0b853d31d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22104, "upload_time": "2014-12-13T06:51:26", "url": "https://files.pythonhosted.org/packages/8f/3d/f8666ee82047d6e0c98dc3d0fe203ef4fc6888476c30dae87cccbea04a1d/django-geopositionmap-0.0.7.zip" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "ec79ac878c6ef7c3a24da2ced2c28de4", "sha256": "064760ab5891b23489b02a2d8ea3e7c1a89a200e990d264efcfefdd4f3524e81" }, "downloads": -1, "filename": "django-geopositionmap-1.0.0.zip", "has_sig": false, "md5_digest": "ec79ac878c6ef7c3a24da2ced2c28de4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23624, "upload_time": "2015-01-06T18:31:27", "url": "https://files.pythonhosted.org/packages/5f/15/ccd93210611fd21bd3604478f8ca1df6bb6c03b5c56ab1948a45465a4bc2/django-geopositionmap-1.0.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ec79ac878c6ef7c3a24da2ced2c28de4", "sha256": "064760ab5891b23489b02a2d8ea3e7c1a89a200e990d264efcfefdd4f3524e81" }, "downloads": -1, "filename": "django-geopositionmap-1.0.0.zip", "has_sig": false, "md5_digest": "ec79ac878c6ef7c3a24da2ced2c28de4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23624, "upload_time": "2015-01-06T18:31:27", "url": "https://files.pythonhosted.org/packages/5f/15/ccd93210611fd21bd3604478f8ca1df6bb6c03b5c56ab1948a45465a4bc2/django-geopositionmap-1.0.0.zip" } ] }