|
POST
|
yes, for example im using this structure for accessing to my layers (for example when i want to add a new layer and it works perfectly): write_logAccess(){ /*using*/
return serviceURL + "Admin/LogAccesos/FeatureServer/1?f=json&token=" + token.read();
} where token.read() is the token saved in local storage var previously. But how im using the applyedits, im not sure how to put the url... could be like this? return serviceURL + "Admin/LogAccesos/FeatureServer/1/applyEdits?f=json&token=" + token.read(); so my code for save the user is the following now: function saveLogin(){
var data = {
f: 'json',
adds: [{
attributes: {
"user": "Evelyn3"
},
geometry: {}
}]
};
jQuery.ajax({
type: 'POST',
url: myLayers.write_logAccess(),
data: JSON.stringify(data),
dataType:'json',
success: (success) => {
console.log(success);
console.log("pase");
},
error: (error) => {
console.log(error);
console.log("no pase");
}
});
} and i still get this error: what could be happening? Object {readyState: 4, status: 404, statusText: "error"}
... View more
04-14-2016
10:29 AM
|
0
|
0
|
3548
|
|
POST
|
i got this as error: Object {readyState: 4, responseText: "<html> ↵<head> ↵<title>ArcGIS Server REST API Logi… ↵</form> ↵</div> ↵<br/><br/> ↵</body> ↵</html> ↵", status: 200, statusText: "OK"} I have the following code: function saveLogin(){ var data = { token: token.read(), f: 'json', adds: [{ attributes: { "usuario": "Evelyn" } }] }; jQuery.ajax({ type: 'POST', url: "http://myserver/arcgis/rest/services/mylayer/LogAccess/FeatureServer/1/applyEdits", data: JSON.stringify(data), dataType:'json', success: (success) => { console.log(success); console.log("pase"); }, error: (error) => { console.log(error); console.log("no pase"); } }); } Now i pass the token through the data.
... View more
04-14-2016
09:51 AM
|
0
|
0
|
3548
|
|
POST
|
I got this and still the same error. function saveLogin(){ var data = { f: 'json', adds: [{ attributes: { "user": "Evelyn" } }] }; var url = myLayers.write_logAccess(); jQuery.ajax({ type: 'POST', url: url, data: data, dataType:'json', success: (success) => { console.log(success); }, error: (error) => { console.log(error); } }); }
... View more
04-14-2016
09:38 AM
|
0
|
0
|
3548
|
|
POST
|
Hello, im trying to add a new Feature in my rest service using ajax, but i got the following error: Object code:500 details:Array[1] 0:"No edits ('adds', 'updates' or 'deletes') were specified." length:1 __proto__:Array[0] message:"Unable to complete operation." What am i doing wrong? //Example url: http://myserverarcgis/arcgis/rest/services/mylayer/FeatureServer/1/applyEdits
//My attributes from my layer are: user,from and module.
function saveLogin(){
var arrayOfAttributes = [
{ "adds":[
{
"attributes" : {
"user" : "Evelyn4",
"from" : "Evelyn4",
"module" : "Evelyn4"
}
}
]
}
];
var url = myLayers.write_logAccess();
jQuery.ajax({
type: 'POST',
url: url,
data: arrayOfAttributes,
dataType:'json',
success: (success) => {
console.log(success);
},
error: (error) => {
console.log(error);
}
});
} Thanks for ur help .
... View more
04-14-2016
08:24 AM
|
0
|
9
|
6184
|
|
POST
|
Well, im using the legacy side and not amd to play with reactjs, so how in the samples some of them are with AMD and legacy code, i choose legacy. Well now i think i fix part of my problem doing this: myDynamicLayer1.on("click",(event)=>{ // console.log(event.graphic.attributes); }); In this way i will be able to get any attribute that im looking for the click and then using it to more complex analysis or queries. Thanks for your response.
... View more
03-23-2016
02:08 PM
|
1
|
0
|
1646
|
|
POST
|
I fix this problem (but just for infowindow): var myDynamicSedLayer = new esri.layers.FeatureLayer(layers.read_layer_interr_sed(),{ mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, infoTemplate: myinfotemplate.getSubFailure(), outFields: ["*"] }); Where myinfotemplate.getSubFailure() is a infotemplate-service where i get the infotemplates customized by me. Example: ... function getInfoTemplate(){ return { getSubFailure(){ let chqSubInfoTemp= new esri.InfoTemplate(); chqSubInfoTemp.setTitle("<b>Codigo Subestación: ${ARCGIS.DBO.SED_006.codigo}</b>"); let chqSubInfoContent = "<div style=padding-top: 10px;>ID Orden: ${ARCGIS.DBO.POWERON_ORDENES.id_orden}<br></div>"+ "<div style=display:inline-block;width:8px;></div>"+ "<div style=padding-top: 10px;>Alimentador: ${ARCGIS.DBO.SED_006.alimentador}<br></div>"+ "<div style=display:inline-block;width:8px;></div>"+ "<div style=padding-top: 10px;>Causa: ${ ARCGIS.DBO.POWERON_ORDENES.causa}<br></div>"+ "<div style=display:inline-block;width:8px;></div>"+ "<div style=padding-top: 10px;>Comentario: ${ARCGIS.DBO.POWERON_ORDENES.comentario}<br></div>"; chqSubInfoTemp.setContent(chqSubInfoContent); return chqSubInfoTemp; } } ....
... View more
03-23-2016
10:53 AM
|
1
|
0
|
1979
|
|
POST
|
Hello, Im trying to make a query with the map.onclick to get the features founded around the click. I have added 2 featurelayers that have some values that i want to get when the user clicks to make another analysis. The problem that now im having is that even if i make a polygon to search for any value, my featureSet doesnt give me any. My code is: function clickSearch(mapPoint){ var rectangle = new esri.geometry.Polygon(new esri.SpatialReference(mapPoint.spatialReference.wkid)); rectangulo.addRing(createRectangle(mapPoint,20)); console.log(rectangulo); var queryTask = new esri.tasks.QueryTask(layers.read_layer_interr_sed()); var query = new esri.tasks.Query; query.spatialRelationship=esri.tasks.Query.SPATIAL_REL_CONTAINS; query.geometry = rectangulo; query.outFields=['*']; query.returnGeometry = true; queryTask.execute(query,(featureSet)=>{ console.log("found something here...what is it?"); if(featureSet.features.length!=0){ console.log(featureSet.features); }else console.log("nothing"); },(error)=>{ console.log("no encontre na" , error); }); } function createRectangle(mapPoint,delta){ var arrayOfPoints = []; arrayOfPoints[0] = new esri.geometry.Point(mapPoint.x-delta,mapPoint.y-delta,mapPoint.spatialReference); arrayOfPoints[1] = new esri.geometry.Point(mapPoint.x-delta,mapPoint.y+delta,mapPoint.spatialReference); arrayOfPoints[2] = new esri.geometry.Point(mapPoint.x+delta,mapPoint.y+delta,mapPoint.spatialReference); arrayOfPoints[3] = new esri.geometry.Point(mapPoint.x+delta,mapPoint.y-delta,mapPoint.spatialReference); arrayOfPoints[4] = new esri.geometry.Point(mapPoint.x-delta,mapPoint.y-delta,mapPoint.spatialReference); return arrayOfPoints; } Note: Im not using require to load the modules. Im programming with ReactJS, webpack server and i just installed the api in that server. I have been used all the elements for the api in this way: Example for featureLayer. var myDynamicSedLayer = new esri.layers.FeatureLayer(layers.read_layer_interr_sed(),{ mode: esri.layers.FeatureLayer.MODE_SNAPSHOT, infoTemplate: myinfotemplate.getSubFailure(), outFields: ["*"] }); Anyone knows what could be happening? or any example doing this. I already search about it in the sample api. Thanks in advice.
... View more
03-23-2016
10:48 AM
|
0
|
3
|
3454
|
|
POST
|
Hello, Im making an app which i have added some dynamic layers to the map, but for some reason i cannot put the : infowindow (in onclick) and a tooltip (in mouseover). Can anyone tells me what im doing wrong or provide any example of how to do this? (I already try using the examples in the Samples | ArcGIS API for JavaScript for infowindows) It will be very usefull. Thanks a lot Im developing with reactjs (es6) , webpack srv and i put the arcgis_js_api in my working webpack server. I separate the map in another javascript file function mymap(){
var map;
return {
createMap(div){
map = new esri.Map(div, {
basemap: "topo",
center:[-71.2905, -33.1009],
zoom:9,
logo: false
});
return map;
},
getMap(){
return map;
},
onClick(){
map.on("click",(mouseEvent)=>{
return console.log("thinking on map onClick for infowindow");
});
}
};
}
export default mymap(); The code for my component where i set up the map is: import React from 'react';
import ReactDOM from 'react-dom';
import token from '../services/token-service';
import layers from '../services/layers-service';
import StatisticsToolbar from '../bundles/statistics-toolbar';
import mymap from '../services/map-service';
import MyGrid from '../bundles/myGrid';
class Interruptions extends React.Component {
constructor(){
super();
this.onClick = this.onClick.bind(this);
this.onClickToggle = this.onClickToggle.bind(this);
this.onClickStatistics = this.onClickStatistics.bind(this);
this.searchMassive = this.searchMassive.bind(this);
}
componentDidMount(){
var map = mymap.createMap("myMapDiv");
map.disableKeyboardNavigation();
var myDynamicSedLayer = new esri.layers.ArcGISDynamicMapServiceLayer(layers.read_dyn_layer_PO());
var myDynamicBTLayer2 = new esri.layers.ArcGISDynamicMapServiceLayer(layers.read_layer_BT());
var visibleLayers = [1];
myDynamicBTLayer2.setVisibleLayers(visibleLayers);
map.on("click",(evt)=>{
//TEMPLATE PARA MOSTRAR INFOWINDOW SUBESTACION DE DISTRIBUCION (0)
var chqSubestacionDistribucionTemplate = new esri.InfoTemplate();
chqSubestacionDistribucionTemplate.setTitle("<b>SSEE: ${ARCGIS.DBO.SED_006.codigo}</b>");
var chqSubestacionInfoContent =
"<div style=padding-top: 10px;>Nombre: ${ARCGIS.DBO.SED_006.nombre}<br></div>" +
"<div style=display:inline-block;width:8px;></div>"+
"<div style=padding-top: 10px;>Alimentador: ${ARCGIS.DBO.SED_006.alimentador}<br></div>"+
"<div style=display:inline-block;width:8px;></div>"+
"<div style=padding-top: 10px;>Comuna: ${ARCGIS.DBO.SED_006.comuna}<br></div>"+
"<div style=display:inline-block;width:8px;></div>"+
"<div style=padding-top: 10px;>ID Orden: ${ARCGIS.DBO.POWERON_ORDENES.id_orden}<br></div>"+
"<div style=display:inline-block;width:8px;></div>";
chqSubestacionDistribucionTemplate.setContent(chqSubestacionInfoContent);
// show info window
myDynamicSedLayer.setInfoTemplates({
0:{InfoTemplate: chqSubestacionDistribucionTemplate}
});
});
map.addLayer(myDynamicSedLayer,2);
map.addLayer(myDynamicBTLayer2,1); .... NOTE: My directoryFile is in the attachment.
... View more
03-17-2016
10:54 AM
|
0
|
1
|
3519
|
|
POST
|
I fix my issue doing this: var url="http://gisred.chilquinta.cl:5555/arcgis/rest/services/Interrupciones/PO/MapServer/0?f=json&token="+token.read(); where i have my singleton for all the urls
... View more
03-11-2016
08:07 AM
|
0
|
0
|
1162
|
|
POST
|
Hello, Im trying to bypass the IdentityManager in ReactJS and I dont know how to access to the registerToken function. I made a custom login where i ask the user and pass and when through ajax i generated the token for that user. The token is the localStorage. But everytime that i tried to add a new layer to the map(feature in this case) the IdentitManager pop up shows up, so ¿is there a way to do it? I already search in the forum but i cannot use the proxy option. My code in js is the following (im not using amd). import React from 'react'; import ReactDOM from 'react-dom'; import token from '../services/token-service'; import layers from '../services/layers-service'; /*FOR LOGIN APP*/ class Interruptions extends React.Component { constructor(){ super(); this.onClick = this.onClick.bind(this); // console.log('this is my token', token.read()); } componentDidMount(){ var map = new esri.Map("myMapDiv", { basemap: "topo", //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd center: [-122.45, 37.75], // longitude, latitude zoom: 13 }); var esriId = esri.IdentityManager(); esriId.registerToken({ server: 'http://myserverWITHOUTwww/arcgis/rest', userId: 'EXAMPLEUSER', token: token.read(), expires: 1440, ssl: false }); console.log(esriId.registerToken()); var myFirstLayer = new esri.layers.FeatureLayer(layers.read_layer_sed()); map.addLayer(myFirstLayer); } onClick(){ console.log(token.read()); } render(){ return ( <div className="interruptions_wrapper"> <div className="searchBox"> <input className="searchBox__searchInput" ref="NIS" type="text" /> <input className="searchBox__searchSubmit" type="submit" onClick={this.onClick} /> </div> <div className="myMapDiv" id="myMapDiv"></div> </div> ); } } ReactDOM.render(<Interruptions />, document.getElementById('myInterruptions'));
... View more
03-11-2016
07:26 AM
|
0
|
1
|
2479
|
|
POST
|
Yes, i will use the token cuz i already know that u can put them in the queries or layers when u want to load them, so not big deal with it. Thanks for ur help and guidance
... View more
03-09-2016
11:06 AM
|
0
|
0
|
2863
|
|
POST
|
Well im new trying to learn react. And i wasnt sure on for example, how to call the esri objects like : map, queries, querytasks, etc from the code. I figure out asking to one of my friends who knows react on how to integrate the api and i change the code for ajax response to show for example how to put the map. jQuery.ajax({
type: 'POST',
url: url,
data: {
username: genericAccount.username,
password: genericAccount.password,
client: genericAccount.client,
format: 'json'
},
success: (success) => {
console.log('here i need to call to a function for requesting service access');
new esri.Map('myMapForTest', {
center: [-118, 34.5],
zoom: 8,
basemap: "topo"
});
},
error: (error) => {
console.log("sumthing happen ):");
}
});
console.log('done');
} And in the html i just add a section: <section id="myMapForTest"></section> I will see if the other esri elements like query , querytask , featurelayer , etc works like that.
... View more
03-09-2016
07:34 AM
|
0
|
0
|
2863
|
|
POST
|
Hi, I am a little bit confused in how to integrate the arcgis api in my project. I want to make a query to a servicelayer after the sucess ajax response, but i dont know how to integrate the api. I am using react and reactdom, node, webpack, gulp, and I already installed the api in the server with the instructions provided by esri. Can somebody guides me providing any example? Thanks in advice My working directory is: The code in my main.js file is: import React from 'react';
import ReactDOM from 'react-dom';
function genericLogin(genericAccount, username, password){
var url = "myarcgis/arcgis/tokens/generateToken";
console.log(genericAccount);
console.log(username, password);
//Part 1, accessing with a generic account to get the token
jQuery.ajax({
type: 'POST',
url: url,
data: {
username: genericAccount.username,
password: genericAccount.password,
client: genericAccount.client,
format: 'json'
},
success: (success) => {
//Part 2: when u get the token, make a query to the service layer and see if the user who tries to log in has access , if has it - >go to the next page.
console.log("Success : The generic account is working, verifying the user permissions... " );
console.log(success);
},
error: (error) => {
console.log("Error : The main account is having some issue, please notify to the administrator ");
}
});
console.log('done');
}
class LoginApp extends React.Component {
constructor(){
super();
this.onClick = this.onClick.bind(this);
}
onClick(){
var genericAccount = {
username: 'myusername',
password:'mypass',
client: 'requestip'
};
var userValue = this.refs.username.value;
var passValue = this.refs.password.value;
genericLogin(genericAccount, userValue, passValue);
}
render(){
return (
<div className="wrapper">
<img className="logo" src="images/mylogo.png" />
<div className="login">
<input className="login__input" ref="username" type="text" />
<input className="login__input" ref="password" type="password" />
<input className="login__submit" type="submit" onClick={this.onClick} />
</div>
<div className="footer">
<img className="image-chq" src="images/chq_i.png" />
<p className="footer__p">some info</p>
<p className="footer__p">more info</p>
<h6 className="footer__h6">address</h6>
</div>
</div>
);
}
}
ReactDOM.render(<LoginApp />, document.getElementById('myLogin')); My index.html <!DOCTYPE HTML> <html lang="es"> <head> <meta charset="utf-8"> <title>React JSAPI</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> <link rel="stylesheet" type="text/css" href="arcgis_js_api/library/3.16/3.16/dijit/themes/tundra/tundra.css"/> <link rel="stylesheet" type="text/css" href="arcgis_js_api/library/3.16/3.16/esri/css/esri.css" /> <link rel="stylesheet" type="text/css" href="css/login.css"/> </head> <body> <section id="myLogin"></section> <script type="text/javascript" src="arcgis_js_api/library/3.16/3.16/init.js"></script> <script src="static/js/vendor/jquery-2.2.1.min.js"></script> <script src="bundle.js"></script> </body> </html>
... View more
03-09-2016
05:58 AM
|
0
|
5
|
5355
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-21-2017 02:09 PM | |
| 1 | 04-10-2015 07:52 AM | |
| 1 | 03-23-2016 02:08 PM | |
| 1 | 02-22-2016 05:01 AM | |
| 1 | 10-09-2018 07:10 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-01-2024
03:05 AM
|