Select to view content in your preferred language

Cannot read property 'type' of undefined

04-08-2019 07:49 AM
New Contributor

I have an undefined problem with geometry.type, where I use symbol points, polylines and polygons for drawings and then export them into shapefiles.

var symbol;
if ( evt.geometry.type === "point") {
symbol = new Graphic(evt.geometry);
symbol = this.markerSymbol;
} else if ( evt.geometry.type === "polyline") {
symbol = new Graphic(evt.geometry);
symbol = this.lineSymbol;
} else if ( evt.geometry.type === "polygon") {
symbol = new Graphic(evt.geometry, null, {
ren: 1
symbol = this.fillSymbol;

this.connectMapClick(); Graphic(evt.geometry, symbol));

I use and dojo.toolkit for the script.

Tags (4)
0 Kudos
2 Replies
Occasional Contributor III

It looks like you are creating a custom widget based on the Draw widget included with CMV. In order to assist troubleshooting your custom code, I recommend that you create a GitHub repo containing the complete custom widget along with an example configuration that demonstrates the issue.

Instead of developing your own export methods, you may want to consider implementing my Export widget which will handle the export to shapefile along with numerous other spatial and non-spatial formats. Passing the desired features for export to that widget is just a few lines of custom code. If you post an issue about the Export widget within my cmv-widgets repo, I can assist you there.

0 Kudos
New Contributor

thank you, i'll try to do that.

I found the way in the form of ESRI, not converted into CMV:

0 Kudos