Monthly Archives: July 2009

Creating an AgsJWS web application with Wicket Framework

Let’s build our first AgsJWS web application.  The AgsJWS API is a low level API for working with ArcGIS Server Web Services through published WSDL endpoint URL’s.  This makes the API easy to integrate into existing frameworks which simplifies web application development.  POJO data models make good sense when working with low level API’s and Apache Wicket provides a good POJO framework which makes developing web applications simple and enjoyable.  While this post will assume some knowledge of the Apache Wicket framework, if you are new to the framework you can read more about it here

Our application is going to extend on our previous post which described a console based application for displaying all services from an ArcGIS Server Service Directory.  In this post, we will turn that application into a web application using the Apache Wicket framework.  

In our example, we will put all the of the files in the same package directory.  This means that our markup files and java files will be in the same directory next to one another.  

CatalogServerApplication.java

Each Wicket application is defined by an Application object.  The object defines the home page and allows for some configuration. 


package com.esri.agsjws.demo;

import org.apache.wicket.protocol.http.WebApplication;

public class CatalogServerApplication extends WebApplication {

    @Override
    public Class getHomePage() {
        // TODO Auto-generated method stub
        return CatalogServer.class;
    }

}

CatalogServer.java

In our Application object, CatalogServerApplication, we defined the CatalogServer to be our home page.  When the base URL of our application is requested, the markup rendered by the CatalogServer page will be returned. 


package com.esri.agsjws.demo;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.model.AbstractReadOnlyModel;

import com.esri.arcgisws.ServiceCatalogBindingStub;
import com.esri.arcgisws.ServiceDescription;

public class CatalogServer extends WebPage {

    // Constructor
    public CatalogServer(){
        // Get Version Info
        ServiceCatalogBindingStub catalog = getCatalogendpointURL );
        String version = catalog.getMessageVersion().toString();
        add(new Label("version", version));
        add(new Label("server", endpointURL));
        
        RepeatingView repeating = new RepeatingView"repeating" );
        add(repeating);
        
        // Get Service Info
        ServiceDescription[] sds = getServiceDesriptioncatalog );
        
        
        for (int i = 0; i < sds.length; i++) {
            
            WebMarkupContainer item = new WebMarkupContainer(repeating.newChildId());
            repeating.add(item);    
            
            ServiceDescription sd = sds[i];
            item.add(new Label("ServiceName", sd.getName()));
            item.add(new Label("ServiceCapabilities", sd.getCapabilities()));
            item.add(new Label("ServiceType", sd.getType()));
            
            final int idx = i;
            item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel()
            {
                public Object getObject()
                {
                    return (idx % == 1"even" "odd";
                }
            }));            
            
        }    
    }
    
    public static ServiceCatalogBindingStub getCatalogString URL ){
        return new ServiceCatalogBindingStubURL );
    }
    
    public static ServiceDescription[] getServiceDesriptionServiceCatalogBindingStub catalog ){
        return catalog.getServiceDescriptions();
    }
    
    private static String endpointURL = "http://server.arcgisonline.com/arcgis/services";
    
}

Here we integrate the console based CatalogServer class but instead of printing out to the console we are going to return our output to Wicket components to be rendered by a markup page.  First we print version and server url to Labels which take two parameters.  The first parameter is the component identifier and the second parameter is the message which the label should render.  

Next we need to iterate through our ServiceDescription and print them out in tabular form.  For this we use a WebMarkupContainer which allows us to dynamically add rows filled with Labels which we will populate with our Service Name, Capabilities, and Service Types.  I added a modifier to render alternating row colors for viewer clarity.  

CatalogServer.html

The HTML that defines our CatalogServer functionality has two obvious points to discuss
1. The wicket component declaration in form of <span wicket:id=”server” id=”endpointURL”>
2. The message [endpointURL]

The component declaration is the Wicket identifier and the component identifier message.  The component identifier is the same as the name of the component defined as our WebPage, the CatalogServer class.  The text in between the <span> tags gets removed when the component renders its message.  The content which is rendered is determined by the CatalogServer class.

web.xml

In order to deploy our web application we need to make it known to the application server through the standard web.xml file.  

    <filter>
        <filter-name>CatalogServerApplication</filter-name>
        <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
        <init-param>
          <param-name>applicationClassName</param-name>
          <param-value>com.esri.agsjws.demo.CatalogServerApplication</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>CatalogServerApplication</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>   

We map our Application object, CatalogServerApplication, to the Wicket Filter which handles all requests.  We then provide the applicationClassName parameter linked to the fully qualified path to our CatalogServerApplication class to let Wicket know which application is available.  Also take note of the url-mapping to /*.  The Wicket filter will only process requests that are Wicket requests, everything else is ignored.  This ensures that static content will be served appropriately by the container.  

Deploy

We can now create a WAR file for deployment to our Java Application Server.  There is no further configuration necessary.  Once deployed, point your browser to the url:  http://<servername>/<warfilename> where <servername> & <warfilename) map appropriatly such as, http://localhost:8080/CatalogServer.

We have now seen how to take a console based application and easily convert it into a web application using the Wicket Framework.  Integrating the AgsJWS API with Web Application frameworks is an easy way to make efficient use of the API.  The web application described here is the foundation for building a web enabled service catalog to accurately show which services are available from appropriate servers.  I have posted the full web application with source code to the Code Gallery for you to download, deploy, and extend. I encourage you to give it a try for yourself.   

Posted in Developer | Tagged , , , , | Leave a comment

Address Coder updated with 2009 Data

The 2009 update to Address Coder, Esri’s stand-alone geocoding and data appending software, started shipping this week. The update includes Tele Atlas geocoding reference data (based on February 2009 data) and Esri’s 2009 demographic and Tapestry data.

We made some minor changes to the user interface to improve the setup of geocoding/data appending jobs.

In addition, we added a new feature ‘Append Closest to Site’. It allows users to determine, from a list of stores for example, which store is closest to an address record. When using this feature, the output file includes a field called CLOSEST_ID that indicates the closest store’s ID. This feature can be used by retailers for determining which customers are in a store’s trade area; or for determining the right merchandise mix for a store. It can even help sales managers determine sales territories.

Posted in Location Analytics | Tagged , , , , , , , , , | Leave a comment

New white paper gives metrics, best practices for a workgroup ArcGIS Server deployment

You probably wonder how much you can get out of a four-core machine with ArcGIS Server. The answer depends on what you do… We’ve prepared a new white paper document where you can see some interesting metrics on the throughput of a workgroup ArcGIS Server deployment and an application based on the Flex Viewer.

Throughout the document you’ll learn the steps we followed to create a typical Web application for use within a local government office. We also provide figures showing how the application performed under load. While every map and every workflow is different, the document provides some insight into what you can expect from ArcGIS Server and gives some tips on how to approach the creation of web applications to get the most out of your server.

View the document Best Practices for Creating an ArcGIS Server Web Mapping Application for Municipal/Local Government.

Contributed by Ismael Chivite and Derek Law, ESRI Product Management

Posted in Services | Tagged , , , | 6 Comments

Listen to a podcast about sharing your content through ArcGIS Online

7/31/09–In this podcast, Rob Shanks, Senior Product Manager for ArcGIS Online, talks about the benefits of the new ArcGIS Online Sharing application, which lets users find and share maps, layers, and tools.

Posted in ArcGIS Online | Tagged , | Comments Off

'Programming with the Geodatabase API' demo theatre posted

We’ve taken the slides, code, and data from the UC demo theatre “Programming with the Geodatabase API” and posted them up on the Engine Code Gallery.

This includes:
·         The slides that were presented
·         Code showing how to query, edit and create data in the geodatabase
·         Code showing how to create custom components that work with the geodatabase API

You can check it out HERE

Posted in Geodata | Tagged , , , | 3 Comments

Now Shipping!! Esri Business Analyst Desktop 9.3.1

by James Killick

For those of you hankering for the latest and greatest version of our desktop product … Esri Business Analyst desktop 9.3.1 is now shipping! :-)

If you’re waiting on the Segmentation Module, that’s not far behind: we should be going gold today, which means the Segmentation Module should be shipping in about two weeks…

This new release of the product provides significant performance and productivity improvements as well as access to the updated Esri demographic and business data for 2009/14.

Highlights of this new release include:

  • ESRI Data for 2009/14: enables accurate analysis based on the recent economic downturn. Relative to prior data updates the 2009 data update is of particular value as it captures the unprecedented economic change.
  • Attractive (& Fast) New Map Designs for even more professional presentations & reports. The new MXD for Business Analyst draws maps up to 4X faster than Business Analyst Desktop 9.3. This should provide a significant productivity improvement.
  • Microsoft “Bing” Local Search embedded in Business Analyst toolbar: for quick and easy search of local businesses and points of interest. This complements the infoUSA data by allowing searches for the same businesses you find on Bing maps, enabling searches for, say, “Pizza” or “Pizza in Chicago” or “Best Buy” and adding the results as a layer to your map.
  • Publish Custom Reports Templates to Business Analyst Server: enabling anyone in the organization to run reports that are designed specifically for their business.
  • Significant Performance Improvements for many critical analysis functions: 10% to 50% improvement in performance is typical.
  • Numerous User Interface Improvements to increase ease of use and productivity, including:
    • Complete overhaul of the wizards and workflows in Business Analyst to make them more intuitive
    • New, easy way to associate company logos with business point layers
    • One click access to ArcGIS Online map collections from the Business Analyst toolbar
    • Improvements to the Custom Report editor to provide a user interface similar to Excel
    • Improvements to Map Reports: ability to change the print resolution of the maps & customize individual map reports for multiple locations
Posted in Location Analytics | Tagged , | 1 Comment

Video demonstration of using and sharing maps in ArcGIS Online

7/29/09–ArcGIS Online team member Molly Zurn demonstrates how to use and share maps in ArcGIS Online.

See more videos in the ArcGIS Online Help video gallery.

 

Posted in Services | Tagged , | Leave a comment

Using arcgisscripting's "9.3" switch

This blog post was written by Ghislain Prince, Product Engineer on the Geoprocessing Team in Redlands.

Hi Everybody!

We learned in the Advanced Python Scripting Technical Workshops at UC that many of you who use ArcGIS 9.3 do not yet use the changes we made to the geoprocessor.  We just wanted you guys to be aware of this option when writing your Python scripts at 9.3.  The 9.3 switch option is specified when the geoprocessor is created; in code it looks like this

import arcgisscripting

gp = arcgisscripting.create(9.3)

Existing (pre-9.3) scripts will obviously not have this option as it didn’t exist before the 9.3 release. We’re sure you’ve already noticed that they continue to work unchanged.  To get the 9.3 geoprocessor behavior, it is not enough to simply change gp = arcgisscripting.create() to gp = arcgisscripting.create(9.3)  -  that does not work, because your code needs to be  updated elsewhere in your script to accommodate the changed behavior.

The main goal for this switch is that when you create new scripts in ArcGIS  9.3, you will use the “9.3” geoprocessor and get a much nicer coding experience.  This “nicer” experience is achieved because the geoprocessor uses more of Python’s native structures as inputs and outputs. 

It’s obvious that the improvements to the geoprocessor make it easier for you to write code and resulting code is easier to read and maintain.  Of course the changes are not limited to the List functions; here’s the complete list of differences and a comparison with several code examples.

Posted in Analysis & Geoprocessing | Tagged , , | 2 Comments

How to use the SDS Mapper Template

The newest addition to the Land Records Code Gallery was generously provided by Smart Data Strategies, Inc. It is a configuration of their Mapper Simple Tools Menu that works with ArcGIS Desktop. The following instructions provided by SDS will get you familiar with the functionality provided.

Smart Data Strategies Mapper Simple Tools Toolbar  SDS Toolbar

ToolbarThis four tab toolbar is designed to walk the user through a parcel change by clicking the tabs in order. The first tab is the Shape Tab. This tab gives you all of the necessary tools to manipulate the shape of lines, polygons, and points. Once the lines and polygons have been created, they must be validated with topology. The Validate Tab gives you the necessary tools to not only run the topology, but fix topology errors as well. When the data has been validated, it’s time to make any attribute changes that are required. The Attribute Tab gives you the ability to calculate acreage on a parcel as well as incrementing polygon attributes. The last tab is the Anno Tab. As you would expect, this tab gives you several options for placing annotation. You will also notice that there are buttons at the top and bottom of the toolbar that are static. The top buttons will allow you to start, save, and stop edits respectively. The bottom buttons allow you to finish a sketch, undo the last action, or open the snapping environment.

Shape Tab

When you initially open the Mapper Simple Tools, the default target layer of Parcel Boundaries and the default edit task of Create 2-Point Line Feature are set. The user can change the target layer and edit task at any time.

Under the edit task dropdown, there are twelve sketch tools. These tools are the same as the sketch tools on the ESRI editor toolbar, with the addition of the Restart Sketch Buttonrestart sketch and the Cul de Sac Tool cul de sac tool. Using the Restart Sketch tool, a user can simply restart a sketch at any time and begin a new sketch from the last point that was used. The Cul De Sac tool allows the user to create a cul de sac with defined measurements. To make these tools active a sketch line must be in process.

 

 

 

Validate Tab

Once you’ve made edits to a feature that participates in a topology, the next step is to validate the topology. Validating the topology means checking the features to identify any violations of the rules that have been defined for the topology.

Note: Use the Add Data button to add the TaxParcels_Topology to the map and turn on the ESRI Topology Toolbar

 

Attr Tab 

As integral portions of the data, the need for editing attributes is constant when creating or editing map features. In addition to editing attributes while editing features, attributes may need changed in their own right at separate times.

 

Anno Tab

Annotation is utilized as permanent text and graphic features found within the maps. The tools provided below make it easy to add or modify annotations on the map.

Thanks go to SDS for providing this template. Keep in mind that if your organization would like to contribute a template to the Code Gallery, you are encouraged to do so. Please see the earlier blog posting, “Submit Your Templates!” for details. The ArcGIS Land Records Team

 

Posted in Local Government | Tagged , , , , , , , , | Comments Off

ArcGIS JavaScript API printing through PDF

PrinterA common question we received at this year’s ESRI User Conference is how to print maps from the ArcGIS JavaScript API. One way to get a printable map is to export to PDF. ESRI’s Rahul Ravikumar recently uploaded a sample to the Code Gallery that captures an ArcGIS JavaScript API map in a PDF, which can then be printed. He calls this sample Map2PDF.

Map2PDF is a RESTful service that prints all types of layers, including cached (or tiled) map layers, dynamic map layers, and client-side graphics. The sample includes a script PrintMap.js, which helps in serializing ‘map state’ and sends it to the web service. This service uses an open source iText PDF rendering engine to create the PDF.

The Map2PDF sample uses Java Servlet technology and can be deployed any Servlet / J2EE container including Apache Tomcat 6, IBM Websphere, Oracle Weblogic etc. Deployment instructions are included with the Code Gallery download.

Download the Map2PDF sample from the Code Gallery

See an example

Posted in Services | Tagged , , | 2 Comments