1 2 3 4 5 6 7 8 | from django.contrib.gis import admin
from django.contrib.gis.maps.google import GoogleMap
GMAP = GoogleMap(key='abcdefg') # Can also set GOOGLE_MAPS_API_KEY in settings
class GoogleAdmin(admin.OSMGeoAdmin):
extra_js = [GMAP.api_url + GMAP.key]
map_template = 'gis/admin/google.html'
|
More like this
- google.js template for GoogleAdmin by jbronn 4 years, 7 months ago
- google.html template for GoogleAdmin by jbronn 4 years, 7 months ago
- MaxMind(R) GeoIP Lite geolocation models by jbronn 5 years, 10 months ago
- Map GPX files to 3D GeoDjango Models by jbronn 3 years, 6 months ago
- Google v3 geocoding for Geodjango admin site by samhag 6 months, 2 weeks ago
Comments
This works but unfortunately when I save I get a validation error "An error occurred when transforming the geometry to the SRID of the geometry form field".
In my case the Model contains a Point.
Any tips would be appreciated.
#
I had the same issue because I was missing PROJ.4 library: http://paste.ubuntu.com/440292/
#
Can anyone help where to put this code (is it models.py)???
from django.contrib.gis import admin from django.contrib.gis.maps.google import GoogleMap
GMAP = GoogleMap(key='abcdefg') # Can also set GOOGLE_MAPS_API_KEY in settings
class GoogleAdmin(admin.OSMGeoAdmin): extra_js = [GMAP.api_url + GMAP.key] map_template = 'gis/admin/google.html'
#
Can anyone provide a more detailed description on how to enable Google Maps in admin site, I'm knew to Django
#