{"id":13468841,"url":"https://github.com/erdem/django-map-widgets","last_synced_at":"2025-05-14T10:12:38.714Z","repository":{"id":40244626,"uuid":"52210304","full_name":"erdem/django-map-widgets","owner":"erdem","description":"Highly customizable, intuitive, and user-friendly map widgets for GeoDjango applications.","archived":false,"fork":false,"pushed_at":"2024-12-16T15:01:07.000Z","size":24021,"stargazers_count":465,"open_issues_count":4,"forks_count":127,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-05-12T04:52:37.411Z","etag":null,"topics":["django","django-admin","django-map-widgets","geodjango","geolocation","geospatial","map-widgets"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erdem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-21T14:27:13.000Z","updated_at":"2025-05-05T03:19:02.000Z","dependencies_parsed_at":"2023-02-16T18:45:39.828Z","dependency_job_id":"981d84cf-0925-4539-8199-d489f23b093c","html_url":"https://github.com/erdem/django-map-widgets","commit_stats":{"total_commits":370,"total_committers":31,"mean_commits":"11.935483870967742","dds":0.3027027027027027,"last_synced_commit":"e691152a6955f88a1ebe2023a657848b1f90d16e"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdem%2Fdjango-map-widgets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdem%2Fdjango-map-widgets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdem%2Fdjango-map-widgets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdem%2Fdjango-map-widgets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erdem","download_url":"https://codeload.github.com/erdem/django-map-widgets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253678854,"owners_count":21946315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","django-admin","django-map-widgets","geodjango","geolocation","geospatial","map-widgets"],"created_at":"2024-07-31T15:01:20.134Z","updated_at":"2025-05-14T10:12:38.659Z","avatar_url":"https://github.com/erdem.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"![CI](https://github.com/erdem/django-map-widgets/workflows/CI/badge.svg)\n[![PyPI version](https://badge.fury.io/py/django-map-widgets.svg?c=1)](https://badge.fury.io/py/django-map-widgets)\n![License](https://img.shields.io/github/license/erdem/django-map-widgets.svg)\n![Documentation Status](https://readthedocs.org/projects/django-map-widgets/badge/?version=latest)\n\n## Django Map Widgets\n\nDjango Map Widgets is a package that provides highly configurable, pluggable, and user-friendly map widgets for\nGeoDjango form fields. It simplifies the integration of interactive maps into GeoDjango applications, enhancing the\noverall development experience.\n\nThe primary goal of Django Map Widgets is to bridge the gap between powerful GeoDjango functionality and user-friendly\nmap interactions, creating a more accessible and enjoyable experience for both developers and end-users of\nGeoDjango-powered applications. Currently, the package supports Google, Mapbox, and Leaflet mapping platforms.\n\n![mapbox_interactive demo](https://github.com/erdem/django-map-widgets/assets/1518272/e6e454f0-6486-4fe7-a0b3-712b9371030a)\n\n\n\n\n\n---\n\n- [Documentation](http://django-map-widgets.readthedocs.io/)\n- [Demo Project](https://github.com/erdem/django-map-widgets/tree/main/demo)\n- [Home Page](https://github.com/erdem/django-map-widgets/)\n\n### Installation\n\n```shell\npip install django-map-widgets\n```\n\nAdd ‘mapwidgets’ to your `INSTALLED_APPS` in settings.py\n\n```python\nINSTALLED_APPS = [\n    ...\n    'django.contrib.sessions',\n    'django.contrib.staticfiles',\n\n    'mapwidgets',\n]\n\n```\n\nEnsure `collectstatic` Django admin command is run before using the widgets in production.\n\n```shell\npython manage.py collectstatic\n```\n\n### Usage\n\n**Django Admin Usage**\n\n```python\nfrom django.contrib.gis.db import models\nimport mapwidgets\n\n\nclass CityAdmin(admin.ModelAdmin):\n    formfield_overrides = {\n        models.PointField: {\"widget\": mapwidgets.GoogleMapPointFieldWidget}\n    }\n```\n\n**Django Forms Usage**\n\n```python\nfrom mapwidgets.widgets import GoogleMapPointFieldWidget, MapboxPointFieldWidget\n\n\nclass CityForm(forms.ModelForm):\n    class Meta:\n        model = City\n        fields = (\"coordinates\", \"city_hall\")\n        widgets = {\n            'coordinates': GoogleMapPointFieldWidget,\n            'city_hall': MapboxPointFieldWidget,\n        }\n\n\n```\n\nWhen the map widgets are used in Django web views with forms, Remember to include `{{ form.media }}` template tag in the\nview templates.\n\n**Settings**\n\nThe JavaScript map rendering behavior of the widgets can be customized by providing `MAP_WIDGETS` config in the\nproject's settings file. For detailed guidance on map customization options, check\nthe [settings guide](http://django-map-widgets.readthedocs.io/settings).\n\n```python\nGOOGLE_MAP_API_KEY = os.getenv(\"GOOGLE_MAP_API_KEY\")\nMAPBOX_ACCESS_TOKEN = os.getenv(\"MAPBOX_ACCESS_TOKEN\")\n\nMAP_WIDGETS = {\n    \"GoogleMap\": {\n        \"apiKey\": GOOGLE_MAP_API_KEY,\n        \"PointField\": {\n            \"interactive\": {\n                \"mapOptions\": {\n                    \"zoom\": 15,  # set initial zoom\n                    \"streetViewControl\": False,\n                },\n                \"GooglePlaceAutocompleteOptions\": {\n                    \"componentRestrictions\": {\"country\": \"uk\"}\n                },\n            }\n        }\n    },\n    \"Mapbox\": {\n        \"accessToken\": MAPBOX_ACCESS_TOKEN,\n        \"PointField\": {\n            \"interactive\": {\n                \"mapOptions\": {\"zoom\": 12, \"center\": (51.515618, -0.091998)},\n                \"markerFitZoom\": 14,\n            }\n        },\n    },\n    \"Leaflet\": {\n        \"PointField\": {\n            \"interactive\": {\n                \"mapOptions\": {\n                    \"zoom\": 12,\n                    \"scrollWheelZoom\": False\n                }\n            }\n        },\n        \"markerFitZoom\": 14,\n    }\n}\n```\n\n### JQuery Requirement\n\njQuery is required for Django Map Widgets to function in regular Django views. However, if the widgets is being used\nwithin the Django Admin, jQuery does not need to be provided separately. Any map widget class can be configured as\ndescribed in the documentation, and they will work out of the box.\n\nPreferable jQuery version is `3.7-slim`.\n\n### Support\n\nDjango Map Widgets offers two types of widgets:\n\n1. **Interactive (Dynamic) Widgets**: These widgets allow users to interact with the map, such as clicking to set a\n   location or dragging a marker. They are ideal for data input and editing scenarios.\n\n2. **Static (Read-only) Widgets**: These widgets display map data in a non-interactive format. They are useful for\n   presenting location information without allowing modifications.\n\n**Widget Support Matrix**\n---\n\n| **GeoDjango Field**    | **GoogleMap** |        | **Mapbox**  |        | **Leaflet** |        |\n|------------------------|---------------|--------|-------------|--------|-------------|--------|\n|                        | Interactive   | Static | Interactive | Static | Interactive | Static |\n| *PointField*           | ✅             | ✅      | ✅           | ✅      | ✅           | N/A    |\n| *LineStringField*      | ✖️            | ✖️     | ✖️          | ✖️     | ✖️          | N/A    |\n| *PolygonField*         | ✖️            | ✖️     | ✖️          | ✖️     | ✖️          | N/A    |\n| *MultiPointField*      | ✖️            | ✖️     | ✖️          | ✖️     | ✖️          | N/A    |\n| *MultiLineStringField* | ✖️            | ✖️     | ✖️          | ✖️     | ✖️          | N/A    |\n| *MultiPolygonField*    | ✖️            | ✖️     | ✖️          | ✖️     | ✖️          | N/A    |\n\n### Contribution\n\nCurrently, the package supports Google, Mapbox, and Leaflet mapping platforms. If you have ideas for additional map\nproviders or new features, or even if you want to help extend support to other GeoDjango form fields, feel free to do\nso. We would be happy to review and merge your contributions.\n\nFor more info how to contribute, please check out\nthe [contribution guidelines](http://django-map-widgets.readthedocs.io/contribution).\n\n### Screenshots\n\n##### MapBox Interactive Point Field Widget\n\u003cimg width=\"1064\" alt=\"mapbox_interactive_preview\" src=\"https://github.com/erdem/django-map-widgets/assets/1518272/f2df8654-b29a-4d64-9159-87a3790ede0b\"\u003e\n\n##### MapBox Static Point Field Widget\n\n![](https://github.com/erdem/django-map-widgets/assets/1518272/491f2091-5620-4a50-9ed8-d63ddba3a88b)\n\n##### GoogleMap Interactive Point Field Widget\n\n![](https://github.com/erdem/django-map-widgets/assets/1518272/4da33221-20f6-4c44-875c-f1d4b0f98e5a)\n\n##### Leaflet Interactive Point Field Widget\n\n![](https://github.com/erdem/django-map-widgets/assets/1518272/a45158f7-2ec0-4e1a-8dfa-8da0442b832f)\n\nand more...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdem%2Fdjango-map-widgets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferdem%2Fdjango-map-widgets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdem%2Fdjango-map-widgets/lists"}