简体   繁体   English

GEOSGeometry 到底是什么

[英]What does GEOSGeometry exactly

Sorry it may be absurde but I got confused.对不起,这可能很荒谬,但我感到困惑。 I have seen two ways of creating a Polygon.我见过两种创建多边形的方法。

from django.contrib.gis.geos import GEOSGeometry, LineString, Polygon
1- geometry = GEOSGeometry(Polygon(coordinates, srid=4326))
2- geometry = Polygon(coordinates, srid=4326)

Why is it important to add GEOSGeometry instead of just using the 2) ?为什么添加 GEOSGeometry 而不是仅使用 2) 很重要?

It seems, that GEOSGeometry() can format text and JSON (etc. compatible formats) in to spesific objects, like Point(), or Polygon().似乎 GEOSGeometry() 可以将文本和 JSON(等兼容格式)格式化为特定对象,如 Point() 或 Polygon()。

So you don't need to use GEOSGeometry(), if you can do without.所以你不需要使用 GEOSGeometry(),如果你可以不用的话。 These two definitions are equal (as far I understand).这两个定义是相等的(据我所知)。 source 来源

from django.contrib.gis.geos import GEOSGeometry, Point
pnt = Point(954158.1, 4215137.1, srid=32140)
pnt = GEOSGeometry('SRID=32140;POINT(954158.1 4215137.1)')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM