tmcgee / cmv-widgets

Widgets for CMV, the Configurable Map Viewer.
https://cmv.io/
MIT License
38 stars 48 forks source link

export drawing #207

Closed puguhekos closed 5 years ago

puguhekos commented 5 years ago

cmv-viewer-ori (2).zip

can help me about export drawing, i have trouble in geometry.type undefined after i click the button export to shapefile.

tmcgee commented 5 years ago

The first 2 issues I see are:

  1. You are attempting to export the wrong graphics. You are using this.map.graphics within the Draw widget. The Draw widget does not use map.graphics. It uses 3 different graphic layers for points/lines/polygons. You would have to combine all the graphics from the 3 layers before attempting to export.

  2. The file JS2Shapefile.js assumes each graphic has a geometry. At least 1 graphic in this.map.graphics is an image which has no geometry. The code fails because it can't get the geometry.type because there is no geometry property.

There are likely additional errors that would become apparent after the above 2 issues are fixed.

This really is all the assistance I can provide for code I didn't write. I am closing this issue since it is unrelated to the widgets in this repo. If you'd like to try implementing my Export widget instead of JS2Shapefile, I am willing to offer basic support for that effort.

tmcgee commented 5 years ago

@puguhekos I created an Export Graphics widget that uses the Export widget as I suggested in my prior comment. Let me know how that widget works for you.

puguhekos commented 5 years ago

thank you so much, it's work for me.

puguhekos commented 5 years ago

hi, i want to ask about attribute after we draw something, why, coord not included in the attribut? in the Advanced Draw widget,

script:

var graphic = new Graphic( (geoGeom) ? geoGeom : geom, this._symbols[type], { OBJECTID: new Date().getTime(), draw_type: type, // eslint-disable-line draw_text_string: null, // eslint-disable-line coord: lang }, null );

can you help me? thank you so much

tmcgee commented 5 years ago

@puguhekos I am not familiar with the code within the Advanced Draw Widget. It is best to ask at the repo for that widget.