Пример #1
0
 def to_geojson(self, geom_type="point", with_attrs=False, dumps=True):
     attrs = False
     if with_attrs:
         attrs = self._get_attrs_to_geojson()
     xy = []
     if self.center_only:
         xy = self.get_center_xy()
         geom_type = "point"
     else: 
         xy = self.xy
     if xy and len(xy):
         feature_collection = coords2geojson(xy, geom_type, self.coord_out, attrs=attrs)
         if feature_collection:
             if dumps:
                 return json.dumps(feature_collection)
             return feature_collection
     return False
Пример #2
0
 def to_geojson(self, geom_type="point", with_attrs=False, dumps=True):
     attrs = False
     if with_attrs:
         attrs = self._get_attrs_to_geojson()
     xy = []
     if self.center_only:
         xy = self.get_center_xy()
         geom_type = "point"
     else: 
         xy = self.xy
     if xy and len(xy):
         feature_collection = coords2geojson(xy, geom_type, self.coord_out, attrs=attrs)
         if feature_collection:
             if dumps:
                 return json.dumps(feature_collection)
             return feature_collection
     return False