Friday, September 20, 2019

How to use FeatureLayer in ArcGIS API for JavaScript 3.x

In this post we will explain how to use FeatureLayer class in ArcGIS API for JavaScript.

applies to 3.x API
First we need to include (Map, FeatureLayer) classes from the API


require([
  "esri/map",
  "esri/layers/FeatureLayer",
  "dojo/ready",
], function(Map, FeatureLayer, ready) {

  ready(function(){
    // Put your code in this block.
  });
});

Also note that we used the ready class from dojo in order to run our code after the page is fully loaded.

Now we need to create a new object of type FeatureLayer. We do that in the "ready" function as follows:
ready(function(){
    var feature_layer = new FeatureLayer();
});

To properly creating an object of FeatureLayer, we need to pass some properties to its constructor
ready(function(){
  var feature_layer = new FeatureLayer(
    url_to_feature_layer
    , {
      mode: FeatureLayer.MODE_ONDEMAND,
      outFields: ["*"],
      visible: true,
      id: "id_inside_map"
    }
  );
});

Let us explain the properties:
  • url_to_feature_layer : The url of the FeatureLayer for example this is a URL from ESR:
    https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Prominent_Peaks_attach/FeatureServer/0
  • mode: The mode to load features:
    MODE_ONDEMAND: Loads features when you pan to the extent in which they exist or when you zoom to the level in which the layer is visible.
    MODE_SNAPSHOT: The features will be loaded once the layer is added to the map.
    MODE_SELECTION: The feature will be loaded once it is selected using the "selectFeatures" method.
    MODE_AUTO: The mode will be selected automatically depending on the number of features and the number of vertices in the features.
  • visible: Determines if the layer is visible in the map or not (the default value is true).
  • id: The ID of the layer in the map, this helps you to retrieve the layer from the map in a user friendly name.
 Now we need to add the FeatureLayer to the map:
ready(function(){
  var feature_layer = new FeatureLayer(
    url_to_feature_layer
    , {
      mode: FeatureLayer.MODE_ONDEMAND,
      outFields: ["*"],
      visible: true,
      id: "id_inside_map"
    }
  );
 map.addLayer(feature_layer);
});

Thanks for reading my tutorial, please do not hesitate to ask any question in the comments.

Wednesday, May 29, 2019

تنصيب برنامج XAMPP

بسم الله الرحمن الرحيم

سوف نقو بشرح مبسط  لطريقة تنسيب برنامج XAMPP و هو عبارة عن حزمة تحتوي على سيرفر Apache و سيرفر MySQL و برنامج phpMyAdmin.

أولا نقوم بتنزيل البرنامج من موقعه الرسمي:


الآن نقوم بفتح البرنامج كمسؤول:
سوف تظهر الشاشة التالية:


نقوم بالضغط على زر Next لتظهر النافذة التالية:


من المربع رقم 1 نقوم باختيار الميزات التي نريد تنصيبها على الجهاز و في حالتنا هذه نريد فقط Apache و MySQL.
نضغط Next لتظهر الشاشة التالية:


في البند (1) نقوم باختيار مسار المجلد الذي نريد تنصيب البرنامج بداخله. سوف نترك القيمة الافتراضية كما هي.
ثم نضغط على زر Next لتظهر الشاشة التالية:


نقوم بإلغاء تفعل الخيار كما هو موضح في البند (1) و من ثم نضغط على زر Next لتظهر لنا الشاشة التالية:


سيتم الآن البدء بتنصيب XAMPP فقط اضغط على زر Next لتبدأ عملية التنصيب:





Tuesday, May 21, 2019

Create Geodatabase Version in ArcGIS and ArcMap

To create a Geodatabsae Version we open ArcCatalog window from ArcMap and then go to our Enterprise Geodatabase Connection and right click on it and then choose as follows:
Administration --> Administer Geodatabase
As shown in the following image:

ArcGIS Geodabase Version Access Level

In this post we will explain the access level of geodatabase version.
The following table show in short and comprehensive way what each access level allows the owner of the version to do and what other users can do:


Version Owner Other Users
Public View, Edit View, Edit
Protected View, Edit View
Private View, Edit No Access

Friday, May 10, 2019

Create ArcGIS Enterprise Geodatabase in Oracle 11g R2

In this tutorial I am going to explain in short and easy way how to create an enterprise geodatabase in Oracle 11g R2 with ArcMap.

First we need to have Oracle 11g R2 installed (click here for how to install oracle 11g R2).

After having Oracle 11g R2 installed, we will open the "Create Enterprise Geodatabase" tool from ArcCatalog window from the following path:
Toolboxes --> Data Management Tools --> Geodatabase Administration --> Create Enterprise Geodatabase

The tool will appear as in the following image:

The options are explained as following:
  1. Database Platform : is the type of the database we are using, which in our case is Oracle.
  2. Instance : the address to the database we are using.
  3. Database Administrator Password : is the password of the user "SYS".
  4. Geodatabase Administrator Password : the password of the user who is going to administer the whole geodatabase.
  5. Authorization File : browse to select the keycodes file that you get from you installation of ArcGIS for Server. (How to Make a "keycodes" File)".
After setting all options, press "OK" (step 7) to start the process of creating a new enterprise geodatabase in Oracle 11g R2.

The tool will check if the "SYS" user has enough privileges to create the enterprise geodatabase or not as shown in the folling picture:

After that wait till the process finishes and you get the following screen:




Congratulations, you have just created a new enterprise geodatabase in Oracle 11g R2.

Saturday, May 9, 2015

How to Resize Raspbian Image

In this tutorial I am going to explain how te resize a raspbian image so it can be used in QEMU.
I faced the problem of having no space in to install extra packages on raspbian like Qt, so I decided to increase the space of the Raspbian image to 8 GB.
After a lost of search and testings, I discovered the best way to increase the size of raspbian to 8 GB or less or more. You can resize to any size, but make sure it is more than 3 GB; because Raspbian itself requires about 2.5 GB.

Friday, May 1, 2015

Modelio refuse to start and complains about GTK+

Modelio refuse to start and show me

Gtk-WARNING **: This process is currently running setuid or setgid.
This is not a supported use of GTK+. You must create a helper
program instead. For further details, see:

http://www.gtk.org/setuid.html

Refusing to initialize GTK+.

Wednesday, March 18, 2015

Instaling and Configuring VNC Server on CentOS 7 and Fedora 20

Introduction:

VNC Server gives you a good way and reliable way to run desktop environment on your server so you can have GUI control over your server just as you would use your local computer.
This tutorial is split into two parts, first installing VNC server, the second in configuring VNC server.

Why VNC:
  • More reliable than ssh graphics and RDP.
  • Using GUI tools to control your server.
  • Allows you to share clipboard between your local computer and the remote server.
  • You can use and host that have VNC client to control your server.

Friday, August 1, 2014

Zombie Processes Explained

What is zombie process?

Zombie process (of defunct as named in some systems) is a process that its execution finished and the system for some reason cannot get its return value in order to clean it from processes table. That is a zombie process is just a record in the process table in the system and not a process that is under execution.

What causes zombie process?

Take this scenario of how process can turn into a zombie:
  1. A process forks a child process.
  2. The child process finish its execution and waits to report its exit status to its parent process.
  3. But the parent process is busy in processing another child process exit status, or it is poorly programmed so it do not response to children when they finish their execution (we will look at how to handle children that their execution is finished).
  4. The system keeps the child -that its exit status is not handled by its parent- in process table in case of its parent executes wait() to get its exit status.
  5. The zombie will stay in the process table until its exit status is handled by its parent or its parent terminates.
  6. When the parent of a zombie is terminated normally its zombies are deleted from the process table.
  7. If the parent is abnormally terminated its zombies are inherited by the process id 1 ( ie init ) which periodically initiate wait() and removes zombies.

Sunday, May 18, 2014

the ordinal 459 could not be located in the dynamic link library urlmon.dll

Many of us faced the following problem after updating Windows

the ordinal 459 could not be located in the dynamic link library urlmon.dll

Wednesday, June 19, 2013

How to Install cpupower Package on Fedora

Fedora does not define cpupower as a separate package, instead it includes it in the package kernel-tools.
So just install kernel-tools and you will get cupower.

# sudo yum install kernel-tools

Wednesday, January 30, 2013

How to Change User Password at Command Prompt



How to use the net user command to change the user password at a Windows command prompt. Only administrators can change domain passwords at the Windows command prompt. To change a user's password at the command prompt, log on as an administrator and type: "net user * /domain" (without the quotation marks)

Sunday, January 20, 2013

Convert an int to QString in Qt

Hi,
Today I will show you how to convert an int type to a QString type in Qt.

Here are the steps: