-
Notifications
You must be signed in to change notification settings - Fork 61
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
GeoJSON overlay #27
Open
micamur
wants to merge
44
commits into
pR0Ps:master
Choose a base branch
from
micamur:GeoJSON-overlay
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
GeoJSON overlay #27
Conversation
This file contains 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 is a first test to add a textarea in which a user can copy-paste GeoJSOn code. It is not finished, the style may be not great but more importantly the overlay is not erased if the code is erased. Overlays are only added and never removed. The next step is to add the import button functionnality.
…trackmap-panel into GeoJSON-overlay
Now when you click on the button "Import GeoJSON" it opens a file browser in which you can only select json file.
Changed "code" to "text" to better represent the fact that it contains the text from the textarea and not the parsed text.
…trackmap-panel into GeoJSON-overlay
The user can upload a GeoJson file and the content of the file will be display on the map.
Now when you remove the overlay code from the text area, the previous overlay disappears from the map and the new one appears. This means that you can at the moment only have one overlay at a time using the text area.
We gave the browse button the same style than the other buttons on the panel.
When you hit the "Save" button, the current overlay is saved so that later it will be possible to manage different overlays (edit, delete...)
…trackmap-panel into GeoJSON-overlay
…trackmap-panel into GeoJSON-overlay
If the default value is '' (empty), then the parsing will throw an error, so we changed it to '{}'.
Now when the user hits the "Save" button, the content of the textarea is saved as a new element of the overlay list and the textarea is cleared. This list is displayed on the right side and for each element is displayed: its name (for the moment its Leaflet id) and three buttons. These three buttons are: download (to download the overlay as a file), edit (to make the content of the overlay appear in the text area) and delete (to delete the overlay from the list and from the map). These buttons don't do anything for the moment.
Now the delete button deletes the overlay from the map and from the overlay list.
Merge the two previous button into one. After a click on the button "Import GeoJson", the user can chose a file then the file's name is displayed and the overlay is added.
…trackmap-panel into GeoJSON-overlay
When the user clicks on the download button, a browser download popup appears and asks if they want to download a file named "overlay.json". An improvement would be to use a custom name for each overlay for the downloaded file name.
…trackmap-panel into GeoJSON-overlay
If the overlay textarea is empty the corresponding object is null and it cannot be saved in the overlay list.
When a file is added through the Import file button the geoJson object of this file is add to the list of overlays.
…trackmap-panel into GeoJSON-overlay
When you click on an object on the map, the properties content of the json object is displayed in a popup.
Created a function called addOverlayToMap that can be called whenever a JSON text needs to be added to the map. Also created a function jsonToString to get the same kind of result (indentation, etc.) whenever it is called.
One is jsonToString and the other is overlayToString, which makes more sense with the arguments than before.
Now if the text in argument is empty, the function will throw an error, as this should never happen.
Moved the code that didn't need to be in the try/catch after, and added a "return" in the catch in order to get out of the function there.
One is to add the overlay to the map and the other is to add the overlay to the list displayed to the user.
The edit function does not work correctly, so the button is hidden to the user until it is fixed.
…panel into merge-overlay-popup
…trackmap-panel into merge-overlay-popup
There should be less confusion about which kind of object we are using and why between pure text, parsed geojson and the corrsponding Leaflet object.
micamur
force-pushed
the
GeoJSON-overlay
branch
from
April 30, 2020 16:23
77b4e3f
to
2ddef40
Compare
When the dashboard was saved, an error occured because not all the objects could be serialized: now what is saved is the parsed geojson list. Because we want to keep the ability to download and delete an overlay, we need to have a correspondance between the parsed geojson and the Leaflet overlays, that's why we need auxiliary lists and object which are declared in the constructor and filled in setupMap.
micamur
force-pushed
the
GeoJSON-overlay
branch
from
April 30, 2020 16:25
2ddef40
to
4c810d0
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We added the ability to add multiple overlays to the map: either by pasting the GeoJSON code in a textarea or by importing a file. This can be useful to add context to the paths drawn on the map from the data source. Once added, an overlay can be downloaded and deleted; this allows a good flexibility. When the user clicks on a layer on the map, there is a popup which shows all the informations in the properties of the overlay.