# Converting latitude and longitude to point in geodjango?

I am doing the geodjango tutorial and I went on google and chose a random longitude and latitude in Kansas, I am using srid=4326 for my polygons

So I got this random lat and long on google maps in Kansas USA

``````lat, long = 38.670049, -99.565798
``````

Now I am trying to see where in the world it is

``````>>> from django.contrib.gis.geos import Point
>>> pnt = Point(38.670049, -99.565798)
>>> WorldBorder.objects.get(mpoly__intersects=pnt)
...
...
world.models.DoesNotExist: WorldBorder matching query does not exist.
``````

Using the tutorial point I get

``````>>> pnt = Point(-95.3385, 29.7245)
>>> WorldBorder.objects.get(mpoly__intersects=pnt)
<WorldBorder: United States>
``````

So my database is imported and working.

So clearly Points are not the same as latitude and longitude, how do I convert between the two

It seems google maps has the lat/long the other way around, see coordinates in image below at the bottom from google maps:

``````# Try enter the coords in the same order as in image above
# Get wrong intersection
>>> from django.contrib.gis.geos import Point
>>> from world.models import WorldBorder
>>> pnt = Point(38.907636 , -77.036905)
>>> WorldBorder.objects.get(mpoly__intersects=pnt)
<WorldBorder: Antarctica>

# Swap them around, and it works
>>> pnt = Point(-77.036905, 38.907636)
>>> WorldBorder.objects.get(mpoly__intersects=pnt)
<WorldBorder: United States>
``````

Can anyone explain what is going on exactly. For a Point(x,y) which is the longitude and which is the latitude, is it

`Point(x,y)`

`x=longitude`

`y=latitude`

And in which order does Google maps present them in the picture above

I am not a GIS specialist or even novice.

• Not many features will contain a point at 99 degrees south. It helps if you always think in terms of X,Y order, and even write it "longitude and latitude". – Vince May 15 '16 at 19:56
• but i'm doing an intersection, surely any point within the USA will intersect with the USA polygon. so are points longitude and latitude? or are they some abitrary x,y coordinate system in geodjango – Dr Manhattan May 16 '16 at 6:16
• What Vince is saying is that -99 latitude does not exist. The South Pole is -90. You have reversed the coordinates in your two examples. – John Powell May 16 '16 at 9:10
• Please see updated question – Dr Manhattan May 16 '16 at 14:57

``````> >>> from django.contrib.gis.geos import Point