|
POST
|
is there any tutorial in how to set up a enviroment for working react js with arcgis api for beginners? It will be useful for who is starting to develop webapps. I really like the 4.0 View Models in ReactJS example. Thanks in advice
... View more
03-07-2016
04:29 AM
|
0
|
0
|
1442
|
|
POST
|
Put the css style that can be tundra or claro, and make sure ur body class has the "claro" or "tundra" property.
... View more
03-01-2016
12:03 PM
|
0
|
0
|
593
|
|
POST
|
Yes, but if you just move a little bit the featurelayer where u add the feature it automatically refreshes. The logic that i was doing was: Getting the info from featurelayerA (graphic included) then, modify the info locally and add it to another featurelayerB with the same graphic feature just saved. (Cuz i dont want to modify the info from featurelayerA). Anyways. Really thanks for your reply, it helped me a lot to figure out what i was doing wrong, or maybe not?
... View more
03-01-2016
04:59 AM
|
0
|
1
|
2390
|
|
POST
|
Ok, i finally got the problem. It is actually adding things on the service, but for some configuration that i had on the table it didnt show. The code is working and its the following: on(map,"click",function(e){
var extentGeom = pointToExtent(map,e.mapPoint,10)
var url = "...FeatureServer/1";
var queryTask = new QueryTask(url);
var query = new Query();
query.where = "COMUNA='PANQUEHUE'";
query.returnGeometry=true;
query.outFields = ["*"];
query.token=token;
query.geometry = extentGeom;
queryTask.execute(query,obtenerDatos);
function obtenerDatos(featureSet){
for (var i = 0; i < featureSet.features.length; i++) {
document.getElementById('id_Luminaria').value = featureSet.features[0].attributes['ID_LUMINARIA'];
document.getElementById('tipo_Observaciones').value = featureSet.features[0].attributes['OBSERVACION'];
document.getElementById('tipo_comuna').value = featureSet.features[0].attributes['COMUNA'];
myGraphic = featureSet.features[0].geometry;
console.log(featureSet.features);
}
}
});
on(actualizar, "click", function(click){
//console.log("clickeando");
var myAttributes = {
id_luminaria: parseInt(document.getElementById('id_Luminaria').value),
Comuna: document.getElementById('tipo_comuna').value,
/*id_nodo: document.getElementById('id_Nodo').value,
tipo_cnx: document.getElementById('tipo_Conexion').value,
tipo: document.getElementById('tipo_Lampara').value,
potencia: document.getElementById('tipo_Potencia').value,
propiedad: document.getElementById('tipo_Propiedad').value,
rotulo: document.getElementById('id_Rotulo').value,
*/
obs: document.getElementById('tipo_Observaciones').value,
eliminar: 'modificar',
corregido: 'revisar'
};
//console.log(myAttributes.obs);
var features = [];
var graphic = new Graphic(myGraphic);
graphic.setAttributes(myAttributes);
features.push(graphic);
// var myAttributesGraphic = new Graphic(myGraphic,null,myAttributes);
// console.log(features);
myLayer.applyEdits(features,null,null,function(adds){
console.log("its adding");
console.log(adds);
},function error(err){
console.log("Theres an error" + err);
});
});
... View more
02-29-2016
06:40 AM
|
0
|
0
|
2390
|
|
POST
|
var myLayer = new FeatureLayer("…/FeatureServer/0"); myLayer.setDefinitionExpression("COMUNA='PANQUEHUE'"); //map.addLayer(myLayer); var myLayerLum = new FeatureLayer("../1"); myLayerLum.setDefinitionExpression("COMUNA='PANQUEHUE'"); map.addLayer(myLayerLum); function pointToExtent(map, point,toleranceInPixel) { //calculate map coords represented per pixel var pixelWidth = map.extent.getWidth() / map.width; //calculate map coords for tolerance in pixel var toleraceInMapCoords = toleranceInPixel * pixelWidth; //calculate & return computed extent return new Extent( point.x - toleraceInMapCoords, point.y - toleraceInMapCoords, point.x + toleraceInMapCoords, point.y + toleraceInMapCoords, map.spatialReference ); } on(map,"click",function(e){ var extentGeom = pointToExtent(map,e.mapPoint,10) var url = "../1"; var queryTask = new QueryTask(url); var query = new Query(); query.where = "COMUNA='PANQUEHUE'"; query.returnGeometry=true; query.outFields = ["*"]; query.token=token; query.geometry = extentGeom; queryTask.execute(query,obtenerDatos); function obtenerDatos(featureSet){ for (var i = 0; i < featureSet.features.length; i++) { document.getElementById('id_Luminaria').value = featureSet.features[0].attributes['ID_LUMINARIA']; document.getElementById('tipo_Observaciones').value = featureSet.features[0].attributes['OBSERVACION']; myGraphic = new Graphic(featureSet.features[0].geometry, null,null); console.log(myGraphic); } } }); on(actualizar, "click", function(click){ //console.log("clickeando"); var myAttributes = { id_luminaria: document.getElementById('id_Luminaria').value, id_nodo: document.getElementById('id_Nodo').value, tipo_cnx: document.getElementById('tipo_Conexion').value, tipo: document.getElementById('tipo_Lampara').value, potencia: document.getElementById('tipo_Potencia').value, propiedad: document.getElementById('tipo_Propiedad').value, obs: document.getElementById('tipo_Observaciones').value, rotulo: document.getElementById('id_Rotulo').value, eliminar: 'modificar', corregido: 'revisar' }; //console.log(myAttributes.obs); var myAttributesGraphic = new Graphic(myGraphic.geometry,null,myAttributes); var agregar = ; myLayer.applyEdits(agregar,null,null,function(adds,updates,deletes){ console.log("Está agregando " + adds); },function error(err){ console.log("Hay un error" + err); }); }); Enviado desde Correo de Windows De: Tom Sellsted Enviado el: viernes, 26 de febrero de 2016 21:00 Para: Evelyn Elena Hernández Riquelme GeoNet Applyedits bug? reply from Tom Sellsted in ArcGIS API for JavaScript - View the full discussion Evelyn, Could you share more of your code? This would enable me to see where the geometry might be that you would want to use. Here is some sample code that I use to applyEdits to some feature layers containing points and lines. There are separate functions that handle the success or error when using the applyEdits. My personal preference, I think it is easier to read. function addNewLSP(evt) { // update lines and points pointFeatureLayer.applyEdits(, null, null, pointsUpdated, errorOnUpdate); lineFeatureLayer.applyEdits(, null, null, linesUpdated, errorOnUpdate); } function pointsUpdated(evt) { alert("Points added"); } function linesUpdated(evt) { alert("Lines added"); } function errorOnUpdate(evt) { alert("Error updating Live, Shop and Play"); } I hope this will help you! Best Regards, Tom Reply to this message by replying to this email, or go to the message on GeoNet Start a new discussion in ArcGIS API for JavaScript by email or at GeoNet Following Applyedits bug? in these streams: Inbox This email was sent by GeoNet because you are a registered user. You may unsubscribe instantly from GeoNet, or adjust email frequency in your email preferences
... View more
02-26-2016
04:06 PM
|
0
|
1
|
2390
|
|
POST
|
Actually no. But is there any example on how to do it propertly? TY Enviado desde Correo de Windows De: Tom Sellsted Enviado el: viernes, 26 de febrero de 2016 14:55 Para: Evelyn Elena Hernández Riquelme GeoNet Applyedits bug? reply from Tom Sellsted in ArcGIS API for JavaScript - View the full discussion Evelyn, Was it your intention to have no geometry for your added graphic? Your sample above sets the geometry to null, perhaps that is the problem? Regards, Tom Reply to this message by replying to this email, or go to the message on GeoNet Start a new discussion in ArcGIS API for JavaScript by email or at GeoNet Following Applyedits bug? in these streams: Inbox This email was sent by GeoNet because you are a registered user. You may unsubscribe instantly from GeoNet, or adjust email frequency in your email preferences
... View more
02-26-2016
01:42 PM
|
0
|
3
|
2390
|
|
POST
|
Hello there, Im trying to add a new feature in my applyedits but when i get the response it says success. If i look at the service , it doesnt add the new feature. What im doing wrong? Here is my code: on(updatebtn, "click", function(click){ var myAttributes = { id_luminaria: document.getElementById('id_Luminaria').value, id_nodo: document.getElementById('id_Nodo').value, tipo_cnx: document.getElementById('tipo_Conexion').value, tipo: document.getElementById('tipo_Lampara').value, potencia: document.getElementById('tipo_Potencia').value, propiedad: document.getElementById('tipo_Propiedad').value, obs: document.getElementById('tipo_Observaciones').value, rotulo: document.getElementById('id_Rotulo').value, eliminar: 'modificar', corregido: 'revisar' }; var myAttributesGraphic = new Graphic(null,null,myAttributes); myLayer.applyEdits([myAttributesGraphic],null,null,function(adds,updates,deletes){ console.log("its adding " + agrega); },function error(err){ console.log("there is an error" + err); }); });
... View more
02-26-2016
08:51 AM
|
0
|
9
|
4161
|
|
POST
|
Here my function for that. I hope this helps. function validate() {
var username = 'YOUR USERNAME';
var password = 'YOUR PASS';
var http = new XMLHttpRequest();
var url = "YOUR TOKEN URL";
var str1 = "username=";
var str2 = "&password=";
var str3 = "&f=json&client=requestip&expiration=1440";
var params = str1.concat(username, str2, password, str3);
//f="json", client="requestip", expiration="1440"
http.open("POST", url, true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function () {
if (http.readyState == 4 && http.status == 200) {
var tokenResponse = http.responseText;
token=JSON.parse(tokenResponse);
if (tokenResponse.search("error") == -1) {
esri.id.registerToken(
{server: 'YOUR REST SERVICE',
userId: 'YOUR EXAMPLE USER',
token: token.token,
expires: token.expires,
ssl: false
});
//DO SOMETHING
.....
} else {
alert("Incorrect Login, try again.");
}
}
};
http.send(params);
return false;
}
... View more
02-25-2016
12:41 PM
|
0
|
0
|
889
|
|
POST
|
I cannot go there 😞 but i will like to know more about this new technology, cuz i'm starting to learn about the website development and it has been hard for me to understand.
... View more
02-24-2016
09:41 AM
|
0
|
0
|
1442
|
|
POST
|
Hello. Is there any example on how to integrate React JS with the ArcGIS API for JS(tutorials, docs, etc)? I have been seeing some react tutorials but i still dont understand if i can integrate the arcgis api with a react js website.
... View more
02-24-2016
08:59 AM
|
0
|
4
|
8240
|
|
POST
|
Hello, This is my build.grande file for the module app. I hope this help u, cuz also i had the same problem trying to understand how to put everything in that file. apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "mynameapp" minSdkVersion 19 targetSdkVersion 23 versionCode 1 versionName "1.0" } packagingOptions { exclude 'META-INF/LGPL2.1' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' exclude 'LICENSE.txt' } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.esri.arcgis.android:arcgis-android:10.2.7' compile 'com.android.support:design:23.1.1' } repositories { jcenter() maven{ url 'https://esri.bintray.com/arcgis' } }
... View more
02-22-2016
05:01 AM
|
1
|
0
|
1493
|
|
POST
|
Hello, Im developing an app that works with a secured rest service for loading layers and base maps. My 2 Views are: 1.- activity_login: allows to access to the other view (map_activity) using token auth. if the credential given is correct change to the next activity. charge the modules associated to the account. (A list of modules in could be another view or something similar) preload the layers to be used in the activity_map. else shows a toast saying that ur credential is wrong or another error type. 2.- activity_map: where all the layers and map and another stuff is loaded and u are authenticated to see them. Im having problems on the logic i think now. My code for login activity is: public class Login extends AppCompatActivity{
private Button btnIngresar;
private EditText txtUsuario;
private EditText txtPassword;
public MapView myMapView;
// public map classMapa = new map();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
//getting object references:
txtUsuario = (EditText)findViewById(R.id.TxtNombre);
txtPassword = (EditText)findViewById(R.id.TxtPassword);
btnIngresar = (Button)findViewById(R.id.btnIngreso);
//getting values for arcgis services
final String urlToken = this.getResources().getString(R.string.webToken);
final String urlChq006 = this.getResources().getString(R.string.webChilquinta006);
//getting values for toasts
final String toLoginIncorrecto = this.getResources().getString(R.string.toastLoginIncorrecto);
btnIngresar.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
//Login with static credentials
/*
if(txtUsuario.getText().toString().equals("evelyn") && txtPassword.getText().toString().equals("asdf")){
Intent intent = new Intent(Login.this,map.class);
startActivity(intent);
}else{
Toast.makeText(Login.this,"Login Incorrecto",Toast.LENGTH_SHORT).show();
}
*/
//Login with token credentials
//Set map and options
myMapView = (MapView) findViewById(R.id.mimapa);
//Set color de fondo mapa base
myMapView.setMapBackground(0xffffff, 0xffffff, 10, 10);
//Ingresando con credenciales
final UserCredentials credencial = new UserCredentials();
credencial.setUserAccount(txtUsuario.getText().toString(), txtPassword.getText().toString());
credencial.setTokenServiceUrl(urlToken);
final ArcGISDynamicMapServiceLayer layer = new ArcGISDynamicMapServiceLayer(urlChq006,null,credencial);
myMapView.addLayer(layer);
//Cabios en el mapa
myMapView.setOnStatusChangedListener(new OnStatusChangedListener() {
@Override
public void onStatusChanged(Object o, STATUS status) {
if (STATUS.LAYER_LOADED == status) {
Toast.makeText(Login.this, "Logueando...", Toast.LENGTH_SHORT).show();
//Cambiando al mapa
Intent intent = new Intent(Login.this, map.class);
startActivity(intent);
}
if (status == STATUS.LAYER_LOADING_FAILED) {
// Check if a layer is failed to be loaded due to security
if ((status.getError()) instanceof EsriSecurityException) {
EsriSecurityException securityEx = (EsriSecurityException) status
.getError();
if (securityEx.getCode() == EsriSecurityException.AUTHENTICATION_FAILED)
Toast.makeText(myMapView.getContext(),
"Authentication Failed! Resubmit!",
Toast.LENGTH_SHORT).show();
else if (securityEx.getCode() == EsriSecurityException.TOKEN_INVALID)
Toast.makeText(myMapView.getContext(),
"Invalid Token! Resubmit!",
Toast.LENGTH_SHORT).show();
else if (securityEx.getCode() == EsriSecurityException.TOKEN_SERVICE_NOT_FOUND)
Toast.makeText(myMapView.getContext(),
"Token Service Not Found! Resubmit!",
Toast.LENGTH_SHORT).show();
else if (securityEx.getCode() == EsriSecurityException.UNTRUSTED_SERVER_CERTIFICATE)
Toast.makeText(myMapView.getContext(),
"Untrusted Host! Resubmit!",
Toast.LENGTH_SHORT).show();
if (o instanceof ArcGISFeatureLayer) {
// Set user credential through username and password
credencial.setUserAccount(txtUsuario.getText().toString(), txtPassword.getText().toString());
layer.reinitializeLayer(credencial);
}
}
}
}
});
}
});
}
} My map class just have the following: public class map extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content_map); } } for XML files i have the map in activity_map.xml i have the login (button, edittexts and etc in the activity_login) The error that i have is with the map.
... View more
02-19-2016
08:51 AM
|
0
|
1
|
2926
|
|
POST
|
Im here again. I have the following, what am i doing wrong? 1.- I put the api in this directory: C:\inetpub\wwwroot\arcgis_js_api 2.- I edited both [PATH] (the dojo and init js in this way: baseUrl:(location.protocol === 'file:' ? 'http:' : location.protocol) + '//' + "[localhost/arcgis_js_api/library/3.15/3.15]dojo" 3.- When i try to access to the init.js for the next step it gives me an error: Error HTTP 403.14 - Forbidden
... View more
02-11-2016
09:23 AM
|
0
|
2
|
1136
|
|
POST
|
Hello. Im trying to make something like windows 10 with a div. When u click in the start up button, u will se a panel where u can choose icons. Like this pic but with the map behind of that div. is there any idea how to do this? i left the code here. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="appCHQ">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Aplicacion de Prueba </title>
<link rel="stylesheet" href="css/personalizado.css" />
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/esri.css" rel="stylesheet" type="text/css">
</head>
<body class="bodyCustom">
<div class="container pg-empty-placeholder mainCont">
<div class="row contNav" data-pg-collapsed>
<button data-toggle="collapse" data-target="#demo">Collapsible</button>
</div>
<div class="row contMap" id="divmapa" data-pg-collapsed>
<div class="container" id="map" data-pg-collapsed></div>
</div>
<div class="row collapse widgets" id="demo">asdasdasd</div>
</div>
<script src="https://js.arcgis.com/3.15/"></script>
<script src="js/libs/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="js/map.js"></script>
</body>
</html> Thanks for the answer!
... View more
01-06-2016
12:51 PM
|
0
|
1
|
3247
|
|
POST
|
I will try it later, but i remember that i did what u suggest some days ago and for some reason it doesnt work to me 😧 Thanks, if anything goes wrong i will reply this post
... View more
01-05-2016
07:09 AM
|
0
|
0
|
3810
|
| 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
|