POST
|
Hi Steve, Nick, everyone! Using ArcGis Javascript Api 3.22 I create a web map viewer. I take one (only none -- see red circle above!) client side graphic in the variable named selected I can get the Json of selected using: selected.toJson(); Using Terraformer I can transform from ArcGis Json to GeoJson using: currentPrimitive = Terraformer.ArcGIS.parse(selected.toJson()); but in currentPrimitive the coordinates look like 0.000000111 .. a lot of 0000...(terraformer coordinates transformations??) If I want to see geographic coordinates in GeoJson I need to use the next line instead: currentPrimitive = Terraformer.ArcGIS.parse(selected.toJson()).toMercator(); Now I am ready to export to KML using JSON to KML, but before I had to fix some issues: 1) Inside geoJsonString I found some null that I had to replace with {} 2) I had to complete the geoJsonString using the strings 'inicio' and 'fin' (to configure a geoJson FeatureCollection with the selected graphic -- a featurecollection with only one graphic) geoJsonString = JSON.stringify(currentPrimitive); inicio="{\"type\":\"FeatureCollection\",\"properties\":{},\"features\":[ "; fin= " ]}"; geoJsonString2 = geoJsonString.replace("null", "{}"); geoJsonString3 = inicio + geoJsonString2 + fin; var kml = tokml(JSON.parse(geoJsonString3)); and now I am ready to put the KML in a HTML element using an hyperlink: kmlString2 = encodeURIComponent(kml); d = document.getElementById('download-kml'); d.setAttribute('href', `data:text/kml;charset=utf-8,${kmlString2}`); d.setAttribute('Descargar', 'graphics.kml'); And the graphic border inside google earth: Thanks for your suggestions. But now I need to export the KML with the ArcGis Api symbols and colors. Do you have ideas to deal with it? Thank you! Alexys H Rodríguez
... View more
11-28-2017
10:22 PM
|
0
|
0
|
1947
|
POST
|
I just review this [TypeScript - Setting up your development environment for Javascript Api 4.5] and [how to guide on how to develop with Dojo 1 in TypeScript using dojo/typings] and I realized that I just needed to change my tsconfig.json to: { "compilerOptions": { "module": "amd", "noImplicitAny": true, "sourceMap": true, "jsx": "react", "jsxFactory": "tsx", "target": "es5", "experimentalDecorators": true, "preserveConstEnums": true, "suppressImplicitAnyIndexErrors": true }, "include": [ "./app/*" ], "exclude": [ "node_modules" ] } Now Visual Studio Code recognize the module!
... View more
11-28-2017
08:32 PM
|
1
|
0
|
590
|
POST
|
Hi Robert, Inside _onViewhange and before this.view.on('pointer-up', ...}); I wrote lang.hitch(this, this._onViewChange); I also used the same sentence inside the constructor. But I don't have access to 'this' inside this.view.on. __________________________ I fixed it using var that = this; I wrote var that = this; just before this.view.on('pointer-up', function(response){ that.centroanteriorgeo.x = that.state.longitudanterior, that.centroanteriorgeo = { x: that.state.longitudanterior, y: that.state.latitudanterior, }; }); And now I have access to 'this' inside this.view.on, inside _onViewChange Thank you very much for your help!
... View more
11-28-2017
08:28 PM
|
0
|
0
|
669
|
POST
|
Hi Robert, I just review this [TypeScript - Setting up your development environment for Javascript Api 4.5] and [how to guide on how to develop with Dojo 1 in TypeScript using dojo/typings] and I realized that I just needed to change my tsconfig.json to: { "compilerOptions": { "module": "amd", "noImplicitAny": true, "sourceMap": true, "jsx": "react", "jsxFactory": "tsx", "target": "es5", "experimentalDecorators": true, "preserveConstEnums": true, "suppressImplicitAnyIndexErrors": true }, "include": [ "./app/*" ], "exclude": [ "node_modules" ] } Thank you very much for your help
... View more
11-28-2017
08:20 PM
|
0
|
0
|
669
|
POST
|
Hi Rene, According to your advice (An Introduction to JavaScript ES6 Arrow Functions - Node.js @ IBM) I wrote var that = this; just before this.view.on('pointer-up', function(response){ that.centroanteriorgeo.x = that.state.longitudanterior, that.centroanteriorgeo = { x: that.state.longitudanterior, y: that.state.latitudanterior, }; }); And now I have access to 'this' inside this.view.on, inside _onViewChange. It is the solution! It does not work with var self = this;, because inside 'self' there is another object! I was trying to use fat arrow, but I don't know how to code it. Could you please tell me how? Thank you very much!
... View more
11-28-2017
08:13 PM
|
0
|
0
|
669
|
POST
|
Cheers Robert for your very fast answer! Now, I have this module problem. Visual Studio Code said "Cannot find module 'dojo/_base/lang' import lang = require("dojo/_base/lang"); I configured my widget folder with: npm init --yes npm install --save @types/arcgis-js-api npm install dojo-typings --save-dev Create tsconfig.json Inside onViewchange() I wrotte: lang.hitch(this, this._onViewChange); Do I need to put it inside the constructor? Regards!
... View more
11-22-2017
02:47 PM
|
0
|
2
|
669
|
POST
|
I am trying to configure a personalized widget for ArcGis Javascript Api 4.5. My issue is related to the use of 'this' (a MapView) inside of method on() of esri/views/View I used this.view.on inside a private method of my widget named onViewChange(). I attached all the TypeScript code. It looks like this: @property() @renderable() view: MapView; .... private _onViewChange() { this.view.on('pointer-up', function(response){ this.centroanteriorgeoX = this.state.longitudanterior, \\Here 'this' is undefined this.centroanteriorgeo = { x: this.state.longitudanterior, y: this.state.latitudanterior, }; }); this.centroanteriorpla = { \\Here this works fine!! x: this.state.xanterior, y: this.state.yanterior, }; ... }; I have access to 'this' inside the private onViewChange method but outside this.view.on. I can't use 'this' inside of this.view.on because it is undefined. How can I use and change properties of 'this' (MapView) inside Mapview.on, inside a private method, inside a new widget class that extends Accessor? I tryed to do the same inside this.view.watch, but I have the same problem. Cheers!! Alexys
... View more
11-22-2017
02:09 PM
|
0
|
7
|
893
|
POST
|
I am doing a personalized Widget. I configured all the folder and files related to the widget as is shown in this image: .. but I have a problem finding the dojo/dom library using this code line: import dom = require("dojo/dom"); The error messagge in the visual studio code window is: Cannot find module 'dojo/dom' I used npm to aditionally install dojo/dom and its typings, but I cannot fix the accees to the library. I do use the dojo/dom library accesing it directly from a HTML application using my local ArcGis Javascript Api 4.5, but in this case I am trying to use it inside a personalized Widget writtten in Typescript Any suggestions? Best regards!!
... View more
11-22-2017
01:03 PM
|
0
|
1
|
1425
|
POST
|
I am trying to install (IIS Local - Windows 10) the Widget code of this DevSummit 2007: Customizing the ArcGIS API for JavaScript Widgets Alan Sangma – @alansangma Matt Driscoll – @driskull JC Franco – @arfncode https://jcfranco.github.io/dev-summit-2017-customizing-widgets/slides/#/ https://youtu.be/UK5Hnjl9keA http://proceedings.esri.com/library/userconf/devsummit17/papers/dev_int_81.pdf But it is not possible to use (compile or run) the Compass Widget, because I have this error in my Visual Studio Code editor: Cannot find module 'dojo/i18n!esri/widgets/Compass/nls/Compass'. [ts] No se encuentra el módulo 'dojo/i18n!esri/widgets/Compass/nls/Compass'. I followed the steps provided: dev-summit-2017-customizing-widgets/compass.md at master · jcfranco/dev-summit-2017-customizing-widgets · GitHub I tried to change the paths, but I think there is a problem with the Typings of dojo. I ran the previous steps to configure the Widget Folder: I created the package.json: npm init --yes I installed Dojo Typings: npm install dojo-typings --save-dev I installed typings for JASAPI ArcGis: npm install --save @types/arcgis-js-api I created the config.json As you can see in the image, I tried to install i18n and its typing .. but nothing, the same problem! How can I fix the access to dojo/i18n module? Cheers! Alexys H
... View more
11-22-2017
12:42 PM
|
0
|
3
|
1370
|
Title | Kudos | Posted |
---|---|---|
1 | 11-28-2017 08:32 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|