Wednesday, April 2, 2014

PostgreSQL Libraries for ARCGIS Server (Register Database with ArcGIS server)

PostgreSQL Libraries for ARCGIS Server (Register Database with ArcGIS server)


What correct Libraries to use ??
Well there are four type of client libraries
  1. pg_client_windows64
  2. pg_client_windows86
  3. pg_client_linux64
  4. pg_client_linux86
  1. pg_client_windows64
    This include client files required to make connection from 64 bit windows platform client to PostgreSQL
    libeay32.dll, libintl.dll, libpq.dll, and ssleay32.dl
  2. pg_client_windows86
    This include client files required to make connection from 32 bit windows platform client to PostgreSQL
     libeay32.dll, libiconv-2.dll, libintl-8.dll, libpq.dll, and ssleay32.dll
  3. pg_client_linux64
    This include client files required to make connection from 64 bit linux platform client to PostgreSQL
     libpq.so, libpq.so.5, and libpq.so.5.3.
  4. pg_client_linux32
    This include client files required to make connection from 32 bit linux platform client to PostgreSQL

Required libraries need to be copied to 
C:\Program Files\ArcGIS\Server\bin  

Register Database to ArcGIS server

Register Database to ArcGIS server


While publishing data (from database) to ArcGIS server it gives you a warning that

24011: Data source is not registered with the server and data will be copied to the server

How to resolve this ??
Well there are different approaches, here is the one which i followed. But before doing anything Please Note:
Note: The client side libraries need to be copied to ArcGIS server's bin folder. What does this mean ??
Well you have to copy the libraries (obtained from esri's customer portal Or simply google it "PostgreSQLClientLibs922" Or PostgreSQL libraries for ArcGIS server)
Copy the correct version of libraries to
C:\Program Files\ArcGIS\Server\bin   

Note to see the correct version of libraries click here.

Now,
  • Open ArcGIS server Manager from (prefer Internet Explorer)http://localhost:6080/arcgis/manager/site.html
  • Sign in to your ArcGIS server account
  • On home Page under Directories tab click on Data Store
  • Click on Registered Database


  • Type Name, and click on Import. It'll ask you "The System/PublishingTools service is currently stopped. Click Start Service to start it now and continue with registering a Data Store". Click on start service
  • It'll then ask you "Select the connection file (.sde or .odc file) you want to import."
  • Browse to Select the connection.sde file. 
  • Where you can find .sde file ??
  • Open Arc Catalog and then right click your database connection file and click on properties under DATA BASE CONNECTIONS in Arc Catalog tree.
  • There you will find the path of your connection file.

  • Now using this path browse to select the connection .sde file for both the Publisher Database connection and server database connection (Mostly its the same)

Upon successful import you'll see this 

Click on Validate All and the question mark will be removed.















Saturday, March 29, 2014

Error while starting AppServer. Required port '4000' already in use

Error while starting AppServer. Required port '4000' already in use

I faced this error while registering database to ArcGIS server, well this can be resolved by opening 
  1. Control Panel 
  2. System and Security
  3. Administrative Tools
  4. Services
On Services window find the ArcGIS server service and stop it. 
and after few seconds start it or restart it for automatic restart. Then again try and you'll see that error is removed.

Reason for this.

ArcGIS server uses javaw.exe and it got Hang, This was keeping port 4000 busy independently from ArcGIS server. So it said that Error while starting AppServer. Required port '4000' already in use.

Connect Postgresql to ArcGIS

Connect Postgresql to ArcGIS


If you are having problems connecting Postgresql to ArcGIS This post will describe in detail how to connect, Moreover i will post some more things on Postgressql, PostGIS, Arc Catalog, ArcMAP, Arc GIS Server etc

First Install Postgresql and also its spatial Extension (PostGIS). When this is installed we have to instal Postgres client side libraries for the successful connection.

(Note: Be sure to download the correct libraries for your ArcGIS client. For ArcGIS for Desktop and ArcGIS Engine, you need the 32-bit libraries. For ArcGIS for Server, you need the 64-bit client libraries)
Client Side Libraries:
Copy
libeay32.dll
libiconv-2.dll
libintl-8.dll
libpq.dll
ssleay32.dll
from the PostgreSQL folder and put it into the ArcGIS Desktop bin folder




Now Open Arc Catalog,
and click on Database Connections in Catalog Tree and then open Add Data Base Connection



It will open connections window, add the following information
  • Select PostgreSQL from Database Platform
  • Write 127.0.0.1 in Instance window
  • Select the Authentication type, use Database Authentication and write the user name and password in the database,
    Note : The default super user of PostgreSQL may vary as it come with different combinations of softwares i.e
    • If you have downloaded it directly and then installed Apache and phpmyadmin from StackBuilder then username password is
      username : postgres
      password : postgres
    • Where as if you download it from bitnami i.e. WAPP server (Windows + Apache + PostgreSQL + Php) then username password would be
      username : bitnami
      password : bitnami
    •  Or you can always make a super user/ user of your own choice from database or Phpmyadmin.
  • When you enter instance and user name password then on successful connection you should be able to see the list of databases in the Database dropdown menu, here i only have the sample postgis_21_sample database, press ok and You'll have the connection.






Sunday, January 26, 2014

Arc GIS tool Development using Python (.Arcpy) Review, Tips

Arc GIS tool Development using Python (.Arcpy) Review, Tips


If you are new to Arcpy, or new to this ArcGIS tool development using python. This Blog is there for starter tips and contains the help material needed. I am writing this blog as when i was given a task to develop a python toolbox of ArcGIS i badly needed a blog like this. When i searched for the help i found the same results on Google i.e. ESRI help Resources page. They are Good but more detail was needed.

When i Started developing i faced two problems
1. Either i have to make it a .pyt toolbox
2. Or i have to make a .tbx toolbox

Now what are they ??
Well they are the two types of toolbox available in arctoolbox. i.e. i have to make one of these.
I then asked people a review about each and the difference between both of these.
I came to knew about that and i have written it in my previous blog also here.(click here to Open)
So i decided to go for .tbx.
I Read this book for the reference
Pimpler, E. 2013 Programming ArcGIS 10.1 with Python Cookbook.
Packt Publishing.


 
Few Things to Consider:
Python is a language that donot use brackets rather it is based upon indenting. You must be sure about its spacing, as with wrong spacing you would face such errors which will make you angry.

Environment to be used
Selecting Environment of development is based upon individual's ease and proficiency.
However, I used NotePad ++ for writing code and i tested it in ArcGIS through running it. I know some of you will think that if there is a built in utility in ArcGIS for python programming then why i used NotePad++ ?
Well there are certain pros and cons of this utility. I have discussed it in detail here in my previous blog.
you can check that by clicking here.




ArcGIS Python Window or PyScripter ?

ArcGIS Python Window or PyScripter ?

Developing a custom Geo-Processing tool / toolbox, Question arises that what software / environment to use??




Well Coding in Arcgis utility gives the advantage of telling the error at the runtime as you write code, it is good for those who are experts and write complete code in one go, but for starters i recommend using wither Pyscripter, IDLE, NotePad or NotePad++. You can write whole code in this and then check it in ArcGIS. How ?

You can create the toolbox by right clicking in folder where you want your toolbox to be created in Arc Catalog and then choose your required toolbox (pyt or tbx)
(for Difference in pyt and tbx click here)


After Creating the tool right click that and click on add script and Add the Script file which you previously created (Note Pad file containing code and saved as .py)
Now if the script file contains an error it will appear a red mark on tool icon in arc catalog.
Also you can check it by right clicking the tool and clicking Check Syntax It will tell the error and its line number.

Monday, January 20, 2014

Difference between pyt and tbx

Difference between pyt and tbx

.Pyt and .Tbx are the two types of ArcGIS tool box developed in python.


Difference of Both is written below. 
.tbx


  • It is the old version of toolbox.
  • There is a graphical interface for defining parameters 
  • Have to Manually Generate text file, i.e. manually have to write code in a text file and save it as .py format. Well I used NotePadd++ for this.
  • Have to write stand alone script.
.pyt
  • It is the new version of toolbox.
  • Even Parameters are defined by coding. there is a positive and negative side of this, positive side is that for the programmers Control is in your hand Define parameters the way you want. where as for newbies this might be difficult, as this is new version of toolbox so not much resources are there on web.
  • Less limitations are there.
  • Interface coding is done in the same file as part of the whole program.


Note: The upper description is not mentioned by any official website, I have learned this by working with both.