888-898-3404

ROK Blog

My ArcGIS Server Toolbox

Jason Harris - Wednesday, January 19, 2011
Since ROK has become a ArcGIS Server Hosting provider, we are constantly creating cache.  All the time.

I'll hand it to Esri, as they have made the caching process much easier at 10.  I used to have terrible issues with 9.3 crashing on cache creation.  The  new 'Mixed Cache' - which is a blend of png and jpgs - is a welcome addition.  It takes advantage of the jpg small file size and uses png on the edges where it detects transparency.  That was always the downside of of using jps in a big aerial cache - those awful white borders. 

Anyway, so this new Mixed Cache is great and all, but by default, it uses PNG32, which creates monster sized files.  I would have thought that there would be a user config option somewhere, but I have yet to find it.  So, I started to poke around to see how I could do a big giant conversion to changes these PNG32's to PNG8's which have a more reasonable file size.  A quick tweet and and @mapsRus pointed me to their blog that outlined using IrfanView - which makes quick work of batch conversions and modifications to large image collections.  So, just like that, problem solved.  My PNG's are now about one third of the size and look just as good.

So, that brings up the next issue...The 2.x REST based apis all request cached image tiles without the file extension. Previously (1.x apis), they would always include the file extension (.jpg, png, etc) when making these REST requests.  It always puzzled me as to why they would change this, but its quite obvious now.  Your cache can contain multiple image types.  Great, wonderful, but that presented a huge issue for me.  I am a huge fan of storing my cache on the Amazon S3 service - so how will I know what type of file to request? Png or Jpg?  If I upload the cache to S3, and a request comes in for a tile 45678cccc - S3 will deny access because it doesnt exist - 45678cccc.jpg does.  So, before I move my cache to S3, I just need to strip out the file extention.  I used a little util (hundreds of these out there) called RenameMaster.  I was impressed with its speed.  It is wicked fast.  Whew, ok, now I am good to go on S3.

Which leads me to my last little utility....Fast Folder Eraser.  Now I have all these caches that are on my servers taking up space.  What to do?  Ever try to delete a million plus files via windows explorer?  Yeah, its no fun.  To Esri's credit, they have the compact cache now which alleviate the issue of tons of files, but it also doesn't help me when I want to serve my cache from the S3 cloud.  So, make sure to check out that utility.  It can take some time (but still far faster than using windows explorer) to finish, but its impact on the server itself is minimal. 

Happy caching!

ArcGIS Server Security::Token Based Authentication w/ JavaScript API

Jason Harris - Thursday, December 17, 2009

Securing services for ArcGIS Server is not as difficult as one would think. The ArcGIS Server Manager works as a great tool to lock down services, create and manage a security database, and grant permissions for specific services and or folders.


Check back later for screen grabs.

Step 1: Before you lock down your server, you will need to create a database to manage the security.
Log in into the ArcGIS Server Manager and click on the "Security" tab. Then click on "Settings".

The settings window will have a wizard that allows you to connect to a database server. The wizard will then create a new database with the needed tables to store permissions.  As you are going through the wizard, be sure that you check the box that automatically creates a user and role for "Everyone." We will use this later.

Step 2: Create roles and users

Permissions for the services are managed via roles. After you successfully create a role, you can create a new user or add existing users to that role.  Creating users and roles can be done easily via the ArcGIS Server Manager wizard.


Step 3: Lock down your server

Now that you have a database set up, you are ready to lock down your services.
Go back to the "Setting" section of the "Security" tab.
You will see a section that says: "Security for GIS Services is:   Not Enabled". Beside this text is a button that says "Enable"

Note: Once you Enable security, you cannot undo this via the ArcGIS Server manager.  Don't get frightened away yet, you will see in the next step that this is not a big deal.

Step 4: Grant permission for "Everyone" at the root level

Now that your site is locked down, you need to grant permissions to your services.

 The next few steps are going to assume you have some public services and some private services. Even though security is turned on, we want to make sure that our public services remain public, not requiring a username / password.

Click on the "Services" tab.  It should automatically load the "Manage Services" section. If you are not already there, change the "Services In" pulldown value to your root directory. Then Click Manage Folders -> Permissions. At the root level, grant "Everyone" permission by adding the role to the Access List.

Now security is turned on, but all of your services are public.  I recommend this set up for any initial installation of ArcGIS Server. This will allow you to quickly add permissions when needed.

Step 5: Lock down a folder in your ArcGIS Server

Now that all of our sites are public, we want to lock down specific services.

If your services are organized into folders, this can be done easily. Let's assume you have a folder called "Private".  Switch the "Services in" value to your private folder. Then, click Manage Folders - > Permissions.  Add the role you created to this folder. Be sure to remove "Everyone" from the Access list.

Now your services in this folder will require the a username and password that is associated to that role.

Step 6: Access the Secure Folder via REST interface.

If you're developing applications with the ArcGIS Server Javascript API, the REST interface should be your best friend. However after you lock down a folder, you will notice the interface for that folder is gone from your root services directory:
http://<servername>/ArcGIS/rest/services

To access the "Private" folder, simply type in the URL for your secure folder:
http://<servername>/ArcGIS/rest/services/Private

This will open up a login screen. You can now access the folder with a username / password.

Step 7: Using a secure service in your ArcGIS Server JavaScript API application

The following setup will work great if you would like to have a public ArcGIS Server Javascript API application with secure services embeded into the application. As a result, users will not be able to grab your service URLs and use them in their own applications.

To keep this blog from getting to long, we are going to assume you already have a proxy page set up in your application.  If you do not, that probably means 2 things. You are not printing your maps, and you are not receiving data back in IE where the queries are longer than 2000 characters. Here is a link to setting up your proxy: http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp/ags_proxy.htm#webprint

Since we're assuming you already have a proxy set up, the first step is going to be an updating your settings for the proxy in your JavaScript.

The sites are now secure, so you will need to use the proxy page for each request. If you have not done so already, change the "alwaysUseProxy" setting to "true" in your application.
esri.config.defaults.io.alwaysUseProxy = true;
Additionally, change your http references to https for your secure servcies.

Step 8: Token Based Authentication

Token based authentication is used for authorization of ArcGIS Server Services via the JavaScript API.  You have two options:  1. Create a token via the Token generation page. 2. Create a token Dynamically

Option 1. Create a token via the Token generation page
After you turn on security for your ArcGIS Server installation, you will have access to a token generation page. http://<servername/ArcGIS/Tokens/ gettoken.html (You can also get to this page from the REST interface.) Type in a valid user name/password and it will return a token value.  

Change the http reference in the proxy.config to https. Copy  and paste the token into the service url references in your proxy.config file.
Sample from ESRI's Help:
<serverUrl url="https://www.example.com/arcgis/rest/services/MyMapSecureService/MapServer" matchAll="false"token="5fFo4%2fI4Tv8IGSqSYbpUNORRD%2fYxXMSPo6NEHNNGMpt9CMknpXIjEVqYGm3uuQnU" ></serverUrl>

You will notice on the token generation page that by default this token is only good for 10 days. You can change this if needed in the ArcGIS Server Manager. Optionally, you can set up your services as done below.

Option 2. Create a token dynamically:
If you wish to create tokens dynamically, you will need to download a new proxy.ashx page.

We posted a question on ESRI's users forums about this setup. Thang Le from ESRI Support, provided us with the new proxy file. You can download it from the user forums here: 

http://forums.esri.com/Thread.asp?c=158&f=2396&t=297001#926770

After you download the zip file, replace your existing proxy.ashx page with the new one. Then, you will need to update your server url references in your proxy.config file. Change the http reference to https. Add the following new attributes:
dynamicToken="true"
host=""
userName=""
password=""

Jason Harris

ArcGIS Server Training - Charleston, SC

Jason Harris - Wednesday, June 03, 2009

Everyone always asks for an excuse to visit Charleston... well here is your chance! ROK is hosting two ArcGIS Server training classes this August at College of Charleston's GIS Lab.

Administering ArcGIS Server
2 Days (Monday, August 17th and Tuesday, August 18th) $850.00
Training will cover all the steps you need to get ArcGIS Server up and running in your organization. In addition, it will go into some of the more advanced functionality ArcGIS Server has to offer including building optimized map cache and publishing geoprocessing tools to the web. Here is a link to the outline for Administering ArcGIS Server:
http://www.roktech.net/training/Administering.pdf

Developing Applications for ArcGIS Server
2 days (Wednesday, August 19th and Thursday, August 20th) $850.00
Training will give you the tools and knowledge to start developing fast light weight mapping applications that users are now expecting. ArcGIS Server 9.3 offers new APIs that allow developers to get their data on the web in a quick, stylish, and developer friendly interface. We will cover the JavaScript API, Flex API, and briefly discuss the WebADF. On day two of this training, we will set aside time for you to apply the skills you've learned to start creating or continue developing applications for your organization. ROK developers will be there to help you along the way. Here is the link to the outline for Developing Applications for ArcGIS Server:
http://www.roktech.net/training/DevelopingApplications.pdf

For more information or to sign up for a class, please contact training@roktech.net


Jason Harris

Trouble Installing ArcGIS Server 9.3.1

Jason Harris - Sunday, May 03, 2009

Quick note for others that may run into this. Last week, we got the ArcGIS Server 9.3.1 update. I was excited to get this installed and tested after hearing about all of the speed improvements that have been promised. Anyway, long story short, got an error when trying to install.

"due to an error in software restriction policy processing..."

That was the gist of the error. Anyway, looking in event logs, this error appeared:

"The installation of F:\ArcGIS-Windows\ArcGISServerDotNet931.msp is not permitted due to an error in software restriction policy processing. The object cannot be trusted."

Looking that up, I was able to track down this patch from microsoft: http://www.microsoft.com/downloads/details.aspx?FamilyId=8EFFE1D9-7224-4586-BE2B-42C9AE5B9071&displaylang=en

That fixed the problem.


Jason Harris

ArcGIS Server 9.3 WebADF

Jason Harris - Tuesday, June 24, 2008

Today, I installed the Release Candidate of ArcGIS Server 9.3 WebADF for Visual Studio. Unfortunately, I had to completely remove any references to 9.2 from my machine before starting the install.

To start off, I created a standard out of the box application via Visual Studio. The first change I noticed was in the MapResourceManager. There is a new section called LayerDefintions.

The LayerDefinitions section is a very helpful addition. It lets you choose symbology for search and identify results. In addition, it lets you fully customize the attribute table that is returned with the results. By the way, the attribute results are now displayed like map tips for points, lines, and polygons.

Next I wanted to take a look at performance. From a quick test, the application seemed to load faster than 9.2. The page_load event is called on 4 times in the initial startup, which is better than the 6 to 8 times I have seen in 9.2 As the map is loading, a progress bar has been added to map which is much better than waiting on a blank white map.

Here are a few very noticeable changes in the Web Mapping Application: - Task Items are displayed across the top of the map where the standard toolbar used to be. (Visually, I like the change. However, I can see this becoming a problem if you have a lot of tasks or tasks with long names)

- The standard toolbar is now positioned on the right side above the map.

- The ZoomLevel control is now visible even with non-cached maps and is displayed above the map with the Navigation control.

- The overview map has been added to the standard toolbar and can be turned on and off.

- There are zoom to previous and zoom forward extent buttons on the standard toolbar

I am very eager to see how much effort will go into migrating my customized 9.2 applications to 9.3.


Jason Harris

Recent Posts


Tags


Archive

All content © ROK / Website by Hazel Digital Media