Generators Module¶
gigaspatial.generators
¶
poi
¶
base
¶
PoiViewGenerator
¶
Bases: ABC
Base class for generating views from Points of Interest (POI) datasets.
This class provides the structure for processing downloaded data sources and mapping them to POI data. Concrete implementations should extend this class for specific data sources.
Source code in gigaspatial/generators/poi/base.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
__init__(data_config=None, generator_config=None, data_store=None)
¶
Initialize the POI View Generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
generator_config | Optional[PoiViewGeneratorConfig] | Configuration for the view generator | None |
data_store | Optional[DataStore] | Data store for reading/writing data | None |
Source code in gigaspatial/generators/poi/base.py
generate_poi_view(poi_data, source_data_path=None, custom_pipeline=False, **kwargs)
¶
Generate a POI view by running the complete pipeline.
This method has been updated to make source_data_path optional. If not provided, it will use resolve_source_paths() to determine paths.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
poi_data | Union[DataFrame, GeoDataFrame] | POI data to map to | required |
source_data_path | Optional[Union[Path, str, List[Union[str, Path]]]] | Optional explicit path(s) to the source data | None |
**kwargs | Additional parameters for the pipeline | {} |
Returns:
Type | Description |
---|---|
Union[DataFrame, GeoDataFrame] | DataFrame with the generated POI view |
Source code in gigaspatial/generators/poi/base.py
load_data(source_data_path, **kwargs)
abstractmethod
¶
Load source data for POI processing. This method handles diverse source data formats.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_data_path | List[Union[str, Path]] | List of source paths | required |
**kwargs | Additional parameters for data loading | {} |
Returns:
Type | Description |
---|---|
Any | Data in its source format (DataFrame, GeoDataFrame, TifProcessor, etc.) |
Source code in gigaspatial/generators/poi/base.py
map_to_poi(processed_data, poi_data, **kwargs)
abstractmethod
¶
Map processed data to POI data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
processed_data | Any | Processed source data as a GeoDataFrame | required |
poi_data | Union[DataFrame, GeoDataFrame] | POI data to map to | required |
**kwargs | Additional mapping parameters | {} |
Returns:
Type | Description |
---|---|
Union[DataFrame, GeoDataFrame] | (Geo)DataFrame with POI data mapped to source data |
Source code in gigaspatial/generators/poi/base.py
process_data(data, **kwargs)
¶
Process the source data to prepare it for POI view generation.
resolve_source_paths(poi_data, explicit_paths=None, **kwargs)
¶
Resolve source data paths based on POI data or explicit paths.
This method allows generators to dynamically determine source paths based on the POI data (e.g., by geographic intersection).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
poi_data | Union[DataFrame, GeoDataFrame] | POI data that may be used to determine relevant source paths | required |
explicit_paths | Optional[Union[Path, str, List[Union[str, Path]]]] | Explicitly provided source paths, if any | None |
**kwargs | Additional parameters for path resolution | {} |
Returns:
Type | Description |
---|---|
List[Union[str, Path]] | List of resolved source paths |
Notes
Default implementation returns explicit_paths if provided. Subclasses should override this to implement dynamic path resolution.
Source code in gigaspatial/generators/poi/base.py
save_poi_view(poi_view, output_path, **kwargs)
¶
Save the generated POI view to the data store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
poi_view | Union[DataFrame, GeoDataFrame] | The POI view DataFrame to save | required |
output_path | Union[Path, str] | Path where the POI view will be saved in DataStore | required |
**kwargs | Additional parameters for saving | {} |
Source code in gigaspatial/generators/poi/base.py
PoiViewGeneratorConfig
¶
ghsl_built_s
¶
GhslBuiltSurfacePoiViewGenerator
¶
Bases: PoiViewGenerator
Generate POI views from GHSL Built Surface.
Source code in gigaspatial/generators/poi/ghsl_built_s.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
generate_view(poi_data, source_data_path=None, map_radius_meters=150, **kwargs)
¶
Generate POI view from GHSL Built Surface.
Returns:
Type | Description |
---|---|
DataFrame | Enhanced POI data with Built Surface information |
Source code in gigaspatial/generators/poi/ghsl_built_s.py
load_data(source_data_path, **kwargs)
¶
Load GHSL Built Surface rasters into TifProcessors from paths.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_data_path | Union[Path, List[Path]] | Path(s) to the source data | required |
**kwargs | Additional loading parameters | {} |
Returns:
Type | Description |
---|---|
List[TifProcessor] | List of TifProcessors with built surface data |
Source code in gigaspatial/generators/poi/ghsl_built_s.py
map_to_poi(processed_data, poi_data, map_radius_meters, **kwargs)
¶
Map from TifProcessors to POI data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
processed_data | List[TifProcessor] | TifProcessors | required |
poi_data | Union[DataFrame, GeoDataFrame] | POI data to map to | required |
**kwargs | Additional mapping parameters | {} |
Returns:
Type | Description |
---|---|
DataFrame | DataFrame with POI data and built surface information |
Source code in gigaspatial/generators/poi/ghsl_built_s.py
resolve_source_paths(poi_data, explicit_paths=None, **kwargs)
¶
For GHSL Built Surface rasters, resolve source data paths based on POI data geography.
Returns:
Type | Description |
---|---|
List[Union[str, Path]] | List of paths to relevant GHSL BUILT S tile rasters |
Source code in gigaspatial/generators/poi/ghsl_built_s.py
ghsl_smod
¶
GhslSmodPoiViewGenerator
¶
Bases: PoiViewGenerator
Generate POI views from GHSL Settlement Model (SMOD).
Source code in gigaspatial/generators/poi/ghsl_smod.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
generate_view(poi_data, source_data_path=None, **kwargs)
¶
Generate POI view from GHSL Settlement Model.
Returns:
Type | Description |
---|---|
DataFrame | Enhanced POI data with SMOD classification |
Source code in gigaspatial/generators/poi/ghsl_smod.py
load_data(source_data_path, **kwargs)
¶
Load GHSL SMOD rasters into TifProcessors from paths.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_data_path | Union[Path, List[Path]] | Path(s) to the source data | required |
**kwargs | Additional loading parameters | {} |
Returns:
Type | Description |
---|---|
List[TifProcessor] | List of TifProcessors with settlement model data |
Source code in gigaspatial/generators/poi/ghsl_smod.py
map_to_poi(processed_data, poi_data, **kwargs)
¶
Map from TifProcessors to POI data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
processed_data | List[TifProcessor] | TifProcessors | required |
poi_data | Union[DataFrame, GeoDataFrame] | POI data to map to | required |
**kwargs | Additional mapping parameters | {} |
Returns:
Type | Description |
---|---|
DataFrame | DataFrame with POI data and SMOD classification information |
Source code in gigaspatial/generators/poi/ghsl_smod.py
resolve_source_paths(poi_data, explicit_paths=None, **kwargs)
¶
For GHSL SMOD rasters, resolve source data paths based on POI data geography.
Returns:
Type | Description |
---|---|
List[Union[str, Path]] | List of paths to relevant GHSL SMOD tile rasters |
Source code in gigaspatial/generators/poi/ghsl_smod.py
google_open_buildings
¶
GoogleBuildingsPoiViewGenerator
¶
Bases: PoiViewGenerator
Generate POI views from Google Open Buildings data.
Source code in gigaspatial/generators/poi/google_open_buildings.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
generate_view(poi_data, source_data_path=None, **kwargs)
¶
Generate POI view for Google Open Buildings.
Returns:
Type | Description |
---|---|
DataFrame | Enhanced POI data with nearest building information |
Source code in gigaspatial/generators/poi/google_open_buildings.py
load_data(source_data_path, **kwargs)
¶
Load building data from paths.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_data_path | Union[Path, List[Path]] | Path(s) to the source data | required |
**kwargs | Additional loading parameters | {} |
Returns:
Type | Description |
---|---|
DataFrame | DataFrame containing building data |
Source code in gigaspatial/generators/poi/google_open_buildings.py
map_to_poi(processed_data, poi_data, **kwargs)
¶
Map processed building data to POI data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
processed_data | DataFrame | Processed building data as GeoDataFrame | required |
poi_data | DataFrame | POI data to map to | required |
**kwargs | Additional mapping parameters | {} |
Returns:
Type | Description |
---|---|
DataFrame | DataFrame with POI data and nearest building information |
Source code in gigaspatial/generators/poi/google_open_buildings.py
resolve_source_paths(poi_data, explicit_paths=None, **kwargs)
¶
For Google Open Buildings, resolve source data paths based on POI data geography. This determines which tile files intersect with the POI data's geographic extent.
Source code in gigaspatial/generators/poi/google_open_buildings.py
microsoft_global_buildings
¶
MSBuildingsPoiViewGenerator
¶
Bases: PoiViewGenerator
Generate POI views from Microsoft Global Buildings data.
Source code in gigaspatial/generators/poi/microsoft_global_buildings.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
generate_view(poi_data, source_data_path=None, **kwargs)
¶
Generate POI view for Microsoft Global Buildings.
Returns:
Type | Description |
---|---|
DataFrame | Enhanced POI data with nearest building information |
Source code in gigaspatial/generators/poi/microsoft_global_buildings.py
load_data(source_data_path, **kwargs)
¶
Load building data from Microsoft Buildings dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_data_path | Union[Path, List[Path]] | Path(s) to the source data files | required |
**kwargs | Additional loading parameters | {} |
Returns:
Type | Description |
---|---|
GeoDataFrame | DataFrame containing building data |
Source code in gigaspatial/generators/poi/microsoft_global_buildings.py
map_to_poi(processed_data, poi_data, **kwargs)
¶
Map processed building data to POI data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
processed_data | DataFrame | Processed building data as GeoDataFrame | required |
poi_data | DataFrame | POI data to map to | required |
**kwargs | Additional mapping parameters | {} |
Returns:
Type | Description |
---|---|
DataFrame | DataFrame with POI data and nearest building information |
Source code in gigaspatial/generators/poi/microsoft_global_buildings.py
resolve_source_paths(poi_data, explicit_paths=None, **kwargs)
¶
For Microsoft Buildings, resolve source data paths based on POI data geography.
Returns:
Type | Description |
---|---|
List[Union[str, Path]] | List of paths to relevant Microsoft Buildings tile files |