Thursday, February 28, 2008

Flex-Google Maps Collaboration

Another one of my favourite bloggers; Christophe Coenraets. Here he has created In Flex a Google maps mash up:
http://coenraets.org/blog/2006/06/
google-maps-collaboration-using-flex-flash-media-server-
and-ajax-updated-for-flex-2-ga/

Thematic mapping

Peter Ent has a terrific blog. Here he has put together a thematic map in Flex 2:

http://weblogs.macromedia.com/pent/archives/
2007/02/usa_map_for_fle.cfm

Internet Mapping .. the players

Let's list some of the Internet Mapping options:

Hard core GIS - ArcGIS server
  • expensive, tonnes of overhead, administrative hell, need for application server.
  • tools for web application generation, customisable components.
GIS and image generation - Mapserver
  • reduced GIS functionality.
  • free, easy to configure and administer, only need web server.
Interactive maps 1 - Flash/Flex 2
  • need to build from the ground up all tools and components, resolution.
  • very easy to take vector or bitmap images and create unique interactive maps.
Interactive maps 2 - Zoomify

Proprietary Mapping API's - Yahoo, Google, ESRI arcWeb

  • they control/track usage, they own the API and can change it at will, they own the data and can add any elements they wish (eg. advertising).
  • quick and easy to build a data populated fully interactive map.
Thematic maps - Flash/Flex2
  • Combining Flash swf inside Flex 2 (often best way) can be challenging, map itself need be broken into separate interactive objects which need to be pregenerated.
  • With Flex 2 charting these are very powerful ways to convey information.
Multimedia maps - Flash/Flex 2
  • Pulling all assets (images, video, audio) together.
  • Another powerful way to convey information.

Internet Mapping .. some thoughts

I come from a GIS background. In 1997 I built a mapObjects IMS application. It was one of the first Internet GIS products. Those were the early days. Later I built an application using ArcIMS. Again ArcIMS had just been released. Working on this project I realised in large part we were using spatial (GIS) servers as image generators. I'll not go into the ins and outs of GIS suffice it to say GIS is a powerful spatial analysis tool. Using the cost and overhead of spatial servers to simply regenerate a new map image, struck me as a little daft. There are many ways to show maps on the web, but often people fall back on expensive spatial servers (sometimes it makes sense often it doesn't). It started me on this ongoing adventure into Internet mapping.
In Flex 2 I've chosen one of the newest web development tools out there. Building mapping web sites has never been more fun, flexible and exciting.

Tuesday, February 5, 2008

Yahoo Aerial Map

I've been interested for some time in how to grab Yahoo map tiles. Starting with a lat long envelope how do we find the relevant tiles and display them? Further how do we pan, zoom and add overlays. Modest maps do a nice job using various providers (openstreemap, google etc). But working through their code base has proved, even for experienced developers, somewhat challenging. I decided to build from scratch a simple Flex 2 map viewer using Yahoo Aerial tiles. The results can be viewed at:

http://www.flexmappers.com/yahoo_maps/

Its mostly a proof of concept; pan and centred zooms still need some work. But it proved a much easier task than expected. Flex simply calculates the tiles needed, requests these tiles and displays them in a Sprite grid. Overlays are added to individual tile sprites after calculating the tile and pixel position within the specific tile.
--Matt

Building Flex 2 Map Applications


An article I wrote, bit wordy but worth posting ....


Web mapping applications have come a long way over the last few years. The market has split into numerous segments. These include:

  • GIS based applications relying on proprietary products such as those from ESRI, notably arcIMS and arcGIS, and open source alternatives including Mapserver.
  • Sites built around Google maps, Microsofts Virtual Earth and Yahoo Maps.
  • Flash based sites which run in the client using high definition map imagery.
When talking to clients about their mapping needs and tools to satisfy this need we have found much confusion. Is this to be an interactive mapping application or one which provides GIS functionality? More importantly is the difference clearly understood. Google provide a mapping application, ESRI are fundamentally a GIS company. Do clients want the expense and overhead of ESRI products if they only want to display maps (don't get us wrong we love the ESRI product suite)? So purpose, understanding, budget and maintenance are all things to consider. Another is client verses server. We started working with Flash and Flex 2 because we could create nice interfaces, we liked and recognised the power of actionscript and lastly we knew how much we could (potentially) do without needing server calls. The latter, as we will outline, has is own limitations but makes for a remarkably fast application.

Pure GIS

So what is the purpose of the Web site? Are you serving simple interactive web images, or is this a web site whose purpose is to provide spatial analysis. If it is the latter then advanced spatial servers are a requirement. ESRI are the major vendors of GIS software; ArcIMS and ArcGIS, are their two flagships. So buffering, modelling, layer query, data extraction and much more are possible with these products. ArcGIS is a complex beast to install and administer, its also expensive. But it provides extensive GIS functionality out of the box and is highly customisable (through arcObjects). Simple mapping applications are easy and quick to build using .NET (Java is another development option but is poorly supported).
Thoughts and Observations
From our experience most mapping web sites use backend (GIS) servers to simply generate map imagery. Thus a zoom changes the map envelope (extent) and thus requires the regeneration of the map image with the new extent and new resolution. To pay for proprietary software and simply use it for image generation is, in our view, daft. The open source route through Mapserver would be a better way to go (which also offers GIS functionality). But if you are developing a high level GIS applications (and have deep pockets), then the ESRI suite is an excellent option.

Flash Maps

There are a range of excellent mapping sites on the web which use Flash. Flashmaps generate a range of interactive flash based maps commercially. One of the earliest examples we found on the web of a Flash GIS map site was the Davis streetmap. Inspired by this work we at Flexmappers built a Spatial Data Clearinghouse for the US Forest Service (USFS). The success of this application led to other similar USFS projects including the NPSG dynamic map.
Thoughts and Observations
Flash runs on the client in a browser plug in (the flash player). Browser compatibility is not an issue, but users will need the appropriate plug in, or player, to run the Flash application. Developers have the option to bundle all data into the downloaded SWF. Thus the initial application loading is slower, but map interaction then demands no server calls. Flashmaps take this approach for some of their mapping applications. You can also use Flash Remoting to make server calls. Thus the Spatial Data Clearinghouse communicates with ArcIMS (via Java) to provide map interaction and data extraction. So what are the disadvantages? Flash was initially developed as an animation tool. Though Actionscript 2.0 was added and is powerful for application development. Flash remains best for animation development.

Flex 2 Maps

Flex 2 was released in June 2006. Its uptake has been somewhat slow, particularly in the web mapping arena. To their credit ESRI were quick to see the possibilities and launched ArcWEB Services. For the reasons outlines above with regards Flash we were interested in the possibilities Flex 2 offered. Two early prototypes we developed included the Ski Solitude SVG interactive map and a MapServer map viewer. Christophe Coenraets has started working with Flex 2 and Google maps.
Thoughts and Observations
Some of the advantages of Flex 2 include:
  • No cross browser compatibility issues.
  • A rich set of tools to build sophisticated 'desktop like' web applications.
  • Programming done in Actionscript 3; a powerful object oriented language.
  • Client processing, more can be done within the clients Flash player to make sites extremely fast.
To put it simply, we love Flex 2! For Web application development, in our view, it is unrivalled. The creation of sophisticated, great looking, user friendly Web sites has never been easier. For the creative, less technical it is easy to learn and use. For hard core developers, Actionscript 3.0 is incredibly powerful. Used alone or in combination with Javascript/Ajax, PHP etc, the development possibilities are endless. In the online mapping world, where we are focused, we have only just begun to explore the possibilites. Our Ski Solitude application, outlined above, is a client based application, which loads all data on the client side. As a result map interaction almost instantaneous, since it does not reky on server calls to reload the map etc. The Mapserver application uses Flex 2 to build the interface and communicates with PHP for server interaction. We would be happy to share the code for anybody interested. We are looking into advanced GIS functionality using Flex 2 - ArcGIS. Additionally, we are experimenting with adding overlays to maps, allowing users to click georeferenced points to view movies, video, charts etc; Flex 2 is a wonderful multimedia environment.

Modest Maps

The excellent open source Modest maps has both a Flash and Flex 2 api for connecting to and displaying Google Maps, Microsoft Virtual Earth, Yahoo Maps and a number of other interactive map providers. In addition they have a zoomify plug in which enables developers to use 'zoomified' images in a map viewer.
Thoughts and Observations
We are interested to see where this work is going. We have played with modestmaps and have built a test application. Much of the initial work has been done in Flash, slowly things are being ported to Flex 2. When we get chance we plan to dig into the code maybe help with porting and add functionality (hooking into the ArcGIS cache is of great interest). But this work is well worth checking out.

Flex 2 and Mapping

After working for years with Javascript, Java and Flash to build mapping web sites, I am now a Flex 2 convert. Some time spent noodling with Flex after its release showed how quick and easy it was to create great looking, highly functional mapping web sites. On this blog, I'll share some of my thoughts on developing mapping sites using Flex 2, and show some examples. I'll also share ideas and findings on web map development.
--Matt