문제

나는 그것을 사용하고있다 UTM Geodjango와의 좌표 시스템. 그리고 데이터를 올바르게 얻는 방법을 알 수 없습니다.

나는 문서를 탐색하고 있는데 "Geosgeometry (geo_input, srid = none)" 또는 "grgeometry"EWKT와 함께 사용할 수는 있지만 데이터를 형식화하는 방법을 알 수는 없습니다.

UTM처럼 보입니다 SRID IS : 2029

로부터 위키 백과 기사 형식은 다음과 같이 작성됩니다.

[Utmzone][n 또는 s] [동항] [북거]

17n 630084 4833438

그래서 나는 운이없이 다음을 시도했습니다.

>>> from django.contrib.gis.geos import *
>>> pnt = GEOSGeometry('SRID=2029;POINT(17N 630084 4833438)')
GEOS_ERROR: ParseException: Expected number but encountered word: '17N'
>>>
>>> from django.contrib.gis.gdal import OGRGeometry
>>> pnt = OGRGeometry('SRID=2029;POINT(17N 630084 4833438)')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python26\lib\site-packages\django\contrib\gis\gdal\geometries.py", line 106, in __init__
    ogr_t = OGRGeomType(geom_input)
  File "C:\Python26\lib\site-packages\django\contrib\gis\gdal\geomtype.py", line 31, in __init__
    raise OGRException('Invalid OGR String Type "%s"' % type_input)
django.contrib.gis.gdal.error.OGRException: Invalid OGR String Type "srid=2029;point(17n 630084 4833438)"

이 작업이 어떻게 수행되는지 보여줄 수있는 예가 있습니까?

UTM에서 필요한 합매를 수행하고 소수도로 전환해야할까요?
이 경우 Geodjango의 GEOS 또는 기타 도구가 전환 유용한 제품을 제공합니까?

도움이 되었습니까?

해결책

UTM 영역 (17n)은 이미 공간 기준 시스템에 의해 지정되어 있습니다. SRID 2029, 당신은 당신이 당신이 통과하는 wkt에 그것을 포함시킬 필요가 없습니다. GEOSGeometry 건설자.

>>> from django.contrib.gis.geos import *
>>> pnt = GEOSGeometry('SRID=2029;POINT(630084 4833438)')
>>> (pnt.x, pnt.y)
(630084.0, 4833438.0)
>>> pnt.srid
2029

그런 다음 예를 들면 다음과 같습니다.

>>> pnt.transform(4326)   # Transform to WGS84
>>> (pnt.x, pnt.y)
(-79.387137066054038, 43.644504290860461)
>>> pnt.srid
4326
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top