New sample : GeoIP + ArcGIS – Where Am I

New sample shows how to use the free GeoIP service to find the location and show the lat/lon of the visitor on a map. Here is the link to the sample : http://sathyaprasad.appspot.com/geoip.html

If you go to my homepage http://sathyaprasad.appspot.com you can see how I have used the smaller version of the sample inside of a page using an iframe to locate the website visitors. Feel free to copy the code and use it in your site.

New sample – OpenLayers API + ArcGIS Services

Posted a new sample showing how to consume ArGIS Services (dynamic and cached) using OpenLayers API.

Check it out: http://sathyaprasad.appspot.com/openlayers.html

Here’s a wierd one – Address already in use

Today I encounterd a strange error-

I started the ArcGIS Manager Service to use the Restful Services Directory and to my surprise it did not work. I have installed ArcGIS Server 9.3.1 for a few weeks now and was working fine.

I tried the following url’s:

http://localhost:8399/arcgis/rest – restful services direcoty – did not work

http://localhost:8399/arcgis/services?wsdl – services catalog soap end point – did not work

http://localhost:8399 – directory listing of  “C:\Program Files\ArcGIS\java\web_output” – did not work Read the rest of this entry »

Installing and running the Custom Rest Service – Mapservice legends sample

I recently saw that there has been lots of discussion on the custom rest service legend sample posted on the code gallery in terms of getting the sample up and running successfully. If you have no clue on what I am talking about, here is the link.

This post should help you get the sample running in no time (almost):

I am using Eclipse (screen-shots show version 3.4/Ganymede, 3.3/Europa should work as well) as my IDE and ArcGIS Server 9.3.1 Java ADF libraries.

1. Download the sample on to the disk:

sample

Read the rest of this entry »

Devsummit 2009 Demo – infoTips posted on code gallery for download

Just posted a new sample on code gallery. This sample was demoed in the devsummit 2009 session and as promised I have upload a zip file with samples, documentation and source file.

Here are quick links to the sample :

Resource Center – Code Gallery Post

View it live link

Rate the sample and post any comments directly at that site or here in my blog. Based on the comments I will add more functionality to the infoTip class.

Working with esri.graphics

Few common scenarios when you are working with the graphics layer (@ version 1.3) in the ArcGIS Server JS API

1. map.graphics returns the graphics layer
2. map.graphics.graphics returns the array of graphic elements (geometry, symbol, attribute, infotemplate) added to the graphics layer

To remove all graphic elements in the graphic layer
map.graphics.clear();

To show/hide specific graphic element
map.graphics.graphics[index].show();
map.graphics.graphics[index].hide();

To check if any specific graphic element is being shown or not:
// 'none' is hidden and 'block' is visible
map.graphics.graphics[index].getDojoShape().rawNode.style.display

Loop through all the graphic elements
var graphics = map.graphics.graphics;
for (var i=0; i< graphics.length; i++)
{
// do something with graphics[i]
}

even better


dojo.forEach(map.graphics.graphics, "console.log(item.getDojoShape().rawNode.style.display)");
//or
dojo.forEach(map.graphics.graphics, "console.log(item,index,array)");
//or
dojo.forEach(map.graphics.graphics, function(item){//item is a graphic element });

Note: @version 1.4 you will have ability to add multiple graphics layers (in addition to the default graphics layer) and can control the stack order (z-index).

Ready to use Sample layouts using Dojo

Just posted a blog entry on the ArcGIS Server Blog. Check it out.

Blog talks about how to use Dojo Dijits – BorderContainer (dijit.layout.BorderContainer) and ContentPane (dijit.layout.ContentPane) to design your layouts for application. I have created a bunch of sample layouts with most of the commonly used layouts, check out the links below.

You an try the live sample at: http://serverapps.esri.com/templates/index.html

You can download the samples at: Resource Center Code Gallery