stevenpawley / Pyspatialml

Machine learning modelling for spatial data
GNU General Public License v3.0
145 stars 29 forks source link

Export Output Map(result_probs) as '.tiff' file #19

Closed tekeali closed 4 years ago

tekeali commented 4 years ago

Firstly, thank you for this code. I am trying to reclassify and evaluate the output map in GIS environment. How can I export this output map as '.tiff' file to my directory?

stevenpawley commented 4 years ago

Hi, sorry I'm not totally sure of what you mean. If you have made a classification map using pyspatialml, then you can simply use the estimator.predict method with a filename that ends with '.tif' and then open this within a GIS?

tekeali commented 4 years ago

Actually, my essential purpose is to produce susceptibility map. Firstly, I need to probability values of each pixels in the raster dataset. Then, I want to assign these probability values to raster pixels they belong to. Finally, I want to export this raster as tiff file to my directory and do some analysis in GIS environment .

bluetyson commented 4 years ago

Like this :- result_map = stack.predict(estimator=yourclassifiermodel, dtype='float32', nodata=-9999, file_path = r'C:\users\tekeali\DataOutputs\Susceptibility_Map.tif')

stevenpawley commented 4 years ago

Or for a susceptibility map, i.e. the probability of assignment to a particular class (e.g. to a binary target), you will want:

result = stack.predict_proba(estimator=your_fitted_model, dtype="float32", nodata=-99999, file_path="your_output_file.tif")