Giter Site home page Giter Site logo

tgrippa / opensource_obia_processing_chain Goto Github PK

View Code? Open in Web Editor NEW
76.0 15.0 27.0 56 KB

An open-source semi-automated processing chain for urban OBIA classification.

License: MIT License

Jupyter Notebook 100.00%
remote-sensing grass-gis processing-chain classification segmentation automation object-based-image-analysis obia

opensource_obia_processing_chain's Introduction

Hello I'm Taïs Grippa (He/Him) 👋

I'm a geographer specialising in Data Science and Data Engineering. Obviously, my core business is about GEO-data and GEO-spatial analyses :) You can reach me on LinkedIn or my on personnal website: https://tgrippa.github.io/

opensource_obia_processing_chain's People

Contributors

everydayduffy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opensource_obia_processing_chain's Issues

Typo in importing the nDSM

Dear tgrippa
Firstly, great script and thank you for sharing.
I am currently running it and have noticed a small typo in the script.
In the "Import nDSM raster imagery" section, the line:
print_processing_time_a(begintime_ndsm, "nDSM imagery has been imported in ") should be:
print_processing_time(begintime_ndsm, "nDSM imagery has been imported in ")

Just FYI.

Best regards
Mark Falkenberg

iconv.dll was not found - error running grass.core.create_location

Hello,

When I try to run:

grass.core.create_location(user["gisdb"], user["location"], epsg=user["locationepsg"], overwrite=False)

I get an error. As you can see from the attached image, my database folder and location have been created successfully.

error

The traceback reads as follows:

---------------------------------------------------------------------------
CalledModuleError                         Traceback (most recent call last)
<ipython-input-12-7d7a61234f98> in <module>()
----> 1 grass.core.create_location(user["gisdb"], user["location"], epsg=user["locationepsg"], overwrite=False)

C:\OSGeo4W64\apps\grass\grass-7.3.svn\etc\python\grass\script\core.pyc in create_location(dbase, location, epsg, proj4, filename, wkt, datum, datum_trans, desc, overwrite)
   1457     if epsg or proj4 or filename or wkt:
   1458         # FIXME: changing GISDBASE mid-session is not background-job safe
-> 1459         gisdbase = gisenv()['GISDBASE']
   1460         run_command('g.gisenv', set='GISDBASE=%s' % dbase)
   1461     # create dbase if not exists

C:\OSGeo4W64\apps\grass\grass-7.3.svn\etc\python\grass\script\core.pyc in gisenv()
   1008     :return: list of GRASS variables
   1009     """
-> 1010     s = read_command("g.gisenv", flags='n')
   1011     return parse_key_val(s)
   1012 

C:\OSGeo4W64\apps\grass\grass-7.3.svn\etc\python\grass\script\core.pyc in read_command(*args, **kwargs)
    472     if _capture_stderr and returncode:
    473         sys.stderr.write(stderr)
--> 474     return handle_errors(returncode, stdout, args, kwargs)
    475 
    476 

C:\OSGeo4W64\apps\grass\grass-7.3.svn\etc\python\grass\script\core.pyc in handle_errors(returncode, result, args, kwargs)
    328         args = make_command(*args, **kwargs)
    329         raise CalledModuleError(module=None, code=repr(args),
--> 330                                 returncode=returncode)
    331 
    332 def start_command(prog, flags=b"", overwrite=False, quiet=False,

CalledModuleError: Module run None ['g.gisenv', '-n'] ended with error
Process ended with non-zero return code -1073741515. See errors in the (error) output.

Do you know why this might be please?

Error when importing optical raster imagery

Hello,
I am using your code using Windows 10, GRASS 7.8 and Python 37.
I have this error message when I try to import raster data at the beginning of the processing chain.
Here is the complete error message :

**CalledModuleError Traceback (most recent call last)
in ()
8 print("Importing optical raster imagery at " + time.ctime())
9 print("toto2")
---> 10 grass.run_command('r.in.gdal',input=r'D:\Coraline\ARCGIS\PROJETS\ZI_ORTHO_PRE-TRAITEMENTS\ZI_ORTHO_2018_READY.tif', output='optical', overwrite=True)
11 print("toto3")
12 for rast in grass.list_strings("rast"):

C:\OSGeo4W64\apps\grass\grass78\etc\python\grass\script\core.py in run_command(*args, **kwargs)
439 else:
440 returncode = ps.wait()
--> 441 return handle_errors(returncode, returncode, args, kwargs)
442
443

C:\OSGeo4W64\apps\grass\grass78\etc\python\grass\script\core.py in handle_errors(returncode, result, args, kwargs)
341 code = ' '.join(args)
342 raise CalledModuleError(module=None, code=code,
--> 343 returncode=returncode)
344
345 def start_command(prog, flags="", overwrite=False, quiet=False,

CalledModuleError: Module run None r.in.gdal --o input=D:\Coraline\ARCGIS\PROJETS\ZI_ORTHO_PRE-TRAITEMENTS\ZI_ORTHO_2018_READY.tif output=optical ended with error
Process ended with non-zero return code 1. See errors in the (error) output.**

Can you help me ?

i.segment.uspo produces empty output

Hi @tgrippa,
I am trying to use your code for a project of mine. I am working with pleiades imagery for optical and LiDAR for nDSM.
So far the first part runs smoothly but I started encountering problems when running i.segment.uspo. It produces an empty *.csv file, no matter the parameters (thresholds/minsize).
I can see that all datasets and subsets are created within the GRASS Mapset TEST_USPO.

I have a shapefile with one polygon per landcover class which is used as regions in i.segment.uspo.
training_areas
The regions are printed correctly as well:
subset_uspo_1@TEST_USPO,subset_uspo_10@TEST_USPO,subset_uspo_11@TEST_USPO,subset_uspo_12@TEST_USPO,subset_uspo_2@TEST_USPO,subset_uspo_3@TEST_USPO,subset_uspo_4@TEST_USPO,subset_uspo_5@TEST_USPO,subset_uspo_6@TEST_USPO,subset_uspo_7@TEST_USPO,subset_uspo_8@TEST_USPO,subset_uspo_9@TEST_USPO

Am I assuming right, that the single polygons are supposed to define one class each?
Or could something else be an issue here?

Did you encounter issues like this during the development? Any hints on debugging this issue?

Problems with paths

Hello,

Firstly, thank you very much for publishing this toolchain. I think it's a great resource that you've made available. I'm very new to python, and have in the past used OBIA tools in GRASS in bash. However, I thought I would download your notebook and try to configure it for my system. Unfortunately I've fallen at the first hurlde - setting paths!

You state that GRASS should be well installed.... For Windows users, possibly the best way to install is to use OSGEO4W. This means that the paths are quite different to the ones you provide - e.g.

Yours:
os.environ['GISBASE'] = 'C:\\Program Files\\GRASS GIS 7.3.svn'

Mine:
os.environ['GISBASE'] = 'C:\\OSGeo4W64\\apps\\grass\\grass-7.3.svn'

This is quite a simple case that is easy to figure out. Things become a bit more difficult when locating the 'gdal' folder for example:

Yours;

os.environ['GDAL_DATA'] = 'C:\\Program Files\\GRASS GIS 7.3.svn\\share\\gdal'

Mine:

Doesn't exist within the share folder...

Secondly, I installed Python27 with Anaconda as you suggest, and the locations again differ to yours:

Yours:

os.environ['PYTHONLIB'] = 'C:\\Python27'

Mine (I think):

os.environ['PYTHONLIB'] = 'C:\\ProgramData\\Anaconda2'

Given that a lot of people could be using OSGEO4W and Anaconda to get GRASS and Python installed on their machines, do you think it would be possible for you to offer alternative paths given default installation options of these packages please?

Thanks again - I'm looking forward to testing some more OBIA functions on my data. I would also be happy to assist you in improving your notebook!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.