Archive for the ‘ArcGIS Server’ Category

ESRI ArcGIS Server Flex API 1.3 Version is released

November 10, 2009

All:

Good to see the ESRI ArcGIS Server Flex 1.3 release. This release has update of nice features.  Especially JSON conversion and styles for infowindow certainly helps a lot.

  • The Short Summary:
    • Support for Flex SDK 3.4. The older 3.0 thru 3.3 are still supported.
    • More styling options for InfoContainer (used by InfoWindow and InfoSymbol).
    • Well-known ID 102100 (WGS_1984_Web_Mercator_Auxiliary_Sphere) is now a supported projection for Web Mercator-based overlays (including Bing Maps). It is also used in WebMercatorUtil for projecting coordinates between geographic and Web Mercator.
    • Miscellaneous API improvements and bug fixes.
  • Changes:
    • The parameters when creating a PictureFillSymbol have changed.
    • Outline is now the default property of the PictureFillSymbol.
    • The MapImage property on the GeoprocessorEvent has been removed since it was never used.
    • The Extent.intersects() method now accepts any geometry as argument (not just another extent).
    • The TRUE_SHAPE_WITH_MEASURE constant on the NAOutputLine has been removed since it is not supported on the server.
    • For line symbols, non-solid styles are now faster than before (though solid lines are still faster than non-solid).
    • It’s now possible to pan and use rubberband zoom even while draw toolbar is active.
    • The Web Mercator WKID has changed from 102113 (WGS_1984_Web_Mercator) to 102100 “WGS_1984_Web_Mercator_Auxiliary_Sphere” for VETiledLayer and WebMercatorUtil.
  • New event class:
  • New methods:
    • convertToJSON in FeatureSet to convert a FeatureSet into JSON.
    • convertFromJSON in FeatureSet to create a FeatureSet from JSON.
    • update in MapPoint.
    • getPoint and setPoint in Multipoint.
    • contains, insertPoint, removePoint and setPoint in Polygon.
    • insertPoint, removePoint and setPoint in Polyline.
  • New properties:
    • minScale, maxScale and isInScaleRange on Layer.
    • panDuration and zoomDuration on Map. The default has been changed from 500 to 300 milliseconds for faster panning and zooming.
    • infoWindowContent on Map allows you to specify the info window content inline.
    • xscale and yscale on PictureFillSymbol.
  • New styles:
    • borderAlpha, borderColor, borderThickness, infoPlacementMode, shadowAlpha, shadowAngle, shadowColor and shadowDistance on InfoContainer.
  • New and updated samples:
  • Bug fixes:
    • RouteTask now sends correct accumulateAttributes, impedanceAttribute, restrictionAttributes and directionsTimeAttribute values.
    • ArcIMSLayer no longer throws runtime errors for non-existing services.
    • GraphicUtil.getGraphicsExtent() no longer updates the extent of the first graphic with the outputExtent. <!–
    • CR124,639GPFeatureRecordSetLayer now always handles MapImage responses correctly.
    • –>

    • PictureMarkerSymbol now resizes correctly even if width and/or height is set before setting the source.

Generally all versions of ArcGIS API for Flex will work with any version of ArcGIS Server 9.3 and above. However, for certain functionality you need to use specific versions. For example, for routing, use ArcGIS API for Flex 1.2 (or later) and ArcGIS Server 9.3.1 (or later). See the API Reference for more details.

ArcGIS Web ADF, JavaScript, and REST

September 25, 2009

Repost from Rex Blog

Currently the Web ADF does not include an ArcGIS Server data source that supports consuming ArcGIS Server services via REST. Instead, the pre-packaged ArcGIS Server Internet data source uses the SOAP API to consume ArcGIS Server services. From a platform perspective, this makes sense because the Web ADF is founded in a rich, server-side ASP.NET development environment where SOAP provides some clear benefits. Let’s look at this topic in more detail…

REST is a lightweight, non-standard format which can be used to request data over HTTP. REST is especially attractive to browser developers because it can be leveraged with JavaScript, JSON, and HTML to create an efficient, pure client solution – namely one that uses only browser logic and can initiate cross-domain requests for data. In general, requests contain a manually concatenated string of argument-value pairs and responses consist of standard content types, such as JSON (text) and images. While the benefits of using REST in a browser context with JavaScript are clear, other application environments present some hurdles. Since REST is not founded on a public standard, a developer needs documentation to learn how to interact with a REST service. This may suffice when working with client script, but developers working in an IDE with object-oriented languages like C#, VB.NET and Java often demand more. Why parse strings when you can work with explicit service types, discover parameters using intellisense, and utilize a proxy to manage requests\responses? This is where SOAP comes into the picture. SOAP is a standard W3C procotol which defines the XML message format for requests to and responses from a SOAP service. WSDL, another W3C standard language, provides the contract for how a consumer can interact with a SOAP service. While a SOAP message is an XML formatted string, a developer does not need to construct and parse it manually. Since SOAP is based on standard protocols and languages, toolkits for specific development environments are available to automatically construct native types. More specifically, the WSDL is used to construct a proxy class and a set of supporting types for use in an specific object-oriented environment. The proxy class exposes a set of operations (methods) which initiate Web requests. The supporting types are used to define inputs as value objects (termed ‘value objects’ because they only store values), which the proxy uses to construct a SOAP message. The response from a service can be deserialized by the proxy into one or more value objects. The benefit here is clear; a developer is able to use complex service-specific types native to their development environment to interact with a service.

The key difference between the use of REST and SOAP lies in the WSDL. The WSDL provides a central, language agnostic means for defining how to interact with a SOAP service. Different development environments can use the WSDL to construct the same set of types on-the-fly using a SOAP toolkit. REST does not define a compliment to the WSDL. As a result, documentation must be used to determine request and response content. Technically, you can manually construct a proxy and set of types to interact with a REST service, but without a central definition or standard (provided by a WSDL) the API structure will likely differ between developers.

So where does it make sense to leverage REST services in the Web ADF? REST services should be utilized in the browser, thus integrated with the Web ADF using the ADF JavaScript library. In this capacity, REST services may be used to enhance Web ADF application behavior and performance. One such area involves simply adding non-cached map services using pure client logic, something the Web ADF does not provide out-of-the-box. Currently non-cached map services use the AdfMapHandler class in ADF JavaScript to generate dynamic map images. This class requires Web-tier components; namely a map resource associated with a MapResourceManager and Map server control. It uses the ADF MapHandler to generate dynamic maps. The same applies for the Toc; it still relies heavily on Web-tier manipulation. You can, however, extend the ADF JavaScript DynamicLayer class to work with a non-cached service via REST.

The sample is available here.

There are a few caveats:

1) The layer (i.e. resource) is only available on the client; server components do not know about it. As a result, any requests to the server that work with map resources will not include this layer. In addition, most ADF controls require modification on the server to change their rendered content. This includes the Toc, so if you want the pure client layer to show up in an ADF Toc, you’ll need to customize Toc content using code on the server.

2) Using services secured with token-based authentication requires a proxy. Here’s a link to step on how to set this up: http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp_start.htm#jshelp/ags_proxy.htm. Using a proxy is a popular solution for working around cross-site scripting restrictions in a browser. Abe Fettig has researched a number of these solutions and presented them in a blog post. Note, you can use a proxy even if authentication is not required.

In the sample I provided, if a proxy (via the proxyUrl property) is defined when creating a new DynamicRestLayer, the proxy will be used. In this case, a POST request is always generated to guarantee that all the input arguments are passed to the remote site. The response is JSON and contains the properties of the generated map image, including the url and extent. If no proxy is specified for the DynamicRestLayer, a simple GET request for a map image is made via a dynamic image tag. The image tag source is not subject to cross-site scripting restrictions in the browser, so we don’t need a proxy. Both IE7 and FireFox 2+ work great with the no proxy solution. Unfortunately IE6 is somewhat problematic (e.g. triggers erroneous requests). If you need to support IE6, you may want to go the proxy route.

This brings up an interesting point – the ADF JavaScript Map component is designed to render and blend maps using dynamic image tags. The image tag source is not subject to cross-site scripting restrictions. Since a REST map service can return the raw map image, the sample included with this post merely builds on REST capabilities and ADF JavaScript architecture. Another option involves using dynamic script tags whose source references a REST endpoint that generates JSON. The data returned from the REST service is evaluated as a JavaScript object when the tag is loaded or inserted in the page. This could also work with ADF JavaScript, but would require more implementation code. Interestingly, dynamic script tags are leveraged by the ArcGIS JavaScript API.

Note, the sample also shows how to use REST to access tiles in a cached map service with a pure client layer. It may be of interest since the url is standard across sites (e.g. you don’t need to know the virtual cache directory).

Map Cache – Painful Process

September 10, 2009

We are undergoing painful process of caching our data.   Its been tough time and cumbersome job and ESRI Caching process is merely black box for developers.  Let me explain my issue in detail.

I’m caching with single point layer having 3 million records . I do single fused cache with ArcGIS Online scale levels and my machine is 16 GB RAM and dual core Windows Server . I use ArcGIS Server 9.3 ( NO SP1) and using 15 instances.  This caching occurs on a single box where my data is fetched from Orcale DB Server using ArcSDE . Caching is very fast for level 0 to 9. After level 10, caching takes very long time  and its fails in between during our night time. We could not identify the exact reason for the failure. When I searched the log files ( enabled ‘Verbose’) for error related  information I could not able to find single entry with world “Cache or Error” .

I have purposefully unchecked a option ” Close the box when caching is completed”  to ensure that caching is completed and successful. But still caching process is ended abruptfully.  I have following basic questions to understand the process better.

1. How to validate caching is 100% successfully completed?

2. In log files logs , Is there any way to log only caching related information in same or different file?

3. How to calculate , how much % of caching is completed?

4. When caching fails, is there any scripts or way to send out an email or notification by any means?. I using ArcCatalog for starting the caching process.

5.  During caching process when database server is down, what will be impact and error message .
6. In Update mode ‘Recreate Empty Tiles’ options says “Only tiles that are empty (have been deleted on disk), or that are new because the cache extent has changed or because new layers have been added to a multilayer cache, will be created. Old tiles will be left unchanged. ” Is that means “blank images” will be recreated when map extents and data are same.

7. What are reasons for generating ‘blank images’ for entire level

I’m looking for some good help on understanding these above points.

MXD Path update

August 8, 2009

Many times  I have faced same problem as described in this post. During application deployment phase of we may need to change all the data-source path to prod database.  Usually we dont have luxury of having ArcGIS Desktop/Catalog for updating the path or do some modifications on production environment. This is primarily because of additional license is required or production server will be entirely on other network or domain.  Due to security reasons also ESRI ArcGIS is not allowed on prod environment.  This becomes annoying when client wants to change the symbology or change the data source for some reasons.

One way to get rid of this issue is maintaining relative path on the mxd.  If you want all your new maps to be stored with relative paths, go to the File > Document Properties dialog box and click the Data Source Options button. Check the option to make relative paths the default for new map documents. This setting is stored in the registry. If this box is not checked, the default is absolute paths.  This will definitely save your effort.

You can still change the path if you have ESRI .NET assemblies installed and you need to write some scripts to achive the same.

If you are working with ArcEngine Java then you can use this tool .   Here is link for MXD Path editor for Java on linux / Solaris OS.

But issue here is whenever you change the connection properties of SDE i.e. if you want to change password alone. Then it hurts more. Reading .sde file to get connection properties using AO is a not possible. You can get connection properties straight a way.

A simple way to get the connection properties that it contains is to use it to open the SDE workspace. Once the workspace is opened, you’ll be able to access the connection properties. Note, the password will remain encrypted – you won’t be able to see it in plain text. ESRI is NOT providing option to decrypt the password since by design as it as for security reason.

Long back I have faced one issue when I saved some layers for which the datasource is SDE  feature classes. I ‘ve used  an SDE connection without save password option. But still I got SDE Connection prompt when I open a map using IMapDocument interface.  I could not supress this prompt programmetically, am not sure whether this issue is solved now.

You can click below link for read on usage of relative paths on MXD. Save a layers using relative path is optimal solution I would suggest for a developer for hassel free deployment.

How to use relative path

Flex API – Some Tips and Tracks

June 10, 2009

I have been working with ESRI Flex API for almost around one year. I would like to share some  basics of Flex API along with tips and tracks.  If you are beginner then I’m sure this post will helps you lot.

Here is link to see the list of Web Sites developed using ESRI Flex API.  If you are coming from  Web ADF,  Flex API  is really damn cool.  We can develop light-weight to medium level application using the Flex/SL/JS API.  You cannot do editing functionality. Flex API V 1.2 comes up with integration of MS Virtual Earth.

Start with Flex Viewer sample. This is the ideal place to begin with, where you start widget based programming model. The help document comes with Flex viewer clearly explains and search on Google for design patterns. There are lot of heated discussions about frameworks and patterns. I leave to reader for making his/her own choice.

  1. When you start developing the application(non Flex viewer), one of the must requirement is TOC control. By default there is no in-built TOC control.  You can develop your own custom TOC otherwise you can download this sample from ESRI ArcScripts site and make use of it.
  2. Here is sample for Overview Map . Click here
  3. Sometimes we may want to design a Map control with rounded corners than rectangular one.  Here is sample code

Here’s a way to use a mask to create rounded corners:
<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221;
xmlns:esri=”http://www.esri.com/2008/ags”&gt;
<mx:Canvas width=”100%” height=”100%”>
<esri:Map level=”1″ mask=”{maskCanvas}” cacheAsBitmap=”true”>
<esri:ArcGISTiledMapServiceLayer
url=”http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer”/&gt;
</esri:Map>
<mx:Canvas id=”maskCanvas” width=”100%” height=”100%” cacheAsBitmap=”true”
backgroundColor=”#FF0000″ borderStyle=”solid” cornerRadius=”15″/>
</mx:Canvas>
</mx:Application>

  1. If you are working with 9.2, still you can use Flex : While 9.2 isn’t supported by the Flex and JavaScript APIs out-of-the-box, you can create the map tiles in 9.2 and subsequently use the tiles in the Flex and JavaScript APIs by extending the TiledMapServiceLayer  to be able to connect to your specific service.  Here is link to study more. if you want do some geoprocessing and querying you have to use 9.3 version.
  1. You may want to some specific geoprocessing in Asynchronous mode, so that user can browse the application. Once processing is done, you can  work with results in asynchronous mode. Here is sample to start with
  2. Some times you may want functionality to save the map at client side.  File reference object is not available in Flash 9.x version. If you update with Flash 10.x you can do this pretty easily.                                                                Note1 : Do change the “Require Flash Player version” to 10 0 0 under the Flex Compiler section of your project properties and check your Flex SDK version it should be 3.2 and above
  3. We may require to zoom to set features extent after performing query.  This can easily done rather than looping through the record set and computing minx and max x

// zoom to extent of all features
var unionedExtent:Extent;
var multipoint:Multipoint = new Multipoint();

for (var j:Number = 1; j < resultCount; j++)
{
multipoint.addPoint(MapPoint(event.findResults[j].feature.geometry));
}
unionedExtent = multipoint.extent;
map.extent = unionedExtent.expand(1.1); // zoom out a little

4.  When you are querying using REST API and returning JSON response there may be chance that Error:  Unexpected I encountered.  First  check your data (i.e. value from the record). if it contains any special character like double quotes  then REST API throws error . ESRI  REST team is aware of this issue and they will be fixing it soon. One workaround would be to remove all double-quotes from your data (if possible). Another option may be to escape the quotes in your data.

5.  For parsing JSON response you need to download as3corelib.  You can use the JSON decoder from:
http://code.google.com/p/as3corelib/ to turn the JSON string into a Object.
e.g. var obj1:Object = JSON.decode(result);

6.  Another combining Dynamic and Tiled Services [Multi-layer cache] in LiveMap Widget for flex viewer sample

From the REST documentation:
“Note that multi-layer caches are only accessible in REST via export, and these requests are treated as a dynamic map service. Tile access is not supported in REST for multi-layer caches.”

http://resources.esri.com/help/9.3/arcgisserver/apis/rest/index.html?mapserver.html

7.  If you want add Identify Results into data-grid here is code snippet

var graphic:Graphic;
var myAtts:Object;
var myAc:ArrayCollection = New ArrayCollection();

for each (var result:IdentifyResult in event.identifyResults){
  myAtts=result.feature.attributes;
  myAc.addItem(myAtts);
}
dg.dataProvider = myAc;
Since its already getting late, I will post rest of the tips/tracks as second part, please bear with
me. Please write your queries/comments/suggestion.

Have a great day!

Flex API 1.2 Released

May 26, 2009

ESRI has released Flex version 1.2 on few days back. Here is link to download the latest API.

# New features:

* Routing using ArcGIS Server (requires ArcGIS Server 9.3.1).
* Microsoft Virtual Earth mapping
* Microsoft Virtual Earth geocoding
* Renderers [Class break, Unique and Simple]
* GraphicUtil.getGraphicsExtent() from Util returns the extent for an array of graphics. [ No need of
looping and get the extent]
* WebMercatorUtil projects coordinates between 4326 (lat/long returned by Virtual Earth geocoding)
and 102113 (Web Mercator – used by Virtual Earth tiled layer).- Straight punch
* Text wrap function and some bug fixes.

This is really great news that ESRI heading towards Microsoft Virtual Earth. Download and enjoy the new flavour.

ESRI Microsoft Silver Light API Beta

March 21, 2009

I have been chatting with my friend who works for Microsoft India. We discussed lot about security and domain and finally I asked about Virtual Earth.  He said there is team working on this  in his office.  ESRI also released The ArcGIS API for Microsoft Silverlight™/WPF™ beta release on March 20th. Here is the link for more details on their API and samples to get start with.

I believe that all core MS fans will be very happy to work Silver light API  from now on. ESRI has announced long back but before their dev summit they have released this . I’, m  indeed happy on looking at their API.  When I writing this post, am downloading Silverlight on my lappy. Hence  I have to wait for couple of mintues to have look in and start play with.

These days I primarily work with Flex API. But am very eager to know on the SL API. Many of colleagues where keep watching on this.   Let us cheer ESRI for another flavour of their API to their clients/developers. Kudos!

I’m waiting for Monday on Developer summit and videos to catch up the action. I remember Jim mentioned that this ESRI will upload their session videos in one hour after the session is over. This is very glad news for people like me and working late night to see action.

Windows Authentication due to cross domain

March 3, 2009

Another interesting way to hide the Windows Authentication every time when the user trying to use ArcGIS Server services. First go through the cross domain.xml in given link below

This article explains it better than I could:
http://resources.esri.com/help/9.3/arcgisserver/apis/flex/help/content/references/using_crossdomain_xml.htm

If you place cross domain.xml is your web server , it asks windows authentication everytime, this really irritates the user. Here is the solution to fix the windows authentication form to disappear when maps try access to services.

1) On the server machine, go to C:\inetpub\wwwroot.
2) Right click on your crossdomain.xml file to modify its Properties.
3) Go to Security Tab.
4) Check to see if you have Internet Guest User as one of the ‘Group or user names’. This was missing from the crossdomain.xml file.
5) Click on the Add button to add a new user. Enter \IUSR_ (e.g., vamsi\IUSR_vamsi; this is the same user that you will see is being used for anonymous access in the IIS).
6) Give it Read & Execute or Read permissions.

ESRI Logo Visible

March 3, 2009

Here is another work around for keeping ESRI logo visible to false using ESRI Flex API.  When you add service and set logovisible equals to visble it wont work. This is an API restriction.

“Turning off the logo is only possible if you connect to your own ArcGIS Server (not counting ArcGIS Online).”
http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/com/esri/ags/Map.html#logoVisible

Connecting to your own ArcGIS Server means using ArcGISTiledMapServiceLayer or ArcGISDynamicMapServiceLayer. We have multiple server licenses but have some networks where we run directly with pre-cached tiles/embedded data. There were ‘n’ number of ways to get the data, this restriction is pain.

Here is code to Hide ESRI Logo from ESRI Forum Courtesy: Guilhem Vellut

function reallyHideESRILogo(map : Map) : void {
  for(var i : int = 0 ; i < map.numChildren ; i++){
    var component : UIComponent = map.getChildAt(i) as UIComponent;
    if(component.className == "StaticLayer")
       for(var j : int = 0 ; j < component.numChildren ; j++){
         var stComponent : UIComponent = component.getChildAt(j) as UIComponent;
         if(stComponent.className == "Image"){
           stComponent.visible = false;
           return;
         }
      }
  }
}

It seems pretty good alternative, but whenever layer gets loaded this function needs to be called.

How to know if a service exist ?

February 15, 2009

This is must wanted method for the developer:

I would also recommend using HTTPService to send the f=json request. (Set resultFormat to “text”.) This way you can parse the response (http://code.google.com/p/as3corelib/) to see if it’s a cached service (singleFusedMapCache is true) or not and then use the AGS dynamic or AGS tiled layer.

If you skip this and just try the URL in a AGS dynamic layer, then listen for the loadError event.
http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/com/esri/ags/layers/Layer.html#event:loadError

This is thrown if it can’t load the json for the service. The ioError is thrown if it can’t download the map image:
http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/com/esri/ags/layers/DynamicMapServiceLayer.html#event:ioError