ChHarding / TouchTerrain_jupyter_docker

Image for running Touchterrain standalone via a jupyter notebook
15 stars 4 forks source link

GPX does not work #7

Closed SebLaus closed 1 year ago

SebLaus commented 1 year ago

Hello,

whenever I try to generate something with a GPX tack it breaks. If i leave out the GPX it works fine. I used your docker in September 2022 and it as working fine. I have switched to another Dockerhost recently and had to reconfigure everything and somehow it is not working anymore. I am using the standalone jupyter notebook.

The Map part has a NameError:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[7], line 25
     23 # add gpx lines if used
     24 if len(args["importedGPX"]) > 0: 
---> 25         multi_line_string = convert_to_GeoJSON(args["importedGPX"])
     26         mls_feature = ee.Feature(multi_line_string)
     27         Map.addLayer(mls_feature, {"color":'00FFFF', "strokeWidth":"1"}, "GPX line", opacity=0.9)

NameError: name 'convert_to_GeoJSON' is not defined

and the Processing part has an AssertionError:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[8], line 1
----> 1 totalsize, full_zip_file_name = TouchTerrain.get_zipped_tiles(**args) # args are in a dict
      2 print("\nDONE!\n\nCreated zip file", full_zip_file_name,  "%.2f" % totalsize, "Mb")

File /TouchTerrain/standalone/touchterrain/common/TouchTerrainEarthEngine.py:902, in get_zipped_tiles(DEM_name, trlat, trlon, bllat, bllon, polygon, polyURL, poly_file, importedDEM, printres, ntilesx, ntilesy, tilewidth, basethick, zscale, fileformat, tile_centered, CPU_cores_to_use, max_cells_for_memory_only, temp_folder, zip_file_name, no_bottom, bottom_image, ignore_leq, lower_leq, unprojected, only, original_query_string, no_normals, projection, use_geo_coords, importedGPX, gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, map_img_filename, smooth_borders, offset_masks_lower, fill_holes, min_elev, **otherargs)
    900 if importedGPX != None and importedGPX != []:
    901     from touchterrain.common.TouchTerrainGPX import addGPXToModel  
--> 902     addGPXToModel(pr, npim, dem, importedGPX, 
    903                   gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, 
    904                   trlat, trlon, bllat, bllon) 
    906 # clip values?
    907 if ignore_leq != None:

File /TouchTerrain/standalone/touchterrain/common/TouchTerrainGPX.py:233, in addGPXToModel(pr, npim, dem, importedGPX, gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, trlat, trlon, bllat, bllon)
    231 source = osr.SpatialReference()
    232 s_res = source.ImportFromEPSG(4326) # This is WGS84, return of 0 => OK
--> 233 if s_res != 0: assert False, "addGPXToMode(): source.ImportFromEPSG(4326) returned error" + str(s_res)
    235 for gpxFile in importedGPX:
    236     pr(f"process gpx file: {gpxFile}")

AssertionError: addGPXToMode(): source.ImportFromEPSG(4326) returned error6
ChHarding commented 1 year ago

Hi,

I managed to fix the first error (something I had done to all the other notebooks but not for this one) which is now on GIthub. I can also re-produce the processing problem and tracked it finally down to that fact that when GDAL is installed using conda, it is necessary to activate the base environment (conda activate base) for GDAL to work (needs some path settings). I’ll try to automate this in my Dockerfile but It’ll have to wait until I’m back from my vacation. In the mean time, please look at the new version of the notebook to solve the first issue and try to make conda activate base work.

Cheers

Chris

On Dec 22, 2022, at 12:27, SebLaus @.**@.>> wrote:

Hello,

whenever I try to generate something with a GPX tack it breaks. If i leave out the GPX it works fine. I used your docker in September 2022 and it as working fine. I have switched to another Dockerhost recently and had to reconfigure everything and somehow it is not working anymore. I am using the standalone jupyter notebook.

The Map part has a NameError:


NameError Traceback (most recent call last) Cell In[7], line 25 23 # add gpx lines if used 24 if len(args["importedGPX"]) > 0: ---> 25 multi_line_string = convert_to_GeoJSON(args["importedGPX"]) 26 mls_feature = ee.Feature(multi_line_string) 27 Map.addLayer(mls_feature, {"color":'00FFFF', "strokeWidth":"1"}, "GPX line", opacity=0.9)

NameError: name 'convert_to_GeoJSON' is not defined

and the Processing part has an AssertionError:


AssertionError Traceback (most recent call last) Cell In[8], line 1 ----> 1 totalsize, full_zip_file_name = TouchTerrain.get_zipped_tiles(**args) # args are in a dict 2 print("\nDONE!\n\nCreated zip file", full_zip_file_name, "%.2f" % totalsize, "Mb")

File /TouchTerrain/standalone/touchterrain/common/TouchTerrainEarthEngine.py:902, in get_zipped_tiles(DEM_name, trlat, trlon, bllat, bllon, polygon, polyURL, poly_file, importedDEM, printres, ntilesx, ntilesy, tilewidth, basethick, zscale, fileformat, tile_centered, CPU_cores_to_use, max_cells_for_memory_only, temp_folder, zip_file_name, no_bottom, bottom_image, ignore_leq, lower_leq, unprojected, only, original_query_string, no_normals, projection, use_geo_coords, importedGPX, gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, map_img_filename, smooth_borders, offset_masks_lower, fill_holes, min_elev, **otherargs) 900 if importedGPX != None and importedGPX != []: 901 from touchterrain.common.TouchTerrainGPX import addGPXToModel --> 902 addGPXToModel(pr, npim, dem, importedGPX, 903 gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, 904 trlat, trlon, bllat, bllon) 906 # clip values? 907 if ignore_leq != None:

File /TouchTerrain/standalone/touchterrain/common/TouchTerrainGPX.py:233, in addGPXToModel(pr, npim, dem, importedGPX, gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, trlat, trlon, bllat, bllon) 231 source = osr.SpatialReference() 232 s_res = source.ImportFromEPSG(4326) # This is WGS84, return of 0 => OK --> 233 if s_res != 0: assert False, "addGPXToMode(): source.ImportFromEPSG(4326) returned error" + str(s_res) 235 for gpxFile in importedGPX: 236 pr(f"process gpx file: {gpxFile}")

AssertionError: addGPXToMode(): source.ImportFromEPSG(4326) returned error6

— Reply to this email directly, view it on GitHubhttps://github.com/ChHarding/TouchTerrain_jupyter_docker/issues/7, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEYDF5LNHSR4PYBQMD52VITWOSMQJANCNFSM6AAAAAATHABJPE. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences Touchterrain.geol.iastate.eduhttp://Touchterrain.geol.iastate.edu

ChHarding commented 1 year ago

Quick follow up: I think I figured out how to activate the base env in a generic way. Have a look at the run_touchterrain.sh script.

On Dec 24, 2022, at 18:15, Harding, Chris [GE AT] @.**@.>> wrote:

Hi,

I managed to fix the first error (something I had done to all the other notebooks but not for this one) which is now on GIthub. I can also re-produce the processing problem and tracked it finally down to that fact that when GDAL is installed using conda, it is necessary to activate the base environment (conda activate base) for GDAL to work (needs some path settings). I’ll try to automate this in my Dockerfile but It’ll have to wait until I’m back from my vacation. In the mean time, please look at the new version of the notebook to solve the first issue and try to make conda activate base work.

Cheers

Chris

On Dec 22, 2022, at 12:27, SebLaus @.**@.>> wrote:

Hello,

whenever I try to generate something with a GPX tack it breaks. If i leave out the GPX it works fine. I used your docker in September 2022 and it as working fine. I have switched to another Dockerhost recently and had to reconfigure everything and somehow it is not working anymore. I am using the standalone jupyter notebook.

The Map part has a NameError:


NameError Traceback (most recent call last) Cell In[7], line 25 23 # add gpx lines if used 24 if len(args["importedGPX"]) > 0: ---> 25 multi_line_string = convert_to_GeoJSON(args["importedGPX"]) 26 mls_feature = ee.Feature(multi_line_string) 27 Map.addLayer(mls_feature, {"color":'00FFFF', "strokeWidth":"1"}, "GPX line", opacity=0.9)

NameError: name 'convert_to_GeoJSON' is not defined

and the Processing part has an AssertionError:


AssertionError Traceback (most recent call last) Cell In[8], line 1 ----> 1 totalsize, full_zip_file_name = TouchTerrain.get_zipped_tiles(**args) # args are in a dict 2 print("\nDONE!\n\nCreated zip file", full_zip_file_name, "%.2f" % totalsize, "Mb")

File /TouchTerrain/standalone/touchterrain/common/TouchTerrainEarthEngine.py:902, in get_zipped_tiles(DEM_name, trlat, trlon, bllat, bllon, polygon, polyURL, poly_file, importedDEM, printres, ntilesx, ntilesy, tilewidth, basethick, zscale, fileformat, tile_centered, CPU_cores_to_use, max_cells_for_memory_only, temp_folder, zip_file_name, no_bottom, bottom_image, ignore_leq, lower_leq, unprojected, only, original_query_string, no_normals, projection, use_geo_coords, importedGPX, gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, map_img_filename, smooth_borders, offset_masks_lower, fill_holes, min_elev, **otherargs) 900 if importedGPX != None and importedGPX != []: 901 from touchterrain.common.TouchTerrainGPX import addGPXToModel --> 902 addGPXToModel(pr, npim, dem, importedGPX, 903 gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, 904 trlat, trlon, bllat, bllon) 906 # clip values? 907 if ignore_leq != None:

File /TouchTerrain/standalone/touchterrain/common/TouchTerrainGPX.py:233, in addGPXToModel(pr, npim, dem, importedGPX, gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, trlat, trlon, bllat, bllon) 231 source = osr.SpatialReference() 232 s_res = source.ImportFromEPSG(4326) # This is WGS84, return of 0 => OK --> 233 if s_res != 0: assert False, "addGPXToMode(): source.ImportFromEPSG(4326) returned error" + str(s_res) 235 for gpxFile in importedGPX: 236 pr(f"process gpx file: {gpxFile}")

AssertionError: addGPXToMode(): source.ImportFromEPSG(4326) returned error6

— Reply to this email directly, view it on GitHubhttps://github.com/ChHarding/TouchTerrain_jupyter_docker/issues/7, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEYDF5LNHSR4PYBQMD52VITWOSMQJANCNFSM6AAAAAATHABJPE. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences Touchterrain.geol.iastate.eduhttp://touchterrain.geol.iastate.edu/

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences Touchterrain.geol.iastate.eduhttp://Touchterrain.geol.iastate.edu

SebLaus commented 1 year ago

Thanks for looking into it!

After building the Dockerimage the processing worked fine again.

The Map issue(convert_to_GeoJSON) was totally my fault. I merged the GPX options into the part with the general args but forgot to copy over the first line that imports TouchTerrainGPX

Sebastian