django - Converting geometry point to lat/long in Geodjango app -
i'm creating web mapping application using django, geodjango, openlayers , postgis. want zoom on openlayers basemap location of city has been selected combo box , figure can passing lat/long coordinates , zoom level openlayers.
i have view function runs django query filter selected city , calculate centroid returned queryset, shown below.
centroid = lga.objects.get(name=lga).geom.centroid
the way setting map centre statically following code:
var center = new openlayers.lonlat(133.0, -27.0).transform( new openlayers.projection("epsg:4326"), map.getprojectionobject() );
those coordinates centre of australia, want set map centre dynamically selected city using django template variables lat , long. i'm not sure how lat , long centroid calculate in view function, or alternatively, if there way set map centre in openlayers passing geometry rather coordinates.
thanks in advance help.
ro
what geometry point formatting? can provide example? in understanding, geometry point not in projection epsg:4236(which latitude , longitude) other formatting (projection) right? normal way convert projection in openlayers using point.transform method, not calculated in geodjango.
Comments
Post a Comment