-
Notifications
You must be signed in to change notification settings - Fork 1
Implement geo upload #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mtiessen1175
wants to merge
500
commits into
master
Choose a base branch
from
geo_upload
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 103 commits
Commits
Show all changes
500 commits
Select commit
Hold shift + click to select a range
2bcd8f1
Update import
lehecht 95f256d
Vue3 migration part 1/x
lehecht a22e711
Vue3 migration part 2/x
lehecht 16384a7
Vue3 migration part 3/x
lehecht b2ffaa0
Vue3 migration part 4/x
lehecht b87f144
Show error message for all kinds of exceptions
lehecht 7423087
Use GeoOverlayFactory
lehecht 17971e7
Revert changed class extension
lehecht 812c679
Create static functions to enable testing
lehecht 59037c5
Add tests
lehecht 0bdcede
Remove tests
lehecht 9a6e582
Use mock image instead of real file
lehecht f610d9c
Delete geo overlay files when volumes are deleted
lehecht 20dd573
Add GeoOverlayObserver
lehecht dac2b90
Fix updated title and layer name
lehecht eeec97d
Add webmap overlay option to factory
lehecht 4c275d0
Use GeoOverlayFactory in tests
lehecht 4b7db07
Add test for invalid webmap urls
lehecht c8357cd
Edit header
lehecht b625dd9
Fix missing entries
lehecht 9962c3f
Fix script type
lehecht e204d41
Request overlay data via API
lehecht fcce5e7
WIP: Display missing pixels as transparent background
lehecht 00e7763
Replace proj4php by php-coord
lehecht f0a4534
Replace php4proj methods by phpcoord methods
lehecht e9a926e
Increase readability
lehecht 7f8fcf9
Move some checks to the StoreGeotiffOverlay request validation
lehecht 595afc2
Fix wrong coords
lehecht 3314db6
Fix image overlay display
lehecht 2e75f7b
Make method testable again
lehecht 0bdd8b3
Update tests
lehecht cb36b79
Remove unused method and tests
lehecht 8f5fbe2
Format GeoOverlayController
lehecht 3b95d67
Remove unneccessary response
lehecht 5d0fe0a
Move file existence check to form request
lehecht 315bf5f
Use custom exceptions to handle them on controller level
lehecht b6bece4
Add build method to create object from data
lehecht 4dced87
Use try catch to handle errors
lehecht 09021a3
Add error code
lehecht 7183b3a
Simplify job constructor
lehecht 2f3aad2
Update tests
lehecht e1b886e
Validate requests without a geotiff
lehecht f84424f
Split up test
lehecht 76414ed
Move helper method to form request
lehecht c98ba36
Add webmap type to build overlay function
lehecht 334c055
Update build call
lehecht 4456838
Move validation code to form validation
lehecht 52ac92e
Use mock instead of real requests
lehecht 18cc1f5
Use mock instead of real files
lehecht 92fda9d
Remove file size check
lehecht bccb8f8
Rename variable for clarity
lehecht 2e5375e
Rename variable to improve consistency
lehecht 45cce08
Add more validation rules
lehecht 23e2303
Simplify controller method
lehecht 0004396
Add tests
lehecht 4433927
Fix geo overlay counr check
lehecht 1b29c3a
Update tests
lehecht 0430626
Remove unused class
lehecht 3b5a053
Simplify creation of alpha mask
lehecht 9344032
Add comments
lehecht 94026c9
Add new lines at the end of file
lehecht 14c860e
Handle exceptions in controller and form request
lehecht 5068124
Fix indentation
lehecht 1bdd326
Remove context layer button
lehecht 6cb855a
Make overlay removal reactive again
lehecht 709dd35
Remove unused model
lehecht a5377d2
Update readme
lehecht b418cdf
Replace unshift by toSpliced
lehecht 6e93fa5
Update migration
lehecht 4286ddf
Remove context_layer from factory and model
lehecht c4b77ec
Remove context_layer from GeoOverlayController Api
lehecht b088e30
Remove ununsed api and controller method
lehecht 3fde9e3
Update GeoOverlayControllerTest
lehecht 01f15bb
Minor changes
lehecht 17158dc
Update GeoTiffOverlayControllerTest
lehecht d138785
Update WebMapOverlayControllerTest
lehecht 1e058c5
Update php doc
lehecht 2ea490d
Fix migration not updating column
lehecht 2f00871
Remove setting browsing_layer on false
lehecht ed23e26
Return fresh records
lehecht 95cda2d
Update tests
lehecht 6eddc05
Revert "Fix migration not updating column"
lehecht eb61721
Add down method to migration
lehecht 7d6e60d
Remove unused project id
lehecht 22fff4a
Delete comments
lehecht 4d4a955
Catch unknown errors
lehecht 418fb0f
Use css to truncate file names
lehecht 03b1671
Center column headers
lehecht 9f7a998
Copy array by using slice
lehecht 3875e27
Move used scss classes to corresponding vue file
lehecht 6262cf9
Make hasOverlays a computed method
lehecht fec0e71
Edit texts and links
lehecht 4104659
Change url parameter name
lehecht f02ca5c
Remove unused route
lehecht f0fcdb1
Fix copy paste error
lehecht 4882b68
Make the mock variable global
lehecht 8c5fa95
WIP: Update geo overlays manual page
lehecht 3b2ca76
Highlight only last added overlay
lehecht 1e403c5
Show overlay on the map if it is selected
lehecht f4fc9a9
Remove redundant buttons
lehecht 05438e6
Use Api to get all geo overlays
lehecht e25d866
Rename api for more clarity
lehecht 35d91d8
Prevent flickering of the empty overlay message
lehecht 9a9306c
Use separate file for mounts
lehecht 198c930
Simplify view
lehecht a88482a
Improve geo overlay manual
lehecht 4f168c3
Add volume map manual to index
lehecht 3853945
Move getter to geoManager
lehecht 726c649
Allow geotiffs with epsg 4326
lehecht cae81ee
Fix bug with missing overlays
lehecht 7f44d6c
Refactor TileSingleOverlay
lehecht 635e389
Fix comparison with different types
lehecht 8dab21a
Fix not saving changes on image
lehecht c122b1a
Reject tiffs with more than 4 color channels
lehecht e884aac
Show message if job succeeded or failed
lehecht af3f3a7
Update error message
lehecht 7394749
Show last overlay on map after map change
lehecht 4f8ea8d
Fix segmentation fault when using float32 tiffs
lehecht 833e2a2
Handle coordinates at warp point
lehecht c7e8d8c
Return only processed geotiff overlays
lehecht 46e46cc
Add test to GeoOverlayController
lehecht c49dc8c
Add test to check whether job was dispatched
lehecht 9cfc300
Fix missing variable exception
lehecht d47dbe7
Add tests to GeoTiffOverlayControllerTest
lehecht 7b0d50c
Show wms overlays on demand
lehecht ff6e8a7
Finish loading when an error occurs
lehecht fc1cdb8
Use dependency injection to enable testing
lehecht c0a7c1e
Update test
lehecht acf2f38
GeoManager and WebMapSource extend Transformer
lehecht 246d839
Move coordinate calculation to GeoManager
lehecht 87c32a6
Update test
lehecht b7ac7e7
Rename method
lehecht adfa120
Check whether coords lie within bounds
lehecht ae8620d
Add tests
lehecht cb7b480
Remove out of bounds check
lehecht e88a630
Check if the wms crs is projected
lehecht a9d4a0b
Refactor code
lehecht 5b294dc
Add php doc
lehecht d972cdc
Remove redundant request variable
lehecht 61ecf6f
Update php doc
lehecht 7f4b1a7
Fix crs check
lehecht cbf1442
Update manual pages
lehecht 4dedfa9
Fix WMS manual entry
lehecht d052b3b
Reject wms urls with more than one layer
lehecht 61b8ea2
Make the geo overlay save only one layer
lehecht 5f3cca7
Move layer retrieval to webMapSource
lehecht aaf2237
Update tests
lehecht 131a9cc
Add test
lehecht e08882c
Remove redundant line
lehecht b6b1a0c
Allow multiple layers from the same source
lehecht 8175665
Hide disabled overlays on map
lehecht 5fa0e0f
Minor changes
lehecht 0b50064
Remove unused array
lehecht beb1f61
Update manual
lehecht bd420aa
Check whether layer from url exists
lehecht 4500fb0
Reject layer separated by spaces
lehecht 5c46347
Remove redundant return value
lehecht 88910df
Add tests
lehecht 1cc80f7
Do not send requests if urls are invalid
lehecht 13cf3b4
Add comments
lehecht 5c2e399
Edit comments
lehecht dafbbb9
Create method for image validation
lehecht d7abc11
Add user notification for failed jobs
lehecht d0bc924
Replace method since it uses way less memory
lehecht a291654
Fix failing tests
lehecht 9acd9ca
Check if layer exists before using it
lehecht e45ad44
Edit only bw and grayscale images
lehecht e8730e8
Use bit depth info to prevent seg faults
lehecht 65e7d5a
Remove unnecessary argument
lehecht 4ecda53
Format code
lehecht 59892eb
Fix wrong template url
lehecht c3ef007
Update test
lehecht f0d164e
Show failed job error message in overlay panel
lehecht 7654a07
Add new line at EOF
lehecht 644b930
Add new line at EOF
lehecht bb2b791
Add new line at EOF
lehecht 2279818
Remove double slash
lehecht 3aefd31
Edit error message
lehecht bac8d09
Rename event for more clarity
lehecht 7201227
Dispatch success event after uploading tiles
lehecht 816201c
Simplify code
lehecht 6b657ef
Move up components part
lehecht bd402e5
Fix bug with wrong overlay sorting
lehecht 887693b
Remove unused imports
lehecht 5b0e3aa
Update tests
lehecht 4477abf
Enable bulk update of overlays
lehecht 170a6e7
Update tests
lehecht 7d3d670
Simplify request validation
lehecht be13391
Update tests
lehecht ced9e91
Handle edge cases for the overlay list
lehecht 7057537
Minor changes
lehecht 62e7279
Simplify equality check for min and noDataValue
lehecht e5ed3d3
Disable upload buttons while loading
lehecht d4bb956
Remove unused method
lehecht e7ebfa9
Refactor code
lehecht 5b7c9dc
Add test
lehecht 789f7cd
Add restriction to query
lehecht bf82222
Improve code readability
lehecht a08a6ab
Add tests
lehecht dc52f9f
Remove overlay tiles when overlay is deleted
lehecht 235cfcb
Remove tiles only if overlay is geotiff
lehecht 7e2cf63
Remove new lines
lehecht 5479281
Check if overlays belong to volume before updating
lehecht b8e2bfb
Add tests
lehecht ce4cbcd
Fix wrong column creation method
lehecht ee74db1
Fix incomplete file path
lehecht 59251f0
Update entry point path
lehecht 91a80df
Update manifest.json and assests
lehecht b902e54
Improve and fix url check method
lehecht 7f50560
Remove unused method
lehecht 871f9e6
Fix test method name
lehecht c288d49
Fix factory declaration in model
lehecht 527ad00
Update test
lehecht 45d0920
Fix access on private property
lehecht 4afe9ea
Fix wrong model retrieve method
lehecht d0895a6
Add test
lehecht 4c1035a
Add missing file extensions in import section
lehecht 4a69c1c
Replace deprecated events method
lehecht b1aee4a
Fix invalid functions
lehecht eae3d61
Use response.body for consistency
lehecht cc1f192
Add missing field
lehecht a58cacb
Fix noData value detection
lehecht 96a29b7
Add tests
lehecht 002fa63
Fix empty invalidId array
lehecht e674b2d
Update test
lehecht fe7e4ec
Fix edge case with ill defined PixelScale
lehecht 7251ef5
Add tests
lehecht ce25ce0
Check if wms url contains forbidden hosts
lehecht cf30104
Add tests
lehecht 3cd6a28
Add layer name check
lehecht ce66e66
Add tests
lehecht 910f7ce
Fix wrong argument in method
lehecht 33bcd4c
Check if overlay exists before reading exif data
lehecht 6518f59
Make overlay name unique
lehecht 8ebd72c
Add test
lehecht 7036586
Check if geotiff file is empty
lehecht ab0d58f
Update empty file test
lehecht ade2258
Use assertInvalid to check for error
lehecht 838bf69
Add test for undefined CRS
lehecht 81384fa
User layer name as webmap name
lehecht 623831c
Check for existing webmap by using overlay name
lehecht 1871f3c
Update tests
lehecht 393e864
Add a test for duplicate webmaps
lehecht c7509ed
Fix failing test
lehecht 1ede709
Update webmap factory
lehecht a719500
Update test
lehecht c0e5fd1
Use factory instead of newFactory method
lehecht dcf5eca
Remove unused model
lehecht 981463b
Rename a variable for better understanding
lehecht b965a7f
Remove line break
lehecht File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <?php | ||
|
|
||
| namespace Biigle\Modules\Geo\Console\Commands; | ||
|
|
||
| use Biigle\Modules\Geo\GeoServiceProvider as ServiceProvider; | ||
| use Illuminate\Console\Command; | ||
|
|
||
| class Config extends Command | ||
| { | ||
| /** | ||
| * The console command name. | ||
| * | ||
| * @var string | ||
| */ | ||
| protected $name = 'geo:config'; | ||
|
|
||
| /** | ||
| * The console command description. | ||
| * | ||
| * @var string | ||
| */ | ||
| protected $description = 'Publish the config file for this module'; | ||
|
|
||
| /** | ||
| * Execute the command. | ||
| * | ||
| * @return void | ||
| */ | ||
| public function handle() | ||
| { | ||
| $this->call('vendor:publish', [ | ||
| '--provider' => ServiceProvider::class, | ||
| '--tag' => ['config'], | ||
| '--force' => true, | ||
| ]); | ||
| } | ||
| } |
56 changes: 0 additions & 56 deletions
56
src/Database/migrations/2020_12_14_130300_remove_geo_overlays_table.php
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| <?php | ||
|
|
||
| namespace Biigle\Modules\Geo; | ||
|
|
||
| use Illuminate\Database\Eloquent\Model; | ||
| use Illuminate\Http\UploadedFile; | ||
| use Biigle\Volume; | ||
| use Storage; | ||
|
|
||
| class GeoOverlay extends Model | ||
| { | ||
| /** | ||
| * Don't maintain timestamps for this model. | ||
| * | ||
| * @var bool | ||
| */ | ||
| public $timestamps = false; | ||
|
|
||
| /** | ||
| * The attributes hidden in the model's JSON form. | ||
| * | ||
| * @var array | ||
| */ | ||
| protected $hidden = [ | ||
| 'volume_id', | ||
| ]; | ||
|
|
||
| /** | ||
| * The attributes that should be casted to native types. | ||
| * | ||
| * @var array | ||
| */ | ||
| protected $casts = [ | ||
| 'top_left_lng' => 'float', | ||
| 'top_left_lat' => 'float', | ||
| 'bottom_right_lng' => 'float', | ||
| 'bottom_right_lat' => 'float', | ||
| ]; | ||
|
|
||
| /** | ||
| * The "booting" method of the model. | ||
| * | ||
| * @return void | ||
| */ | ||
| protected static function boot() | ||
| { | ||
| parent::boot(); | ||
|
|
||
| // Delete the overlay image file when the model is deleted. | ||
| static::deleting(function ($overlay) { | ||
| Storage::disk(config('geo.tiles.overlay_storage_disk'))->deleteDirectory($overlay->id); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * The volume, this overlay belongs to. | ||
| * | ||
| * @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
| */ | ||
| public function volume() | ||
| { | ||
| return $this->belongsTo(Volume::class); | ||
| } | ||
|
|
||
| /** | ||
| * Get the local path to the overlay image file. | ||
| * | ||
| * @return string | ||
| */ | ||
| public function getPathAttribute() | ||
| { | ||
| return "{$this->id}/{$this->id}_original"; | ||
| } | ||
|
|
||
| /** | ||
| * Store the uploaded image file of the geo overlay. | ||
| * | ||
| * @param UploadedFile $file | ||
| */ | ||
| public function storeFile(UploadedFile $file) | ||
| { | ||
| Storage::disk(config('geo.tiles.overlay_storage_disk')) | ||
| ->putFileAs($this->id, $file, "{$this->id}_original"); | ||
|
mzur marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| <?php | ||
|
|
||
| namespace Biigle\Modules\Geo\Http\Controllers\Api; | ||
|
|
||
| use Biigle\Http\Controllers\Api\Controller; | ||
| use Biigle\Modules\Geo\GeoOverlay; | ||
| use Illuminate\Contracts\Filesystem\FileNotFoundException; | ||
| use Storage; | ||
|
|
||
| class GeoOverlayController extends Controller | ||
| { | ||
| /** | ||
| * Shows the specified geo overlay file. | ||
| * | ||
| * @api {get} geo-overlays/:id/file Get a geo overlay file | ||
| * @apiGroup Geo | ||
| * @apiName ShowGeoOverlayFile | ||
| * @apiPermission projectMember | ||
| * | ||
| * @apiParam {Number} id The geo overlay ID. | ||
| * | ||
| * @param int $id geo overlay id | ||
| * @return mixed | ||
| */ | ||
| public function showFile($id) | ||
| { | ||
| $overlay = GeoOverlay::findOrFail($id); | ||
| $this->authorize('access', $overlay->volume); | ||
|
|
||
| try { | ||
| return Storage::disk(config('geo.tiles.overlay_storage_disk')) | ||
| ->download($overlay->path); | ||
| } catch (FileNotFoundException $e) { | ||
| abort(404); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Deletes the geo overlay. | ||
| * | ||
| * @api {delete} geo-overlays/:id Delete a geo overlay | ||
| * @apiGroup Geo | ||
| * @apiName DestroyGeoOverlay | ||
| * @apiPermission projectAdmin | ||
| * | ||
| * @apiParam {Number} id The geo overlay ID. | ||
| * | ||
| * @param int $id geo overlay id | ||
| */ | ||
| public function destroy($id) | ||
| { | ||
| $overlay = GeoOverlay::findOrFail($id); | ||
| $this->authorize('update', $overlay->volume); | ||
|
|
||
| $overlay->delete(); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migration files must not be deleted. This also means that you have to duplicate the
create_geo_overlays_tablemigration and update the timestamp to something afterremove_geo_overlays. Otherwise the migrations will not be applied correctly to existing instances.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for explaining!
resolved 40bafbe