Code

Opened 5 years ago

Closed 5 years ago

#11094 closed (invalid)

OSMGeoAdmin not accepting default_lon and default_lat

Reported by: stuartk Owned by: stuartk
Component: GIS Version: master
Severity: Keywords: OSMGeoAdmin, gis
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When using the default_lon and default_lat options with OSMGeoAdmin, no changes are made to the presented map. The options work when using GeoModelAdmin.

Using the examples given on the Open Street Map wiki for using OpenLayers, I have created a small patch to the openlayers.js file. I have tested it, and it doesn't effect the use of GeoModelAdmin.

Attachments (1)

openlayers.diff (771 bytes) - added by stuartk 5 years ago.
Open Layers javascript file patch

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by stuartk

Open Layers javascript file patch

comment:1 Changed 5 years ago by stuartk

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to stuartk
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 5 years ago by stuartk

When using the default_lon and default_lat options with OSMGeoAdmin, no changes are made to the presented map. The options work when using GeoModelAdmin.

Using the examples given on the Open Street Map wiki for using OpenLayers, I have created a small patch to the openlayers.js file. I have tested it, and it doesn't effect the use of GeoModelAdmin.

comment:3 Changed 5 years ago by stuartk

  • Version changed from 1.1-beta-1 to SVN

comment:4 Changed 5 years ago by jbronn

  • Resolution set to invalid
  • Status changed from assigned to closed

The default_lon and default_lat are not working for you because OSMGeoAdmin uses a different projection system than GeoModelAdmin. Specifically, OSMGeoAdmin uses the so-called "Google" projection (SRID=900913) and GeoModelAdmin uses WGS84 (SRID=4326). As such, just transform your default_lon and default_lat values to 900913:

>>> from django.contrib.gis.geos import Point
>>> pnt = Point(lon, lat, srid=4326)
>>> pnt.transform(900913)
>>> default_lon, default_lat = pnt.coords

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.