Roge
Roge

Reputation: 3512

What model field type should I be using to store a number of type long?

I'm wanting to store longitude and latitude values using Django's ORM, I've tried using a BigInt type but its cutting off a lot of the decimal places. Should I be using the Decimal type here ?

Upvotes: 1

Views: 68

Answers (2)

Lachezar
Lachezar

Reputation: 6703

Actually GeoDjango docs says PointField. I worked on a project involving geospatial computations and I was using PointField in the models.

FloatField probably uses floating point representation of the coordinates, which might introduce floating point errors. PointField is initialized with string representation of the lat/long values.

Upvotes: 1

Thomas Schwärzl
Thomas Schwärzl

Reputation: 9917

Looking at the GeoDjango-Docs you should use a FloatField. => Link

Upvotes: 1

Related Questions