Friday, July 31, 2009

Cool Flex API for AGS Samples

My friend and colleague _extraordinaire_ Kerry Coffin been working with the Flex API for AGS, and send me the following list of samples:

Linear Grid: This app shows a linear grid distance (miles, km etc) on a geographic map. Zoom In; pan north and south;change the number of grids;etc. Notice the grid width displayed. Also change the units.

Graticule: This app shows a Lat/Lon graticule in a web Mercator map. Zoom in continually. Notice how the graticule adjusts.

SimpleGraticule: This app shows a Lat/Lon graticule in a Geographic map. Zoom in continually. Notice how the graticule adjusts.

Quad Tree: This app shows a quad tree component that can index and search points in a client app. Add a bunch of points (Pick add 10K points). Drag the mouse to search. Try adding 10K more. Search again. The app shows you how the indexing is done.

Polynomial transformation: This app shows how to warp any image and overlay it on a map. (polynomial transformation) Press show resulting image. Change the order to 2. The user selects common points from both left and right. I’ve preloaded the app with a bunch of common points.

Normal Contours: Click to add elevation points. Pick a few points with elevation 100. Change the elevation to 105 pick a few more. Etc. Turn off the triangles to see only contours. (similar to the 3d app…except just contours)

And last my 3D app. It’s similar to using the contouring app.

MGRS: For the MGRS app, pan around the map by dragging your mouse. Of particular interest is the north pole, as most people leave off these zones, and they don’t draw curves.
If you zoom out, the scale dependency of the MGRS Layer turns off the finer grids. (MGRSLayer is implemented by extending Layer and implementing updateLayer()). The curves are drawn by doing the following algorithm: I don’t brute force it and add a trillion points and then project. To draw a line I project the 2 endpoints to pixel locations, and then project the mid point to its pixel location. I then compare the mid point’s projected pixel location to its pixel location by averaging the two endpoints. If the locations differ by more then one pixel…I do this to both halfs. This algorithm is done “logically” recursively…but I set a limit as to how many midpoints I add.


Faridur R Choudhury said...

Hi Mansour

Nice work!

Is it possible to get WFS features coming from an WFS server, say GeoServer/MapServer, to be drawn using the Flex API? I could get the WMS layers from GeoServer to overlay perfectly. Any pointers to drawing WFS features will be of great help.

Have written some tips on using AGS Flex API with Bing Maps and WMS in my blog


ThunderHead said...

U can write your own layer that consumes WFS based on the Layer class and my shp viewer - do not think we have plans to support it out of the box :-(

DCAKen said...

I like the Graticule examples. Is there any chance of getting the code for these samples?

ThunderHead said...

Let me see what I can do....

Rabbit said...

These now use AGS1.2 Flex API

brian said...


ThunderHead said...

Sorry, cannot share code :-( as this is "paid" work.

Michael Haggerty said...


Any updates on supporting WFS from the Flex API? Have you come across anybody who has extended the GraphicsLayer object to do this? You made mention of your shape viewer...where is this found?


ThunderHead said...

No WFS - only WMS support

MarcG_NZ said...

Hi, your MGRS sample is excellent, and is functionality many organisations would find very valuable.

Are you able to provide a compiled widget for Flex Viewer for users that are unable to compile their own version.

Again, this is a tool that would make many peoples lives much easier.