Leaflet.DistortableImage
Leaflet.DistortableImage copied to clipboard
Automatic map updation at user's brower
Connecting with https://github.com/publiclab/mapknitter/pull/805. The basic setup of action cable is complete over here. Along with this, a json(currently empty for testing) is broadcasted to every browser on which editing is being taken place. This broadcasting will only happen when a single user edits an image on the map. The json will be of type:-
"id": 101,
"parent_id": null,
"image_content_type": "image/png",
"image_file_name": "apply-form-image.png",
"thumbnail": null,
"image_file_size": 627035,
"width": 1758,
"height": 2877,
"created_at": "2019-07-14T08:50:46.393Z",
"updated_at": "2019-07-14T09:09:44.781Z",
"map_id": 2,
"nodes": [
{
"id": 105,
"color": "black",
"author": "vidit",
"lat": "28.941683305",
"lon": "78.7811565399",
"way_id": 0,
"order": 0,
"created_at": "2019-07-14T09:09:44.711Z",
"updated_at": "2019-07-14T09:09:44.711Z",
"name": "",
"description": "",
"map_id": 0,
"way_order": 0,
"body": null
},
However, we'll require that the map gets updated once this json is received by the client. We need to build a function which will take this json and update the map with the warpables and their respective nodes. Any ideas on this would be really appreciated.
@jywarren @divyabaid16 @sashadev-sky any ideas?
@ViditChitkara I would love to help out with this, sorry for the delayed reply. We should schedule a time to discuss so we can get on the same page quickly. Are you available Wednesday?
In my free time Im coding a sketch tool to draw car accidents. And I will need a way to save sketch configs and reload it for future modifications.
Then I have planed to build my own code, but Im not skilled to work as a profesdsional coder like you do.
Example:
@sashadev-sky sure we may schedule a call on Wednesday. I think the updation part is working quite smoothly in https://github.com/publiclab/mapknitter/pull/805 , however, we need to discuss how to proceed on it further. Thanks for helping out on this!
@ViditChitkara np! You're in india?
@themacboy thats awesome. We save everything server side in a rails database in Mapknitter https://github.com/publiclab/mapknitter. You seem pretty skilled to me!
@ViditChitkara np! You're in india?
Yes
@ViditChitkara maybe we can just resolve this here and we won't be that complicated.. so what I am wondering is all of this can be done in MK right? Why upstream it? We can make a new route in MK that makes an ajax call and updates the map?
Sure, I think we did when images are being updated when the browser gets a broadcasted event (from actioncable) and currently not via an ajax request. Additionally we'll require that a similar sort of event is called when an image is added or deleted onto the map and maybe some type associated with each image like "added", "deleted" or "updated" so that while refreshing the map we get to know which images have to be deleted or added or simply updated.
So, I think a more solid and generic implementation of the synchronizeData (in #805 pr you reviewed)method could be done. Does that make sense? Thanks!