iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.09k stars 296 forks source link

DragNDrop and shapefiles #1206

Open mbredif opened 5 years ago

mbredif commented 5 years ago

3 comments/issues related to my attempt to use DragNDrop plugin to load a zipped version of the velib dataset used in the shapefile example.

API mismatch

The APIs of DragNDrop and shapefileParser are not directly compatible, such that the following does not work :

DragNDrop.register('zip', DragNDrop.BINARY, itowns.ShapefileParser.parse, DragNDrop.COLOR);

A quick fix could be to have itowns.ShapefileParser.parse accept an argument of type ArrayBuffer containing the zip and call parseZip(data.zip || data) internally.

styling for point features

the default DragNDrop style does not display point feature, we could add to it :

                point: {
                    color: '#' + randomColor.toString(16),
                    line: '#' + randomColor.toString(16),
                }

style option

an optionnal style argument could be added to DragNDrop.register to override the style which is now limited to random colors. A similar request could be to override the convert function of geometry layers.

zarov commented 5 years ago

A quick fix could be to have itowns.ShapefileParser.parse accept an argument of type ArrayBuffer containing the zip and call parseZip(data.zip || data) internally

Yes, I let you do this quick patch !

the default DragNDrop style does not display point feature, we could add to it :

Yeah I didn't see that, thanks for noticing it. I let you do this too ;)

an optionnal style argument could be added to DragNDrop.register to override the style

I agree, maybe you can add a options as a last argument of register, and then at first you can put style into it, and convert can be added later.

mgermerie commented 1 year ago

@ftoromanoff developed an update of DragNDrop plugin which adds a better support for shapefiles. It would need to be pushed.