### Launch GUI Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Start the graphical user interface after installing PyQT4. ```bash $ python gui.py ``` -------------------------------- ### Install numpy Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Install the numpy library, which is a prerequisite for OpenCV installation. ```bash pip install numpy ``` -------------------------------- ### Install Production Version Source: https://github.com/rendrom/rosreestr2coord/blob/master/README.md Use pip to install the stable version of the package. ```bash pip install rosreestr2coord ``` -------------------------------- ### Install rosreestr2coord from source (requirements.txt) Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Install rosreestr2coord by cloning the repository and installing dependencies from requirements.txt. This method allows running the script directly from its directory. ```bash cd C:\Users\Rendrom\prj\rosreestr2coord\ pip install -r requiremments.txt ``` ```bash python rosreestr2coord.py -h ``` -------------------------------- ### Setup Development Environment Source: https://github.com/rendrom/rosreestr2coord/blob/master/README.md Clone the repository and set up a virtual environment for development. ```bash git clone https://github.com/rendrom/rosreestr2coord cd rosreestr2coord ``` ```bash # создание виртуального окружения python -m venv ./env # активация виртуального окружения для Linux и MacOS . ./env/bin/activate # активация виртуального окружения для Windows . ./env/Scripts/activate # установка пакета в режиме редактируемой установки pip install -e . pip install -e .[dev] ``` -------------------------------- ### Install rosreestr2coord via pip Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Install the rosreestr2coord library using pip for global access. After installation, verify by running the help command. ```bash pip install rosreestr2coord ``` ```bash rosreestr2coord -h ``` -------------------------------- ### Install rosreestr2coord from source (setup.py) Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Perform a global installation of rosreestr2coord using setup.py, making it available as a command-line tool. ```bash python setup.py install ``` -------------------------------- ### Install PyQt4 Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Install the PyQt4 library, required for the graphical user interface, using pip and the provided wheel file. ```bash pip install PyQt4‑4.11.4‑cp27‑cp27m‑win32.whl ``` -------------------------------- ### Check Python Installation Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Verify that Python 2.7.x is installed correctly by checking its version in the console. ```bash python --version ``` -------------------------------- ### Check pip Installation Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Confirm that the pip package manager is installed and accessible from the console. ```bash pip --version ``` -------------------------------- ### Verify OpenCV Installation Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Check if the OpenCV library is installed correctly by importing it and printing its version. ```python python -c "exec('import cv2\nprint cv2.__version__')" ``` -------------------------------- ### CLI Usage Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Executes library functions via the command line interface. Supports single requests, batch processing from files, and proxy configuration. ```bash # Получение координат по кадастровому номеру rosreestr2coord -c 38:06:144003:4723 # Указание типа площади (кадастровое деление) rosreestr2coord -c 38:06:144003 -t 2 # Пакетная обработка из файла со списком rosreestr2coord -l cadastral_list.txt # Указание выходной директории rosreestr2coord -c 38:06:144003:4723 -o ./results # Работа через прокси rosreestr2coord -c 38:06:144003:4723 -P # Использование конкретного прокси rosreestr2coord -c 38:06:144003:4723 -u "http://user:pass@proxy:8080" # Без использования кэша rosreestr2coord -c 38:06:144003:4723 -r # Показать версию rosreestr2coord -v ``` -------------------------------- ### Run GUI script Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Launch the graphical user interface for rosreestr2coord by executing the gui.py script from its directory. ```bash python gui.py ``` -------------------------------- ### Configuring Logging Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Shows how to disable default console logging or attach a custom logger instance to the Area object. ```python from rosreestr2coord import Area import logging # Отключение логирования в консоль area = Area( code="38:06:144003:4723", with_log=False # Не выводить сообщения в консоль ) # Настройка собственного логгера custom_logger = logging.getLogger("my_app") custom_logger.setLevel(logging.DEBUG) area_with_custom_logger = Area( code="38:06:144003:4723", with_log=True, logger=custom_logger ) ``` -------------------------------- ### Run rosreestr2coord script from directory Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Execute the rosreestr2coord script by navigating to its directory. Generated files will be saved in the script's directory. ```bash python rosreestr2coord.py ``` -------------------------------- ### Handling API Exceptions Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Demonstrates how to catch specific library exceptions like timeouts, HTTP errors, and missing coordinate data. ```python from rosreestr2coord import Area from rosreestr2coord.parser import NoCoordinatesException from rosreestr2coord.request.exceptions import TimeoutException, HTTPErrorException try: # Попытка получить данные area = Area("38:06:144003:4723", with_log=False, timeout=10) if area.feature: # Экспорт в KML может выбросить NoCoordinatesException kml = area.to_kml() print("KML успешно создан") else: print("Координаты не найдены") except TimeoutException as e: print(f"Превышено время ожидания: {e}") print("Возможно, ваш IP заблокирован. Попробуйте использовать прокси.") except HTTPErrorException as e: print(f"Ошибка HTTP: {e}") except NoCoordinatesException as e: print(f"Координаты недоступны: {e}") except ValueError as e: print(f"Неверный параметр: {e}") ``` -------------------------------- ### Programmatic access via Python Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Use the Area class to fetch and export coordinates programmatically. ```python from scripts.parser import Area area = Area("38:06:144003:4723") # дополнительные аргументы coord_out="EPSG:4326", area_type=1, media-path=MEDIA, area.to_geojson() area.to_geojson_poly() area.get_coord() # [[[area1_xy], [hole1_xy], [hole2_xy]], [[area2_xyl]]] area.get_attrs() ``` -------------------------------- ### Using Utility Functions Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Provides helper functions for cleaning cadastral codes, generating filenames, and transforming coordinates or GeoJSON data. ```python from rosreestr2coord.utils import ( clear_code, code_to_filename, xy2lonlat, transform_to_wgs ) # Очистка кадастрового номера от ведущих нулей code = clear_code("38:06:0144003:04723") print(code) # "38:6:144003:4723" # Преобразование кадастрового номера в имя файла filename = code_to_filename("38:06:144003:4723") print(filename) # "38_06_144003_4723" # Преобразование координат из Web Mercator в WGS84 lon, lat = xy2lonlat(11649686.0, 6839238.0) print(f"Долгота: {lon}, Широта: {lat}") # Преобразование GeoJSON из EPSG:3857 в EPSG:4326 geojson_3857 = { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [[[11649686.0, 6839238.0], [11649700.0, 6839250.0]]] }, "properties": {} } geojson_4326 = transform_to_wgs(geojson_3857) print(geojson_4326["geometry"]["coordinates"]) ``` -------------------------------- ### Fetch coordinates via CLI Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Execute a single cadastral number lookup from the command line. ```bash $ rosreestr2coord -c 38:06:144003:4723 ``` -------------------------------- ### Run rosreestr2coord from console Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Execute the rosreestr2coord application from the console. Files generated during execution will be saved in the directory from which the command is called. ```bash rosreestr2coord ``` -------------------------------- ### Configure Area with advanced parameters Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Customize the Area object behavior using parameters for caching, timeouts, proxy settings, and logging. ```python from rosreestr2coord import Area # Полная конфигурация Area с указанием всех параметров area = Area( code="38:06:144003:4723", # Кадастровый номер участка area_type=1, # Тип площади (1 - объекты недвижимости) media_path="/tmp/rosreestr", # Путь для временных файлов with_log=True, # Включить логирование в консоль coord_out="EPSG:4326", # Формат вывода координат (WGS84) with_proxy=False, # Использовать пул прокси-серверов use_cache=True, # Использовать кэширование запросов timeout=5, # Таймаут запроса в секундах proxy_url=None # Конкретный URL прокси-сервера ) # Проверка наличия данных if area.feature: print("Данные успешно загружены") print(f"Тип геометрии: {area.feature['geometry']['type']}") else: print("Данные не найдены") ``` -------------------------------- ### Use as Python Library Source: https://github.com/rendrom/rosreestr2coord/blob/master/README.md Import the Area class to programmatically fetch and convert cadastral data to GeoJSON. ```python from rosreestr2coord import Area # Создание объекта Area с кадастровым номером участка area = Area("38:06:144003:4723") # Преобразование данных в формат GeoJSON area.to_geojson() ``` -------------------------------- ### Batch Processing from File Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Handles large lists of cadastral numbers provided in a text file. Can be executed via CLI or programmatically. ```bash # Содержимое файла cadastral_list.txt: # 38:06:144003:4723 # 38:06:144003:4724 # 38:06:144003:4725 # Запуск обработки из консоли rosreestr2coord -l cadastral_list.txt -o ./results -D 2 ``` ```python # Программный запуск обработки файла from rosreestr2coord.console import handle_batch_processing kwargs = { "area_type": 1, "use_cache": True, "with_proxy": False } handle_batch_processing( file_path="cadastral_list.txt", output="./results", delay=1, kwargs=kwargs ) ``` -------------------------------- ### Export Data Utilities Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Provides functions to export results into GeoJSON, KML, and CSV formats. Includes direct conversion from coordinate arrays. ```python from rosreestr2coord import Area from rosreestr2coord.export import ( area_json_output, batch_json_output, batch_csv_output, coords2geojson, coords2kml ) # Сохранение одного участка в GeoJSON area = Area("38:06:144003:4723") geojson = area_json_output("./output", area, with_attrs=True) # Создание GeoJSON из координат напрямую coords = [[[ [104.634, 52.266], [104.635, 52.265], [104.636, 52.266], [104.634, 52.266] ]]] feature_collection = coords2geojson( coords=coords, geom_type="POLYGON", crs_name="EPSG:4326", attrs={"name": "Test area"} ) print(feature_collection) # Создание KML из координат kml_tree = coords2kml(coords, attrs={"label": "Тестовый участок"}) kml_tree.write("custom_output.kml", encoding="UTF-8", xml_declaration=True) ``` -------------------------------- ### Initialize Area and retrieve geometry Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Use the Area class to fetch geometry for a specific cadastral number and export it as a GeoJSON string or dictionary. ```python from rosreestr2coord import Area # Базовое использование: получение координат земельного участка area = Area("38:06:144003:4723") # Получение геометрии в формате GeoJSON (строка) geojson_str = area.to_geojson() print(geojson_str) # Вывод: {"type": "Feature", "geometry": {"type": "Polygon", "coordinates": [[[104.634..., 52.266...], ...]]}, "properties": {...}} # Получение геометрии как словарь Python geojson_dict = area.to_geojson(dumps=False) print(geojson_dict["geometry"]["type"]) # "Polygon" print(geojson_dict["properties"]["label"]) # "38:06:144003:4723" ``` -------------------------------- ### Configure Proxy Servers Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Configures proxy settings to bypass IP restrictions. Supports either a specific proxy URL or an automatic proxy pool. ```python from rosreestr2coord import Area # Использование конкретного прокси-сервера area_with_proxy = Area( code="38:06:144003:4723", proxy_url="http://user:password@proxy.example.com:8080" ) # Использование пула прокси-серверов (автоматическая ротация) area_with_proxy_pool = Area( code="38:06:144003:4723", with_proxy=True # Автоматическая загрузка и ротация прокси ) # Проверка результата if area_with_proxy.feature: print("Данные получены через прокси") ``` -------------------------------- ### Batch process cadastral numbers via CLI Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Process a list of cadastral numbers from a text file. Note that this may trigger IP blocking by Rosreestr. ```bash $ rosreestr2coord -w -l ./cadastral_numbers_list.txt ``` -------------------------------- ### Retrieve Coordinates via CLI Source: https://github.com/rendrom/rosreestr2coord/blob/master/README.md Execute coordinate retrieval directly from the command line using a cadastral number or a list file. ```bash rosreestr2coord -c 38:06:144003:4723 ``` ```bash rosreestr2coord -l ./cadastral_numbers_list.txt ``` -------------------------------- ### Integrating with GIS Tools Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Exports cadastral data to GeoJSON format suitable for import into QGIS or ArcGIS. ```python from rosreestr2coord import Area import json # Получение данных для QGIS/ArcGIS area = Area("38:06:144003:4723") geojson = area.to_geojson(dumps=False) # Сохранение для импорта в QGIS if geojson: with open("cadastral_plot.geojson", "w", encoding="utf-8") as f: json.dump({ "type": "FeatureCollection", "crs": {"type": "name", "properties": {"name": "EPSG:4326"}}, "features": [geojson] }, f, ensure_ascii=False, indent=2) # Интеграция с GeoPandas (требует установки geopandas) # import geopandas as gpd # gdf = gpd.read_file("cadastral_plot.geojson") # print(gdf.head()) # gdf.plot() ``` -------------------------------- ### Clone rosreestr2coord repository Source: https://github.com/rendrom/rosreestr2coord/wiki/Instruction Clone the rosreestr2coord repository using git for development or direct usage. ```bash git clone https://github.com/rendrom/rosreestr2coord.git ``` -------------------------------- ### Batch Processing with batch_parser Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Processes multiple cadastral numbers in a single execution. Generates reports and output files in GeoJSON and CSV formats. ```python from rosreestr2coord.batch import batch_parser # Список кадастровых номеров codes = [ "38:06:144003:4723", "38:06:144003:4724", "38:06:144003:4725" ] # Пакетная обработка с параметрами batch_parser( codes=codes, output="./output", # Директория для результатов file_name="batch_result", # Имя файла для сводных результатов delay=1, # Задержка между запросами (секунды) with_log=False, # Отключить подробное логирование area_type=1, # Тип площади use_cache=True # Использовать кэширование ) # Вывод: # ================================ # Launched parsing of 3 areas: # ================================ # 38:06:144003:4723 - ok, 33% # 38:06:144003:4724 - ok, 66% # 38:06:144003:4725 - ok, 100% # ================= # Parsing complete: # success : 3 # error : 0 # no_coord : 0 ``` -------------------------------- ### Export and manipulate GeoJSON data Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Use the to_geojson method to retrieve data as a string or dictionary, and save it to a file using the standard json library. ```python from rosreestr2coord import Area import json area = Area("38:06:144003:4723") # Получить как JSON-строку (по умолчанию) geojson_string = area.to_geojson() print(type(geojson_string)) # # Получить как словарь Python geojson_dict = area.to_geojson(dumps=False) print(type(geojson_dict)) # # Работа с данными геометрии if geojson_dict: geometry = geojson_dict["geometry"] properties = geojson_dict["properties"] print(f"Тип геометрии: {geometry['type']}") print(f"Кадастровый номер: {properties.get('label')}") # Сохранение в файл with open("output.geojson", "w", encoding="utf-8") as f: json.dump(geojson_dict, f, ensure_ascii=False, indent=2) ``` -------------------------------- ### Handle different cadastral area types Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Specify the area_type parameter to query different types of cadastral objects such as blocks, zones, or administrative divisions. ```python from rosreestr2coord import Area from rosreestr2coord.parser import TYPES # Доступные типы площадей print(TYPES) # { # "Объекты недвижимости": 1, # Земельные участки, здания, сооружения # "Кадастровое деление": 2, # Кадастровые округа, районы, кварталы # "Административно-территориальное деление": 4, # Муниципальные образования # "Зоны и территории": 5, # ЗОУИТ, ООПТ, охотничьи угодья # "Территориальные зоны": 7, # Границы территориальных зон # "Комплексы объектов": 15 # ЕНК, предприятия как имущественные комплексы # } # Получение кадастрового квартала (area_type=2) cadastral_block = Area("38:06:144003", area_type=2) if cadastral_block.feature: geojson = cadastral_block.to_geojson() print(geojson) # Получение объекта недвижимости (area_type=1, по умолчанию) land_plot = Area("38:06:144003:4723", area_type=1) if land_plot.feature: print(f"Координаты: {land_plot.feature['geometry']['coordinates']}") ``` -------------------------------- ### Export Geometry to KML Source: https://context7.com/rendrom/rosreestr2coord/llms.txt Exports area geometry to KML format for use in GIS applications. The method returns an ElementTree object which can be saved to a file or converted to a string. ```python from rosreestr2coord import Area area = Area("38:06:144003:4723") if area.feature: # Получение KML как ElementTree объект kml_tree = area.to_kml() # Сохранение в файл kml_tree.write("output.kml", encoding="UTF-8", xml_declaration=True) print("KML файл сохранён") # Получение строкового представления import xml.etree.ElementTree as ET kml_string = ET.tostring(kml_tree.getroot(), encoding="unicode") print(kml_string[:500]) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.