This is a beginner question about working with different coordinate systems in GeoDjango.
I've got a GeoDjango object with a polygon field, stored as OSGB coordinates:
class Region(models.Model):
name = models.CharField(max_length=30)
geom = models.PolygonField(srid=27700)
objects = models.GeoManager()
I'd like to be able to query it using standard WGS84 coordinates:
def api(request):
lat = float(request.GET.get('lat'))
lng = float(request.GET.get('lng'))
pnt = Point(lat, lng, srid=4326)
a = SettlementLocalRegions.objects.get(geom__contains=pnt)
But this gives me no results, even though I know at least one object should contain the point.
I figure I'm doing something wrong with my coordinate systems. Do I need to convert pnt
to OSGB somehow? I thought the point of GeoDjango was that you could mix and match coordinate systems and it coped.