|
POST
|
Thank you for your answer, Robert. I explain exactly what I want to do and you tell me if it can be done or not. My goal is to integrate an external application with my viewer. I have already integrated it in reverse with a feature action in the Query widget but now I am asked to be the integration of the external application to the viewer. This application is a database in which the user can select one record or several records. I want that with those records (called with an id) can access the viewer and open specifically the Query widget to get the layer with those results because large extensions of territory could lose the selection made. To connect the two applications I was going to do it with a hyperlink that took all the records that the user wants to visualize in the viewer but from what I have read with that url can not be filtered by multiple values. Thank you very much for the help
... View more
06-06-2019
04:41 AM
|
0
|
1
|
2163
|
|
POST
|
I'm working on modifying the Query widget. I need to pass a url with a query: http://<name>?query=<Layer_name>%<field_name>%<field_value> The previous link I got from the Share Widget. Once I have that complete link I would like to be able to pass it to the Query widget and return the value of the Results window of the widget itself. This functionality would want it to open automatically when the user enters the hyperlink in the browser. Any idea how to get started? Thanks for your help
... View more
05-31-2019
03:13 AM
|
0
|
6
|
2533
|
|
POST
|
That's it! Do you know any way to make the label appear automatically after selection? without having to activate it? Thank you very much.
... View more
05-03-2019
05:44 AM
|
0
|
0
|
1739
|
|
POST
|
Good morning, Robert I don't know if the post is too old to ask a question about it. I want to do something similar in my query widget but the above doesn't work. The problem is that only using "Textsymbol" it gives me undefined problems var devLabel = new TextSymbol()
devLabel.font.setSize("14pt");
devLabel.font.setFamily("arial");
I have done the following: ...'jimu/LayerInfos/LayerInfos',
'jimu/dijit/LoadingIndicator',
'dijit/form/Select',
'esri/symbols/TextSymbol',
'esri/layers/LabelClass',
"esri/symbols/Font"
],
function(on, query, Deferred, lang, html, array, all, declare, _WidgetsInTemplateMixin, jimuUtils, BaseWidget,
MapManager, FilterUtils, Message, jimuSymUtils, esriLang, esriRequest, symbolJsonUtils, FeatureLayer, PopupTemplate,
SimpleRenderer, TaskSetting, SingleQueryLoader, SingleQueryResult, queryUtils, LayerInfos,TextSymbol, LabelClass, Font) { And... var devLabel = new TextSymbol()
var font = new Font();
font.setSize("14pt");
font.setFamily("arial");
devLabel.setFont(font); The console gives me back the errors -TypeError: font.setFamily is not a function and if I comment "SetFamily()", I get the same error for the sentFont() method Do you know what might be going on? In line 55 of the code, I understand that the value DESCRIPTION I have to change the attribute of my entity that I want to show, right? //this is the very least of what should be set within the JSON
var json = {
"labelExpressionInfo": {"value": "{DESCRIPTION}"}
}; Thank you!
... View more
05-03-2019
03:27 AM
|
0
|
2
|
1739
|
|
POST
|
I'm sorry, Robert. And thank you for your invaluable help. Code working!
... View more
02-02-2019
04:27 AM
|
0
|
0
|
1913
|
|
POST
|
Richard. I am trying to put into Memory two arrays; provincias_name and provincias_id. Thinking that in this way the tool allows me to make the dropdown with all the provinces I have in the array. In fact the tool works but showing in a single line all the content of the array. In which way do you think I could go through the array to do it correctly? Maybe it's not the tool I need. Thanks var stateStore = new Memory({
data: [
{name: provincias_name, id: provincias_id}
]
});
var comboBox = new ComboBox({
id: "stateSelect",
name: "Estados",
value: "Elija provincia",
store: stateStore,
//searchAttr: "name"
},"stateSelect").startup();
... View more
02-01-2019
01:30 PM
|
0
|
2
|
1913
|
|
POST
|
I've done the part you told me about. However, when running it, it it seems that I am not putting any value to the Combo, because the browser console gives me the following error: "TypeError: Cannot read property 'toString' of undefined" Do you know what that might be due to? var resp_prov_name = response.getElementsByTagName('np');
var provincias_name = [];
var i;
for (i=0; i< resp_prov_name.length; i++){
//busca nombre provincia
dom.byId("status").value = xmlParser.textContent(resp_prov_name[i]);
var resp_prov_name1 = dom.byId("status");
this.resp_prov_name1=resp_prov_name1.value
provincias_name.push(this.resp_prov_name1)
});
var stateStore = new Memory({
data:provincias_name
});
var comboBox = new ComboBox({
id: "stateSelect",
//name: "provincias_name",
value: "Elija provincia",
store: stateStore,
//searchAttr: "name"
},"stateSelect").startup();
... View more
02-01-2019
04:10 AM
|
0
|
4
|
1913
|
|
POST
|
Good morning I have the data returned from a query through esri/request and I want to pass them to a Combobox to show me in the drop-down menu these data. I am using dojo/store/memory and dijit/form/Combobox. I am basing myself on this example https://dojotoolkit.org/reference-guide/1.10/dijit/form/ComboBox.html but in my case, the values I want to introduce are extracted from an XML file. Just as I'm stressing it and I don't know if it's correct, I've looped over the returned query to get the values I'm interested in. Inside this loop I have generated the variable "stateStore" that will keep the query data. Then I create the Combobox that will show the names of the query. var resp_prov_name = response.getElementsByTagName('np');
var i;
for (i=0; i< resp_prov_name.length; i++){
//busca nombre provincia
dom.byId("status").value = xmlParser.textContent(resp_prov_name[i]);
var resp_prov_name1 = dom.byId("status");
this.resp_prov_name1=resp_prov_name1.value
var stateStore = new Memory({
data: this.resp_prov_name1,
});
};
var comboBox = new ComboBox({
name: this.resp_prov_name1,
value: "",
store: stateStore,
searchAttr: "name"
},"stateSelect").startup();
I have doubts about whether it is necessary to create the loop I have made. As I have it now, if I put the ComboBox inside the loop. it fills in the first value of the query but gives error because the widget is already created. If I take it out of the loop, it only completes one value of the Combobox. Thank you very much for your help
... View more
01-31-2019
04:27 AM
|
0
|
6
|
2412
|
|
POST
|
Thanks for helping me clean up the code, Richard. But I have a problem: I have changed the name of the variable (line 111) thinking that this way, the value that takes RC will pass to the first part of the conditional thus obtaining the coordinates of the point and its corresponding zoom. How should I pass the value of the variable RC to the first part of the conditional to make the query (line 62)? Thank you again var RC = pc1 + pc2;
console.log(RC)
... View more
01-28-2019
08:14 AM
|
0
|
2
|
1126
|
|
POST
|
Good morning, everyone. The following code makes two requests to two different services of the Spanish Cadastre, depending on the data entered by the User. If the User introduces the Cadastral Reference, the service of the cadastre that returns the coordinate X and Y of the point is consulted, to later make a Zoom and paint the point. If on the contrary, the user introduces other alphanumeric fields, another service is consulted that will return the Cadastral Reference. Later this Cadastral Reference would be used to look for the information of the first service and to give the corresponding geometry. The problem I'm having is that the two queries work well separately, due to all the conditionals I'm putting in the code and that surely is not necessary and this making my code inefficient. I would like my code to execute queries according to the fields that the user has completed: if you have this value do this but if you have this other value, do this other. Any suggestions? Thank you all very much. define([
'dojo/_base/declare',
'jimu/BaseWidget',
"dojox/xml/parser",
'dijit/form/Button',
'dojo/dom',
'dojo/on',
"esri/request",
"esri/config",
"esri/graphic",
"esri/symbols/PictureMarkerSymbol",
'esri/geometry/Point',
"esri/Color",
"esri/SpatialReference",
"esri/geometry/webMercatorUtils",
'dojo/_base/lang'
],
function(
declare, BaseWidget, xmlParser, Button, dom, on,esriRequest,esriConfig,Graphic,PictureMarkerSymbol,Point,Color,SpatialReference,webMercatorUtils,lang) {
return declare([BaseWidget], {
baseClass: 'jimu-widget-zoomTo',
name: 'Referencia Catastral',
symbol: null,
postCreate: function() {
this.inherited(arguments);
this.symbol = new PictureMarkerSymbol('http://static.arcgis.com/images/Symbols/Basic/YellowStickpin.png', 51, 51);
},
onOpen:function(){
dom.byId("CoordX").innerHTML = ""
dom.byId("CoordY").innerHTML = ""
dom.byId("RC").innerHTML = ""
dom.byId("dir").innerHTML = ""
dom.byId("error").innerHTML = ""
},
onZoomClick: function(){
//llamando al proxy---descomentar cuando esté en el servidor
//esriConfig.defaults.io.proxyUrl = "PHP/proxy.php?";
var RC = dom.byId("RC").value.substring(0,14);
var url = "https://ovc.catastro.meh.es/ovcservweb/OVCSWLocalizacionRC/OVCCoordenadas.asmx/Consulta_CPMRC?Provincia=&Municipio=&SRS=EPSG%3A4326&RC=" + RC
if(RC!=""){
console.log("lleno")
//consulta por Referencia catastral
var requestHandle = esriRequest({
"url": url,
"handleAs": "xml"
//para evitar problemas de scope al usar el this hay que usar lang
}).then(lang.hitch(this,function(response){
dom.byId("status").value = xmlParser.innerXML(response);
var respuesta = dom.byId("status").value;
var xcen = response.getElementsByTagName('xcen');
var ycen = response.getElementsByTagName('ycen');
var dir = response.getElementsByTagName('ldt');
var error = response.getElementsByTagName('des');
if (xcen.length==0) {
dom.byId("error").value = xmlParser.textContent(error[0]);
var errores = dom.byId("error");
dom.byId("error").innerHTML = errores.value;
dom.byId("CoordX").innerHTML = ""
dom.byId("CoordY").innerHTML = ""
dom.byId("RC").innerHTML = ""
dom.byId("dir").innerHTML = ""
} else {
dom.byId("CoordX").value = xmlParser.textContent(xcen[0]);
var coordX = dom.byId("CoordX");
console.log(coordX)
dom.byId("CoordX").innerHTML = coordX.value;
dom.byId("CoordY").value = xmlParser.textContent(ycen[0]);
var coordY = dom.byId("CoordY");
dom.byId("CoordY").innerHTML = coordY.value;
dom.byId("error").innerHTML = ""
//direccion
dom.byId("dir").value = xmlParser.textContent(dir[0]);
var dir = dom.byId("dir");
dom.byId("dir").innerHTML = dir.value
//creo y añado un punto
var punto = new Point(coordX.value, coordY.value, new SpatialReference({wkid:4326}));
var geom = webMercatorUtils.geographicToWebMercator(punto); // project the point to webmercator since that is what esri basmaps are
var graphic = new Graphic(geom, this.symbol);
this.map.graphics.add(graphic);
this.map.centerAndZoom(punto, 20); //esri basemaps are tiled so the level is a value like 12 Not 100
}
}));
} else{
//consulta por Parcela
var prov =dom.byId("prov").value;
var mun= dom.byId("muni").value;
var pol= dom.byId("pol").value;
var parc = dom.byId("parc").value;
var url_parcela = "https://ovc.catastro.meh.es//ovcservweb/OVCSWLocalizacionRC/OVCCallejero.asmx/Consulta_DNPPP?Provincia="+prov+"&Municipio="+mun+"&Poligono="+pol+"&Parcela="+parc
console.log(url_parcela)
var requestHandle1 = esriRequest({
"url": url_parcela,
"handleAs": "xml"
//para evitar problemas de scope al usar el this hay que usar lang
}).then(lang.hitch(this,function(response){
dom.byId("status").value = xmlParser.innerXML(response);
var respuesta = dom.byId("status").value;
console.log(respuesta)
var pc_1 = response.getElementsByTagName('pc1');
dom.byId("pc1").value = xmlParser.textContent(pc_1[0]);
var pc1 = dom.byId("pc1").value;
console.log(pc1)
var pc_2 = response.getElementsByTagName('pc2');
dom.byId("pc2").value = xmlParser.textContent(pc_2[0]);
var pc2 = dom.byId("pc2").value;
console.log(pc2)
var RC_total = pc1+pc2;
console.log(RC_total)
}));
};
},
//end of zoomclick()
onClose: function(){
this.map.on("click", function(){
console.log("click_close");
});
this.map.graphics.clear();
}
});
});
... View more
01-28-2019
04:52 AM
|
0
|
4
|
1230
|
|
POST
|
It works perfectly Robert! The last question: I generated the point and then cleaned it when I close the widget (onClose). However, I would also like to clean the information that is asked of the user when he opens the widget (var RC) and I do not know what method I have to use to do it. Thank you again.
... View more
01-18-2019
08:34 AM
|
0
|
1
|
2166
|
|
POST
|
Hi! I have this code define([
'dojo/_base/declare',
'jimu/BaseWidget',
"dojox/xml/parser",
'dojo/dom',
'dojo/on',
"esri/request",
"esri/graphic",
"esri/symbols/SimpleMarkerSymbol",
'esri/geometry/Point',
"esri/Color",
"esri/SpatialReference"
],
function(
declare, BaseWidget, xmlParser, dom, on,esriRequest,Graphic,SimpleMarkerSymbol,Point,Color,SpatialReference) {
return declare([BaseWidget], {
baseClass: 'jimu-widget-zoomTo',
symbol: null,
postCreate: function() {
this.inherited(arguments);
this.symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,10,null,new Color("blue"));
console.log("postCreate creado!")
},
onZoomClick: function(){
var RC = dom.byId("RC").value;
//var url = "https://ovc.catastro.meh.es/ovcservweb/OVCSWLocalizacionRC/OVCCoordenadas.asmx/Consulta_CPMRC?Provincia=&Municipio=&SRS=4326&RC=" + RC
var url = "https://ovc.catastro.meh.es/ovcservweb/OVCSWLocalizacionRC/OVCCoordenadas.asmx/Consulta_CPMRC?Provincia=&Municipio=&SRS=EPSG%3A4326&RC=" + RC
console.log(url);
var requestHandle = esriRequest({
"url": url,
"handleAs": "xml"
});
requestHandle.then(function(response){
dom.byId("x").value = xmlParser.innerXML(response);
var xcen = response.getElementsByTagName('xcen');
dom.byId("x").value = xmlParser.textContent(xcen[0]);
dom.byId("y").value = xmlParser.innerXML(response);
var ycen = response.getElementsByTagName('ycen');
dom.byId("y").value = xmlParser.textContent(ycen[0]);
var RC = dom.byId("RC").value;
});
var coordY = dom.byId("y");
var coordX = dom.byId("x");
var level = 100;
var punto = new Point(coordX.value,coordY.value,new SpatialReference({ wkid: 4326 }));
var graphic = new Graphic(punto,this.symbol)
//var punto = new Point(coordX.value,coordY.value,this.map.spatialReference);
this.map.centerAndZoom(punto,level.value);
},
});
}); I managed to get the X and Y coordinates out of the XML file, like Robert told me. Now with these coordinates I want to zoom and center, as well as draw a point. The problem is that Zoom and center isn't working and I don't know why. Could there be any problem of context functions? I don't know if I'm accessing the map well (this.map). Thank you
... View more
01-18-2019
03:06 AM
|
0
|
3
|
2166
|
|
POST
|
I´m working with this code: Access data (XML) | ArcGIS API for JavaScript 3.27 and I obtain de GET Request of the Spanish Cadastre Server <?xml version="1.0" encoding="utf-8"?><consulta_coordenadas xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.catastro.meh.es/">
<control>
<cucoor>1</cucoor>
<cuerr>0</cuerr>
</control>
<coordenadas>
<coord>
<pc>
<pc1>41011A0</pc1>
<pc2>0200584</pc2>
</pc>
<geo>
<xcen>-5.54542610726449</xcen>
<ycen>37.2725211862905</ycen>
<srs>EPSG:4326</srs>
</geo>
<ldt>Polígono 2 Parcela 584 BACIALJOFAR. ARAHAL (SEVILLA)</ldt>
</coord>
</coordenadas>
</consulta_coordenadas> My next goal is obtain the values of the <geo> node: <xcen> and <ycen>; after that I would like to collect those values and display them in a map with a ZoomTo widget. My problem is I can´t access to the nodes that I want. I´m using dojox/xml parser for it dom.byId("x").value = xmlParser.textContent(response.childNodes[0]); Is it possible to get these values with only esri/ request or I need to use dojo/xml for querying the request? How can I access to Xcen and Ycen values? Here the complete code: <!DOCTYPE html>
<html>
<head>
<title>XML Content</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="https://js.arcgis.com/3.27/esri/css/esri.css">
<style>
body{
font-family: "Arial Unicode MS, Arial, sans-serif";
}
#content {
width: 800px; height: 350px; padding: 5px; overflow: auto;
border: solid 2px #AAAAAA; background-color: #FFFFFF;
-moz-border-radius: 5px; -webkit-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px;
-moz-box-shadow: 0 0 0.5em black; -webkit-box-shadow: 0 0 0.5em black; -o-box-shadow: 0 0 0.5em black; box-shadow: 0 0 0.5em black;
}
.failure { color: red; }
#status { font-size: 12px; }
</style>
<script src="https://js.arcgis.com/3.27/"></script>
<script>
require([
"dojo/dom",
"dojo/on",
"dojo/dom-class",
"dojo/_base/json",
"dojox/xml/parser",
"esri/config",
"esri/request",
"dojo/query",
"dojo/domReady!"
], function(dom, on, domClass, dojoJson, xmlParser, esriConfig, esriRequest, query) {
// Use CORS
//esriConfig.defaults.io.corsEnabledServers.push("ovc.catastro.meh.es"); // supports CORS
// Use proxy if the server doesn't support CORS
esriConfig.defaults.io.proxyUrl = "PHP/proxy.php?";
var RC = "8948011VL6084N"
dom.byId("url").value = "https://ovc.catastro.meh.es/ovcservweb/OVCSWLocalizacionRC/OVCCoordenadas.asmx/Consulta_CPMRC?Provincia=&Municipio=&SRS=EPSG%3A4326&RC=" + RC;
dom.byId("content").value = "";
dom.byId("RC").value = RC
//handle the Go button's click event
on(dom.byId("submitRequest"), "click", getContent);
function getContent(){
var contentDiv = dom.byId("content");
contentDiv.value = "";
domClass.remove(contentDiv, "failure");
dom.byId("status").innerHTML = "Downloading...";
//get the url
var url = dom.byId("url").value;
var requestHandle = esriRequest({
"url": url,
"handleAs": "xml"
});
requestHandle.then(requestSucceeded, requestFailed);
}
function requestSucceeded(response, io){
dom.byId("status").innerHTML = "";
dojoJson.toJsonIndentStr = " ";
dom.byId("content").value = xmlParser.innerXML(response);
dom.byId("x").value = xmlParser.textContent(response.childNodes[0]);
}
function requestFailed(error, io){
domClass.add(dom.byId("content"), "failure");
dom.byId("status").innerHTML = "";
dojoJson.toJsonIndentStr = " ";
dom.byId("content").value = dojoJson.toJson(error, true);
}
});
</script>
</head>
<body>
<p>Download <b>XML</b> content using esriRequest. </p>
<p>
<input type="text" disabled="true" id="RC" size="50"/><br>
Coordenada X: <input type="text" disabled="true" id="x" size="50"/><br>
Coordenada Y: <input type="text" disabled="true" id="y" size="50"/><br>
<input type="text" disabled="true" id="url" size="100"/>
<input id="submitRequest" type="button" value="GO" />
<span id="status"></span>
</p>
<h2>Content</h2>
<textarea id="content"></textarea>
</body>
</html>
Thanks for your help!
... View more
01-11-2019
02:53 AM
|
0
|
7
|
2533
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-24-2022 04:21 AM | |
| 1 | 08-05-2020 12:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-10-2025
12:33 AM
|