plot-finder 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ernest Ilchenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: plot-finder
3
+ Version: 0.1.0
4
+ Summary: Query Polish ULDK (GUGiK) API to find land parcels by TERYT ID or coordinates
5
+ Author: Ernest Ilchenko
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ernestilchenko/plot-finder
8
+ Keywords: uldk,gugik,parcel,plot,geodesy,poland,teryt
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: pydantic>=2.0
15
+ Requires-Dist: httpx>=0.24
16
+ Requires-Dist: shapely>=2.0
17
+ Requires-Dist: pyproj>=3.6
18
+ Requires-Dist: astral>=3.2
19
+ Provides-Extra: viz
20
+ Requires-Dist: folium>=0.14; extra == "viz"
21
+ Requires-Dist: Pillow>=9.0; extra == "viz"
22
+ Provides-Extra: ai
23
+ Requires-Dist: openai>=1.0; extra == "ai"
24
+ Dynamic: license-file
25
+
26
+ # plot-finder
27
+
28
+ ![Python](https://img.shields.io/badge/Python-3.10+-3776AB?logo=python&logoColor=white)
29
+ ![License](https://img.shields.io/badge/License-MIT-green)
30
+ ![Pydantic](https://img.shields.io/badge/Pydantic-v2-E92063?logo=pydantic&logoColor=white)
31
+ ![OpenStreetMap](https://img.shields.io/badge/OpenStreetMap-7EBC6F?logo=openstreetmap&logoColor=white)
32
+ ![OSRM](https://img.shields.io/badge/OSRM-Routing-blue)
33
+ ![OpenWeather](https://img.shields.io/badge/OpenWeather-API-orange?logo=openweathermap&logoColor=white)
34
+ ![Open-Meteo](https://img.shields.io/badge/Open--Meteo-Climate-1a73e8)
35
+
36
+ > Python library to find Polish land parcels and analyze their surroundings.
37
+
38
+ Query the [ULDK (GUGiK)](https://uldk.gugik.gov.pl/) API to get parcel data by TERYT ID or coordinates, then analyze nearby infrastructure using OpenStreetMap.
39
+
40
+ ![Plot with geometry, radius and nearby places](assets/showcase.png)
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install plot-finder # base
46
+ pip install plot-finder[viz] # + interactive maps & PNG export
47
+ pip install plot-finder[ai] # + AI-powered analysis (OpenAI)
48
+ ```
49
+
50
+ **Requirements:** Python 3.10+ | `pydantic` `httpx` `shapely` `pyproj`
51
+
52
+ ## Quick Start
53
+
54
+ ```python
55
+ from plot_finder import Plot, PlotAnalyzer, PlotReporter
56
+
57
+ # Find a parcel
58
+ plot = Plot(plot_id="141201_1.0001.6509")
59
+ print(plot.voivodeship) # mazowieckie
60
+ print(plot.centroid) # (x, y)
61
+
62
+ # Analyze surroundings
63
+ analyzer = PlotAnalyzer(plot, radius=3000)
64
+
65
+ for place in analyzer.education():
66
+ print(f"{place.name} — {place.distance_m}m, walk {place.walk_min}min")
67
+
68
+ # Full report
69
+ report = PlotReporter(analyzer).report()
70
+ report.model_dump_json()
71
+
72
+ # Visualization (pip install plot-finder[viz])
73
+ from plot_finder.visualizer import PlotVisualizer
74
+ viz = PlotVisualizer(report)
75
+ viz.save("map.html") # interactive map
76
+ viz.save("map.png") # static image
77
+ ```
78
+
79
+ ## Documentation
80
+
81
+ | Page | Description |
82
+ |------|-------------|
83
+ | [Plot](docs/plot.md) | Finding parcels by TERYT ID or coordinates |
84
+ | [PlotAnalyzer](docs/analyzer.md) | Analyzing surroundings (education, shops, transport, etc.) |
85
+ | [Climate](docs/climate.md) | Temperature, precipitation, wind, frost/hot days (Open-Meteo) |
86
+ | [Air Quality](docs/air.md) | Air pollution data (OpenWeatherMap API) |
87
+ | [Sunlight](docs/sun.md) | Sunrise, sunset, daylight hours |
88
+ | [Place](docs/place.md) | Result model with travel times |
89
+ | [Report](docs/report.md) | Full structured report (PlotReporter) |
90
+ | [Visualizer](docs/visualizer.md) | Interactive HTML maps & static PNG images |
91
+ | [AI](docs/ai.md) | AI-powered plot analysis (OpenAI) |
92
+ | [API Reference](docs/api.md) | Full API reference |
93
+ | [Errors](docs/errors.md) | Exception handling and hierarchy |
94
+
95
+ ## License
96
+
97
+ MIT — use it however you want.
@@ -0,0 +1,72 @@
1
+ # plot-finder
2
+
3
+ ![Python](https://img.shields.io/badge/Python-3.10+-3776AB?logo=python&logoColor=white)
4
+ ![License](https://img.shields.io/badge/License-MIT-green)
5
+ ![Pydantic](https://img.shields.io/badge/Pydantic-v2-E92063?logo=pydantic&logoColor=white)
6
+ ![OpenStreetMap](https://img.shields.io/badge/OpenStreetMap-7EBC6F?logo=openstreetmap&logoColor=white)
7
+ ![OSRM](https://img.shields.io/badge/OSRM-Routing-blue)
8
+ ![OpenWeather](https://img.shields.io/badge/OpenWeather-API-orange?logo=openweathermap&logoColor=white)
9
+ ![Open-Meteo](https://img.shields.io/badge/Open--Meteo-Climate-1a73e8)
10
+
11
+ > Python library to find Polish land parcels and analyze their surroundings.
12
+
13
+ Query the [ULDK (GUGiK)](https://uldk.gugik.gov.pl/) API to get parcel data by TERYT ID or coordinates, then analyze nearby infrastructure using OpenStreetMap.
14
+
15
+ ![Plot with geometry, radius and nearby places](assets/showcase.png)
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install plot-finder # base
21
+ pip install plot-finder[viz] # + interactive maps & PNG export
22
+ pip install plot-finder[ai] # + AI-powered analysis (OpenAI)
23
+ ```
24
+
25
+ **Requirements:** Python 3.10+ | `pydantic` `httpx` `shapely` `pyproj`
26
+
27
+ ## Quick Start
28
+
29
+ ```python
30
+ from plot_finder import Plot, PlotAnalyzer, PlotReporter
31
+
32
+ # Find a parcel
33
+ plot = Plot(plot_id="141201_1.0001.6509")
34
+ print(plot.voivodeship) # mazowieckie
35
+ print(plot.centroid) # (x, y)
36
+
37
+ # Analyze surroundings
38
+ analyzer = PlotAnalyzer(plot, radius=3000)
39
+
40
+ for place in analyzer.education():
41
+ print(f"{place.name} — {place.distance_m}m, walk {place.walk_min}min")
42
+
43
+ # Full report
44
+ report = PlotReporter(analyzer).report()
45
+ report.model_dump_json()
46
+
47
+ # Visualization (pip install plot-finder[viz])
48
+ from plot_finder.visualizer import PlotVisualizer
49
+ viz = PlotVisualizer(report)
50
+ viz.save("map.html") # interactive map
51
+ viz.save("map.png") # static image
52
+ ```
53
+
54
+ ## Documentation
55
+
56
+ | Page | Description |
57
+ |------|-------------|
58
+ | [Plot](docs/plot.md) | Finding parcels by TERYT ID or coordinates |
59
+ | [PlotAnalyzer](docs/analyzer.md) | Analyzing surroundings (education, shops, transport, etc.) |
60
+ | [Climate](docs/climate.md) | Temperature, precipitation, wind, frost/hot days (Open-Meteo) |
61
+ | [Air Quality](docs/air.md) | Air pollution data (OpenWeatherMap API) |
62
+ | [Sunlight](docs/sun.md) | Sunrise, sunset, daylight hours |
63
+ | [Place](docs/place.md) | Result model with travel times |
64
+ | [Report](docs/report.md) | Full structured report (PlotReporter) |
65
+ | [Visualizer](docs/visualizer.md) | Interactive HTML maps & static PNG images |
66
+ | [AI](docs/ai.md) | AI-powered plot analysis (OpenAI) |
67
+ | [API Reference](docs/api.md) | Full API reference |
68
+ | [Errors](docs/errors.md) | Exception handling and hierarchy |
69
+
70
+ ## License
71
+
72
+ MIT — use it however you want.
@@ -0,0 +1,42 @@
1
+ from plot_finder.air import AirQuality
2
+ from plot_finder.analyzer import PlotAnalyzer
3
+ from plot_finder.climate import Climate
4
+ from plot_finder.place import Place
5
+ from plot_finder.report import PlotReport, PlotReporter
6
+ from plot_finder.sun import SunInfo
7
+ from plot_finder.exceptions import (
8
+ NothingFoundError,
9
+ OpenMeteoError,
10
+ OSRMError,
11
+ OSRMTimeoutError,
12
+ OpenWeatherAuthError,
13
+ OpenWeatherError,
14
+ OverpassError,
15
+ OverpassRateLimitError,
16
+ OverpassTimeoutError,
17
+ PlotNotFoundError,
18
+ ULDKError,
19
+ )
20
+ from plot_finder.plot import Plot
21
+
22
+ __all__ = [
23
+ "AirQuality",
24
+ "Climate",
25
+ "SunInfo",
26
+ "NothingFoundError",
27
+ "OpenMeteoError",
28
+ "OpenWeatherAuthError",
29
+ "OpenWeatherError",
30
+ "Place",
31
+ "Plot",
32
+ "PlotAnalyzer",
33
+ "PlotReport",
34
+ "PlotReporter",
35
+ "OSRMError",
36
+ "OSRMTimeoutError",
37
+ "OverpassError",
38
+ "OverpassRateLimitError",
39
+ "OverpassTimeoutError",
40
+ "PlotNotFoundError",
41
+ "ULDKError",
42
+ ]
@@ -0,0 +1,94 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ try:
6
+ import openai
7
+ except ImportError:
8
+ openai = None # type: ignore[assignment]
9
+
10
+ if TYPE_CHECKING:
11
+ from plot_finder.report import PlotReport
12
+
13
+
14
+ class PlotAI:
15
+ """AI-powered plot analysis using OpenAI.
16
+
17
+ Parameters
18
+ ----------
19
+ report : PlotReport
20
+ The report to analyze.
21
+ api_key : str
22
+ OpenAI API key.
23
+ model : str
24
+ OpenAI model to use.
25
+ """
26
+
27
+ def __init__(
28
+ self,
29
+ report: PlotReport,
30
+ *,
31
+ api_key: str,
32
+ model: str = "gpt-4o-mini",
33
+ ) -> None:
34
+ if openai is None:
35
+ raise ImportError(
36
+ "openai is required for AI analysis. "
37
+ "Install it with: pip install plot-finder[ai]"
38
+ )
39
+ self._context = report.model_dump_json()
40
+ self._api_key = api_key
41
+ self._model = model
42
+
43
+ def _chat(self, system: str, user: str) -> str:
44
+ client = openai.OpenAI(api_key=self._api_key)
45
+ response = client.chat.completions.create(
46
+ model=self._model,
47
+ messages=[
48
+ {"role": "system", "content": system},
49
+ {"role": "user", "content": user},
50
+ ],
51
+ )
52
+ return response.choices[0].message.content
53
+
54
+ def summary(self) -> str:
55
+ """Natural language summary of the plot and surroundings."""
56
+ return self._chat(
57
+ "You are a real-estate analyst. Summarize the plot data below in "
58
+ "clear, concise natural language. Mention location, nearby "
59
+ "infrastructure, transport, nature, air quality, and sunlight.",
60
+ self._context,
61
+ )
62
+
63
+ def rate(self, purpose: str = "living") -> str:
64
+ """Rate the plot 1-10 for a given purpose with explanation."""
65
+ return self._chat(
66
+ "You are a real-estate analyst. Rate the plot 1-10 for the "
67
+ f"purpose of **{purpose}**. Provide the rating and a short "
68
+ "explanation covering pros and cons.",
69
+ self._context,
70
+ )
71
+
72
+ def advantages(self) -> str:
73
+ """Key advantages of this location."""
74
+ return self._chat(
75
+ "You are a real-estate analyst. List the key advantages of "
76
+ "this location based on the data. Be specific and concise.",
77
+ self._context,
78
+ )
79
+
80
+ def disadvantages(self) -> str:
81
+ """Key disadvantages and risks of this location."""
82
+ return self._chat(
83
+ "You are a real-estate analyst. List the key disadvantages and "
84
+ "risks of this location based on the data. Be specific and concise.",
85
+ self._context,
86
+ )
87
+
88
+ def ask(self, question: str) -> str:
89
+ """Freeform Q&A about the plot."""
90
+ return self._chat(
91
+ "You are a real-estate analyst. Answer the user's question "
92
+ "about the plot based on the data below.\n\n" + self._context,
93
+ question,
94
+ )
@@ -0,0 +1,14 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class AirQuality(BaseModel):
5
+ aqi: int
6
+ aqi_label: str
7
+ co: float
8
+ no: float
9
+ no2: float
10
+ o3: float
11
+ so2: float
12
+ pm2_5: float
13
+ pm10: float
14
+ nh3: float