Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rosreestr2coord/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def batch_parser(
sleep(need_sleep)
area = Area(code, with_log=with_log, **kwargs)
need_sleep = delay
if len(area.get_coord()):
if area.feature:
print(" - ok", end="")
success += 1
else:
Expand Down
2 changes: 1 addition & 1 deletion rosreestr2coord/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_by_code(code, output, display, **kwargs):


def process_area(area, output_path, display):
geojson = area.to_geojson_poly()
geojson = area.to_geojson()

file_name = code_to_filename(area.file_name)

Expand Down
17 changes: 8 additions & 9 deletions rosreestr2coord/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ def make_output(output, file_name, file_format, out_path=""):

def _write_csv_row(f, area, header=False):
try:
xy = copy.deepcopy(list(area.get_coord()))
for geom in xy:
for poly in geom:
for c in range(len(poly)):
poly[c] = poly[c][::-1]
attrs = getattr(area, "attrs", {})
if not area.feature:
return
geometry = area.feature.get("geometry", {})
xy = copy.deepcopy(geometry.get("coordinates", []))
attrs = area.feature.get("properties", {})
address = attrs.get("address", "")
cols = [
{"name": "code", "value": getattr(area, "code")},
Expand Down Expand Up @@ -64,7 +63,7 @@ def batch_json_output(output, areas, file_name, with_attrs=True, crs_name="EPSG:
}
path = make_output(output, file_name, "geojson")
for a in areas:
feature = a.to_geojson_poly(with_attrs, dumps=False)
feature = a.to_geojson(dumps=False)
if feature:
features.append(feature)

Expand All @@ -74,8 +73,8 @@ def batch_json_output(output, areas, file_name, with_attrs=True, crs_name="EPSG:
return path


def area_json_output(output, area, with_attrs=True):
geojson = area.to_geojson_poly(with_attrs)
def area_json_output(output, area):
geojson = area.to_geojson()
if geojson:
f = open(make_output(output, area.file_name, "geojson"), "w")
f.write(geojson)
Expand Down