I'm going to make a system that posts in order of distance from one standard, so which format should I take, decimal or float, when storing coordinates?

Asked 2 years ago, Updated 2 years ago, 52 views

http://stackoverflow.com/questions/30706799/which-model-field-to-use-in-django-to-store-longitude-and-latitude-values

I am not good at English, so I roughly interpreted the above article

I think there are two choices, decimal field and float field.

The function I'm going to use isn't very accurate, but it doesn't matter if it's 100 meters

It's a function of finding coordinates close to the surrounding area (somewhere it's called knn).

If the accuracy is not required

Should I use the decimal field?

I'm a beginner, so I don't understand the decimal field.

Does it mean that the decimal place can be determined by using the decimal field? So can we calculate less accurately than when we use float fields?

If so, is it possible to make the server less burdened when searching for coordinates close to Kn depending on the decimal point?

I'm using the janggu.

Oh, finally, if I were to write a long story, would using geodjango help me build the service I want to implement?

Thank you for reading.

django geodjango knn

2022-09-22 21:17

1 Answers

Both float field and decimal field will have nothing to do with the burden on the server.

Decimal Field has functions such as specifying the number of digits that can be expressed (max_digits) and decimal_places, and checking whether the number is correct when using the form.

I think float field would be better for your purpose.

I haven't tried Geodjango, but looking at the document, I'd like to use distance_lt among distance lookups.

검색해야 하는 지점들이 있고, 특정 좌표로 부터 일정거리의 지점들을 검색하는걸 직접 구현하는게 목적이라면 Geojango가 적합한것 같습니다.

However, in order to use the distance lookup function, you need to install PostGIS and SpatiaLite while using Sqlite or Postgresql as DB. If you go into the distance lookup document, it says like this.

Availability: PostGIS, Oracle, SpatiaLite, PGRaster (Native)


2022-09-22 21:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.