tag:blogger.com,1999:blog-17432239455319190262024-03-14T04:20:52.059-07:00Rich Internet Mapping ApplicationsA blog dedicated to building next generation mapping applications using Flex.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.comBlogger77125tag:blogger.com,1999:blog-1743223945531919026.post-70573260675602995412010-08-19T11:54:00.000-07:002010-08-25T10:08:45.582-07:00Adobe Flex Mapping InterfacesAn interesting article on Flex map interfaces written by a collegue of mine:<br /><br />http://www.webmapsolutions.com/building-perfect-flex-map-interfaceRory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-55263549045866917362010-08-02T06:38:00.000-07:002010-08-02T07:00:45.982-07:00Flex - Styling Interactive Maps 2Just returning to my earlier post; using the Openscales API and combining WFS and WMS in one place. The goal was to use a styled map image (returned by a WMS call) and use Flex to draw the features on this image (via a WFS call), to give interactivity. One problem I found was that we needed to give the WFS drawn features a transparency of 0. This way we could get the interactivity (eg click on feature and get attributes pop up) but not see the drawn feature. But, suppose we want this selected feature highlighted in a different colour? Since the transparency is set to 0, the highlight will not be visible. How to get around this ....<br /><br />Remember the Openscales map is constructed with multiple layers (imagine looking down at multiple sheets of tracing paper, on one there is a road drawn, on another a river etc all lined up correctly geographically). Our WFS (selected) layer is on one of these sheets. So all points marking well, for example, are on this one sheet. But all the points on this sheet have a transparency of 0, so they are there, but invisible. Now it is the sheet or layer which is set to 0 transparency not individual points (polygons or lines) The solution to being able to highlight a selected point (WFS feature) <br />......<br /><br />Set a blank map feature layer. Set the transparency to 1. When a point is selected copy this to the blank layer. Hey presto it appears, Make sure when you unselect the point you both copy the point back to its original layer and then clear the blank layer.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-15370783284089834342010-07-27T08:40:00.000-07:002010-07-27T08:48:11.192-07:00Advantages and Disadvantages of the Flex ArcGIS TemplateAvailable for download from the ESRI Flex web site is the <a href="http://resources.esri.com/arcgisserver/apis/flex/index.cfm?fa=codeGalleryDetails&scriptId=15905">Flex template</a>. The template and widgets are free. This provides out of the box basic and advanced Web ArcGIS functionality using Flex. From zoom, and pan to address locator and query builder; there are a range of different widgets provided by ESRI and their user community. Build a Flex based ArcGIS web site in minutes. Well maybe.<br /><br />The biggest two main advantages of the template are fast development and the built in animation. The basic template comes with a core set of widgets or modules which are easily loaded into the template framework. Additional widgets are available for download. The framework has some nice built in animation when widgets are loaded and unloaded. <br /><br />From a development perspective, modules are easy to build and integrate into the framework. So what then are the disadvantages? These are worth considering not only in deciding whether to use the template but also in planning and estimating. Often the time to develop a site using the template is longer than expected. So let us list out these disadvantages:<br /><br />- Inflexible UI - you will quickly recognise sites built from the template. Both the look and feel and animation are a give away. It is not easy to customise the UI to make it unique. <br /><br />- The need to customise widgets - widgets have usually been built for a specific purpose, particularly the more advanced widgets such as query builder. Often clients have their own specific needs, You may thus find yourself pulling the widget apart. This may prove more challenging than it appears. What seem simple modifications may actually take considerably longer. In some case it may be quicker to simply rebuild the widget from scratch.<br /><br />- Locked into ArcGIS - Not really a disadvantage, but worth noting; the template is only for use with ArcGIS. It is not a template which can be used to hook into other spatial servers. It would be nice if you could easily use this for interacting with other spatial servers, notably Geoserver or Mapserver. But it is an ESRI solution, so why allow access to the ‘competition’.<br /><br />Overall, the template is a nice solution for clients who have limited budgets and want standard functionality. But, more complexity and a custom look and feel will both be challenging and time consuming. Step back and look closely at client needs. If the requirement is very specific, think about building the application using the <a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html">ArcGIS Flex API</a>.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com3tag:blogger.com,1999:blog-1743223945531919026.post-13255409878149501482010-07-27T08:06:00.000-07:002010-07-27T08:15:45.041-07:00Flex - Styling Interactive MapsI had an interesting question recently. This was with regards building a mapping application using the open source mapping Flex library <a href="http://openscales.org">Openscales</a>. He wanted to improve the styling of the map layers, but still be able to click on a feature and return attributes. Now Openscales is nice since both WMS and WFS calls are easy. <br /><br />Let me step back quickly and explain the difference between WFS and WMS. Both involve calls to a spatial server, in this case to <a href="http://geoserver.org">Geoserver</a>. WFS returns the raw data. So Flex is able to draw the boundaries of features, making the feature interactive. The features attributes are also returned. Thus a click on a feature can return the features attributes without a additional server call. WMS simply returns an image. Getting the attributes for the latter would require both an additional server call and constructing a new query. <br /><br />It struck me after thinking about this for a while. Why not combine WFS with WMS. Thus request both a styled WMS image and draw on this the WFS features. Make the WFS feature fully transparent, thus only the WMS styling shows.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLW00pLNQ_JsgtdCu4eRTbThw_OBoso02k0CBCysKU73FWyPAIVa7HMg6MXlUWCHjXfJvMtOxis-_HMTVszyhF9CToPvaeY8QDRJGQlJcaAqipwlz2zCrpr0wKzL1bYiJfpz8S4DDZZrU/s1600/styling.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 305px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLW00pLNQ_JsgtdCu4eRTbThw_OBoso02k0CBCysKU73FWyPAIVa7HMg6MXlUWCHjXfJvMtOxis-_HMTVszyhF9CToPvaeY8QDRJGQlJcaAqipwlz2zCrpr0wKzL1bYiJfpz8S4DDZZrU/s400/styling.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5498604886785179314" /></a><br /><br />After playing with this, the results were pleasingly good. The one thing I'm finding is challenging is the ability for a selected WFS feature to be highlighted when selected. Since it is fully transparent. <br /><br />I have a potential solution. And will share once I have testedRory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com2tag:blogger.com,1999:blog-1743223945531919026.post-74407965348276959022009-12-15T10:31:00.000-08:002009-12-17T10:11:31.311-08:00OpenScalesI've been working for some time now with the Openscales AS3 library. Finally we have a Flex GIS client. The library is work in progress, but already offers really nice features and functions. At some point soon I will share some of my work and code. I've been busy customising core functional elements including adding Yahoo and Bing baselayers, restricting WFS rendering to scale, allowing WFS layers to be turned on and off, custom styling the interface and components. More to come.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com1tag:blogger.com,1999:blog-1743223945531919026.post-54014049490175767642009-12-15T10:28:00.001-08:002009-12-15T10:30:50.766-08:00Flex Web ServicesI don't often use web services in Flex. But recetly found need to dip my toe in. The following I thought was an exellent simple example. taken from http://www.cflex.net/showFileDetails.cfm?ObjectID=582. Thanks Tracy.<br /><br /><?xml version="1.0" encoding="utf-8"?><br /><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns="*"<br /> creationComplete="getWeather()" ><br /><mx:Script><br /><![CDATA[<br /> import mx.controls.dataGridClasses.DataGridColumn;<br /> import mx.rpc.events.ResultEvent;<br /> import mx.managers.CursorManager;<br /> import mx.controls.Alert;<br /> <br /> default xml namespace = "http://www.webservicex.net"; //necessary to access the xml elements easily<br /><br /> [Bindable]private var _xmlResult:XML; //holds the result xml<br /> [Bindable]private var _xlDayData:XMLList; //dataProvider for the day weather dataGrid<br /> [Bindable]private var _sPlace:String;<br /> <br /> /** invokes the web service operation to get the weather */<br /> private function getWeather():void<br /> {<br /> CursorManager.setBusyCursor();<br /> WS.GetWeatherByZipCode.send();<br /> }<br /> <br /> /** called by the WebService result event. Sets the dataProviders as necessary */<br /> private function onResult(oEvent:ResultEvent):void<br /> {<br /> _xmlResult = XML(oEvent.result);<br /> var xmlResultNode:XML = _xmlResult.GetWeatherByZipCodeResult[0];<br /> var xmlDetailsNode:XML = xmlResultNode.Details[0];<br /> outputInfo.text = _xmlResult.toXMLString();<br /> _sPlace = xmlResultNode.PlaceName.text() + ", " + xmlResultNode.StateCode.text();<br /> _xlDayData = xmlDetailsNode.WeatherData;<br /> CursorManager.removeBusyCursor();<br /> }//onResult<br /> <br /> /** labelFunction for DataGrid. It seems that the namespace on the xml makes<br /> * using the DataGridColumn dataField not work. At least I couldn't get it to work. */<br /> private function lfDayData(oItem:Object, dgc:DataGridColumn):String<br /> {<br /> var sReturn:String = "";<br /> var xmlItem:XML = XML(oItem); //get the item object cast as an xml object<br /> var sHeaderText:String = dgc.headerText; //get the header text for this column<br /> switch (sHeaderText) //logic to determine which node to get the data from<br /> {<br /> case "Day":<br /> sReturn = xmlItem.Day.text();<br /> break;<br /> case "High":<br /> sReturn = xmlItem.MaxTemperatureF.text();<br /> break;<br /> case "Low":<br /> sReturn = xmlItem.MinTemperatureF.text();<br /> break; <br /> }<br /> <br /> return sReturn;<br /> }<br /> <br />]]><br /></mx:Script><br /><br /> <mx:WebService id="WS" wsdl="http://www.webservicex.net/WeatherForecast.asmx?WSDL"<br /> useProxy="false"<br /> fault="Alert.show(event.fault.faultString), 'Error'"<br /> result="onResult(event)" ><br /> <br /> <mx:operation name="GetWeatherByZipCode" resultFormat="e4x" ><br /> <mx:request><br /> <ZipCode>{zipcode.text}</ZipCode><br /> </mx:request><br /> </mx:operation><br /> </mx:WebService><br /><br /> <mx:Panel title="WebService Example" height="75%"<br /> paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10" id="myPanel"><br /> <mx:TextArea x="200" width="400" height="250" id="outputInfo" /><br /> <mx:HBox><br /> <mx:Label width="100%" color="blue"<br /> text="Enter a zip code."/><br /> <mx:TextInput id="zipcode" text="30117"/><br /> <mx:Button label="Get weather" click="getWeather()"/> <br /> </mx:HBox><br /><br /> <mx:Text id="txtPlace" htmlText="{_sPlace}"/><br /> <mx:DataGrid dataProvider="{_xlDayData}" height="180"><br /> <mx:columns><br /> <mx:DataGridColumn labelFunction="lfDayData" headerText="Day" width="200" /><br /> <mx:DataGridColumn labelFunction="lfDayData" headerText="High" width="100" /><br /> <mx:DataGridColumn labelFunction="lfDayData" headerText="Low" width="100" /><br /> </mx:columns><br /> </mx:DataGrid><br /> <br /> </mx:Panel><br /></mx:Application>Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-48759238324094166672009-11-22T07:14:00.000-08:002009-12-15T10:31:47.274-08:00Flex and SOAPIts always fun to work with Web service in Flex. Those pesky headers! Found a couple of terrific links on the subject. Now its easy :-)<br /><a href="http://www.actionscript.org/forums/showthread.php3?t=195916&highlight=e4x+faq">http://www.actionscript.org/forums/showthread.php3?t=195916&highlight=e4x+faq</a><br /><a href="http://craigkaminsky.blogspot.com/2009/05/flex-3-make-net-namespaces-in-soap-xml.html">http://craigkaminsky.blogspot.com/2009/05/flex-3-make-net-namespaces-in-soap-xml.html<span style="font-weight:bold;"></span></a><br /><br />Just to put some code behind this....<br /><br />Here is part of the feed:<br /><br /><?xml version="1.0" encoding="utf-8" standalone="yes" ?> <br /> <feed xml:base="http://www.placespr.com/WebDataService1.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"><br /> <title type="text">ptg_categories</title> <br /> <id>http://www.placespr.com/webdataservice1.svc/ptg_categories</id> <br /> <updated>2009-11-22T15:26:36Z</updated> <br /> <link rel="self" title="ptg_categories" href="ptg_categories" /> <br /> <entry><br /> <id>http://www.placespr.com/WebDataService1.svc/ptg_categories(1)</id> <br /> <title type="text" /> <br /> <updated>2009-11-22T15:26:36Z</updated> <br /> <author><br /> <name /> <br /> </author><br /> <link rel="edit" title="ptg_categories" href="ptg_categories(1)" /> <br /> <category term="ponce_1000Model.ptg_categories" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <br /> <content type="application/xml"><br /> <m:properties><br /> <d:cat_id m:type="Edm.Int32">1</d:cat_id> <br /> <d:name m:null="true" /> <br /> <d:service>hotels.asmx</d:service> <br /> <d:icon>/images/icons/hotels.gif</d:icon> <br /> <d:ordering m:type="Edm.Int32">1</d:ordering> <br /> <d:counting m:type="Edm.Int32">75</d:counting> <br /> </m:properties><br /> </content><br /> </entry><br /> ......<br /><br /><br />and here is the modified code from these excellent links:<br /><br /> private function getCategoriesResult(evt:ResultEvent):void {<br /> var respXML:XML = evt.result as XML;<br /> <br /> var xmlSource:String = respXML.toXMLString(); <br /> //Strip off the headers<br /> xmlSource = xmlSource.replace(/<[^!?]?[^>]+?>/g, removeNamspaces); // will invoke the function detailed below<br /> var cleanXML:XML = XML(xmlSource);<br /> for each( var item:XML in cleanXML.entry ) // looping over the reportHistory elements to act on them<br /> {<br /> trace( "name: " + item.content.properties.service);<br /> }<br /> }<br /> <br /> // Web service response cleaner function<br /> private function removeNamspaces(...rest):String<br /> {<br /> rest[0] = rest[0].replace(/xmlns[^"]+\"[^"]+\"/g, "");<br /> var attrs:Array = rest[0].match(/\"[^"]*\"/g);<br /> rest[0] = rest[0].replace(/\"[^"]*\"/g, "%attribute value%");<br /> rest[0] = rest[0].replace(/(<\/?|\s)\w+\:/g, "$1");<br /> while (rest[0].indexOf("%attribute value%") > 0)<br /> {<br /> rest[0] = rest[0].replace("%attribute value%", attrs.shift());<br /> }<br /> return rest[0];<br /> }Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-82333699747024349862009-11-17T09:03:00.000-08:002009-11-17T09:07:38.737-08:00IE8 Vista ProblemI'll not br rotten about Microsoft, since I develop on Windows .. but sometimes!!<br /><br />I found I could not open IE, out of the blue. Spent a frustrating couple of hours troubleshooting. All to do with security updates and IE settins. The solution which worked of me is as follows:<br /><br />Open internet explorer and go to menu TOOLS, than to INTERNET OPTIONS. Open the CONNECTION tab,and click on SETTINGS. You then uncheck the 'use of proxy server for this connection' and click ok .Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-78073687550582058762009-11-15T14:30:00.000-08:002009-11-15T14:36:48.880-08:00AlivePDFIts been a hectic time with project work. Much to share particularly with regards the ArcGIS Flex API and the open source OpenScales Flex library.<br /><br />Just a quick mention today on AlivePDF. Historically, I've had to generate PDF's in PHP. <a href="http://alivepdf.bytearray.org/">AlivePDF</a> is based on the PHP library FPDF. It makes generating PDF's from Flex very straighforward. Alex Britez has written a simple example <a href="http://blog.unthinkmedia.com/?p=53">here</a>.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-39144732979146680022009-10-17T17:36:00.000-07:002009-10-20T12:18:26.963-07:00Open Source GIS ClientsI have had a number of companies recently approach me about open source GIS options. This has something to do with my recently published <a href="http://flexmappers.com/about.html">articles</a>. One interesting area has been an investigation into Flex GIS clients. Openlayers is the premier Web 2.0 GIS client; well supported, a rich library filled with an array of functionality .. but written in Javascript. Now I have nothing against Javascript, its free, has a big community behind it and runs in the browser. But I'm a Flex developer. I prefer it because .. it has an excellent IDE which makes for easy debugging, developing sophisticated interactive application is both quick and easy, applications run the same in all browsers, actionscript is object oriented. Actionscript is just nicer and easier to work with .. in my view.<br /><br />So enough. Anybody who argues against these opinions I would not oppose. Its just how I feel about it. Anyway, the whole Flex GIS open source client issue. I have worked with Modest Maps for sometime now to develop mostly consumer maps. Stop right there! Consumer maps? The world of online maps remains somewhat split. GIS maps and consumer maps. Consumer maps I define as the use of basemaps - tiles which are derived from satellite images or vector road maps for example - to build mash ups; video, imagery, text using, often, the addition of map markers for access (or clickable icons geospatially placed on the map). Here is a simple <a href="http://www.flexmappers.com/myadvancedmodestmap/">example</a>. Google, Yahoo, Bing, mapquest offer largely API's for developing consumer maps. <br /><br />So what are online GIS maps. A simple question? Well maybe. GIS has moved from the desktop to the Web. It was very much a niche market. Geography type nerds generating applications and analyses in large part for government (a generalisation but close to reality). The frustration for GIS vendors was how do they broaden the market. ESRI and the other key private vendors struggled to sell into the enterprise. They still do in fact.<br /><br />Suddenly google maps arrived on the scene. It shook the mapping industry to its core. Internet maps were everywhere. Its worth noting that Mapquest preceded Google, but the fanfare (and $) waited for Googles arrival. Suddenly the other GIS vendors needed to react. ESRI produced rival online products. But with a GIS twist. <br /><br />So here we are today. A plethora of consumer map APIs. And ESRI sitting in a somewhat awkward position offering free API's hooking easily into their own server product(s) ArcGIS (not so easily into other providers). Offering consumer and GIS API functionality. With a focus to sell their complete stack to those interested. Their purpose is to make money.<br /><br />So how about those of us wanting to build online GIS maps, but avoid the high cost of the private vendor solutions? The open source <a href="http://www.flexmappers.com/POSITION_43_OpenSource_Sheehan.pdf">GIS stack</a> is very mature. But how about Flex clients?<br /><br />I've spent some time looking at the options. Base requirements include:<br /><br />- Rendering both WFS and WMS in combination<br />- Overlays of these services on various basemaps<br />- Drawing tools for line point and polygons<br />- Identify functionality<br /><br />I looked at both Modest Maps and OpenScales. Though not its focus there has been some work done on Modest Maps toward some level of interaction with spatial servers. I added a WMS layer at:<br /><a href="http://www.flexmappers.com/mapserving/mapservingWMS/"><br />http://www.flexmappers.com/mapserving/mapservingWMS/</a><br /><br />Note, I had to make some tweeks to the WMS provider, provided with the library.<br /><br />Openscales is less mature. But very impressive for how long development has been underway. I built the following map application: <br /><a href="http://www.flexmappers.com/mapserving/openscales.html">http://www.flexmappers.com/mapserving/openscales.html</a> <br /><br />It supplies much of the base functionality I was looking to include. WMS is proving a little challenging (but i suspect a style tag is mssing from the tile request) and the map interaction is not a smooth as Modest maps. Only openstreetmap is provided, but I am looking to port code from Modest maps to add this functionality. <br /><br />Ultimately Flex should simply be rendering the points, lines, and polygons supplied by the server.<br /><br />I am interested to see how easy it might be to port from one library to the other. Either way, Openscales is a very interesting project. One well worth supporting.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com3tag:blogger.com,1999:blog-1743223945531919026.post-88977064951499449652009-10-11T18:54:00.001-07:002009-10-11T18:59:44.363-07:00Flex and PHP POSTI always forget the syntax when trying to get around the Flex sandbox and use PHP. On the Flex side we need the following:<br /><br />[Bindable]private var pr_url:String;<br /><br />..<br />private function init():void<br />{ <br /> ..<br /> pr_url = "url to SOAP service for example";<br /> pr.send();<br />}<br /><br />..<br /><br /><mx:HTTPService id="pr" resultFormat="e4x" result="getMonths_result(event);" fault="getMonths_fault(event);" method="POST" url="http://www.flexmappers.com/puertorico/test.php"><br /> <mx:request xmlns=""><br /> <url><br /> {pr_url}<br /> </url><br /> </mx:request><br /></mx:HTTPService><br /><br />On the PHP side:<br /><br /><?php<br /><br /> header('Content-Type: text/xml');<br /> $url = $_POST["url"];<br /><br /> $data = file_get_contents($url);<br /> echo $data;<br />?>Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-87721985683637308102009-09-22T07:29:00.000-07:002009-09-24T07:00:27.384-07:00OpenScalesWhile becoming increasingly more impressed with Openlayers I came across <a href="http://openscales.org/">OpenScales</a>. A porting of sorts of Openlayers to Actionscript 3.0. Some key links below:<br /><br />My OpenStreetmap, WMS, WFS Test<br /><a href="http://www.flexmappers.com/openscales">http://www.flexmappers.com/openscales</a><br /><br />Code Examples<br /><a href="http://openscales.org/svn/openscales/trunk/openscales-fx-examples/src/main/flex/">http://openscales.org/svn/openscales/trunk/openscales-fx-examples/src/main/flex/</a><br /><br />Demo<br /><a href="http://openscales.org/openscales.swf">http://openscales.org/openscales.swf</a><br /><br />api<br /><a href="http://openscales.org/mvn-site/">http://openscales.org/mvn-site/</a><br /><a href="http://openscales.org/mvn-site/openscales-core/asdoc/index.html">http://openscales.org/mvn-site/openscales-core/asdoc/index.html<br /></a><br />GetCapabilities Test<br /><a href="http://openscales.org/proxy.php?url=http://sigma.openplans.org/geoserver/ows?service=WFS%26request%3DGetCapabilities">http://openscales.org/proxy.php?url=http://sigma.openplans.org/geoserver/ows?service=WFS%26request%3DGetCapabilities</a>Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com1tag:blogger.com,1999:blog-1743223945531919026.post-69976180460393933992009-09-20T12:19:00.000-07:002009-09-24T07:01:53.864-07:00PostGISHere is an <a href="http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgis_tut01">excellent guide</a> to working with PostGIS. Some of my additional notes:<br /><br />Load Shapefile to PostGIS <br /><br />a) DB Connect:<br />psql -d gisdb -h localhost -U matt<br /><br />b) Generate sql file from shapefile:<br /><br />C:\Program files\PostgreSQL\8.2\bin>shp2pgsql.exe data\states > states.sql<br /><br />c) Use pgAdmin to ru sql (tools -> query tool. In query tool open->go to the states.sql<br /><br />Paul Ramsey wrote PostGIS. I recently shared some emails with him. Thought part of the discussion worth reprinting:<br /><br />Q. What is the difference between PostGIS and ArcSDE?<br /><br />A. At a very high level (or perhaps this is a very low level), PostGIS /<br />PostgreSQL is a database, and ArcSDE is not. ArcSDE is a "spatial<br />middleware", it runs as a separate process and talks to the real<br />database below it. PostGIS is a "dynamically loadable runtime" inside<br />the PostgreSQL process -- it runs inside the same address space as<br />PostgreSQL, from the point of view of the computer, it's the all the<br />same program.<br /><br />PostGIS should be viewed in exactly the same way relative to<br />PostgreSQL as Oracle Spatial should vis-a-vis Oracle, SQL Server<br />Spatial vis-a-vis SQL Server, Informix Spatial Extender vis-a-vis<br />Informix, etc, etc, etc. It works exactly the same way as all those<br />other in-process spatial type extensions to relational databases. So,<br />call it an "extension", a "spatial type", a "data blade", etc.<br />Unfortunately, years of marketing by various vendors have muddied the<br />terminological water surrounding type extension mechanisms.<br /><br />The most important functional differences with SDE have nothing to do<br />with spatial database functionality and everything to do with ESRI<br />product placement and marketing. You'll find that ESRI products talk<br />more directly to ArcSDE than they do to PostGIS (or Oracle Spatial or<br />SQL Server Spatial, for that matter) because ESRI is interested in<br />selling their whole stack (desktop + server + web apps) to their<br />clients, not just the ArcGIS component. It's a non-trivial benefit for a customer that (a) already has a lot of ESRI software and (b) can afford the maintenance overhead in dollars, time and expertise that ArcSDE extracts.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-41312424517208780612009-09-20T11:11:00.000-07:002009-09-20T11:33:36.156-07:00GeoDjangoWikipedia defines Django as follows:<br /><br />"Django's primary goal is to ease the creation of complex, database-driven websites. Django emphasizes reusability and "pluggability" of components, rapid development, and the principle of DRY (Don't Repeat Yourself). Python is used throughout, even for settings, files, and data models."<br /><br />The two key links for GeoDjango:<br /><a href="http://geodjango.org/docs/tutorial.html#introduction"><br />GeoDjango Online Docs</a><br /><br /><a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/#intro-tutorial01">Django Docs</a>Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-26180205757056459442009-09-20T06:25:00.000-07:002009-09-20T06:41:12.299-07:00WMS and Bing/Yahoo Basemap OverlaysHere is an interesting issue I found today with WMS overlay. When WMS layers are created in either Mapserver or Geoserver then added as overlays to Yahoo or Bing their alignment is wrong.<br /><br />Let me step back. As mentioned in earlier posts. One can create a WMS layer in geoserver and through the excellent config interface add this as a layer to Google earth.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz4ZN7z1vrDxvJSIGkto6Df2plKy8ofE9qfNCDZXH_fvecQERFjO5WmvjFfUJis_0cPIVq3ozgeBiZ-hSpzMcLp9YWmXBl4xZJcu22cm1ZMNH9pegQ_XE4aZUsG8B-XdOC4pFCrWpIYRg/s1600-h/google_earth.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 352px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz4ZN7z1vrDxvJSIGkto6Df2plKy8ofE9qfNCDZXH_fvecQERFjO5WmvjFfUJis_0cPIVq3ozgeBiZ-hSpzMcLp9YWmXBl4xZJcu22cm1ZMNH9pegQ_XE4aZUsG8B-XdOC4pFCrWpIYRg/s400/google_earth.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5383542197394940082" /></a><br /><br />All align perfectly. Now adding the same WMS to Modest Maps and overlaying it on Yahoo shows the WMS misaligned:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXG8SV5s5BsUco3vb1ClhJzeMpSgi_PAKwimvLo7iUrTxuPSdggaxwH3ymEgLinDpDT-A3tT0IE5Cf6dolf2BepWoJz8cmj-jsSWS21TSb5jelBedxKA4Jr03h5AVFyWprph6xB6PmrF4/s1600-h/modest_wms_issue.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 277px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXG8SV5s5BsUco3vb1ClhJzeMpSgi_PAKwimvLo7iUrTxuPSdggaxwH3ymEgLinDpDT-A3tT0IE5Cf6dolf2BepWoJz8cmj-jsSWS21TSb5jelBedxKA4Jr03h5AVFyWprph6xB6PmrF4/s400/modest_wms_issue.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5383542952675455746" /></a><br /><br />Turning to Openlayers, I find the same problem:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu3XFCuRLH4FLbln0v2XEQ8RkMFd7P-pe74NknQM_9z1gf_flrWR6CpX4rPyPFbVj9uqNQVSH-5-OjH38yLniExgC_a45rQkowAuGvDixgxSK4gznaBrU5QrAZkBf7qxb05H7swioBUrc/s1600-h/openlayers_wms_issue.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 266px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu3XFCuRLH4FLbln0v2XEQ8RkMFd7P-pe74NknQM_9z1gf_flrWR6CpX4rPyPFbVj9uqNQVSH-5-OjH38yLniExgC_a45rQkowAuGvDixgxSK4gznaBrU5QrAZkBf7qxb05H7swioBUrc/s400/openlayers_wms_issue.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5383543274150095330" /></a><br /><br />In each of the latter cases the WMS layer also looks stretched. I'll find the fix and post it.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com3tag:blogger.com,1999:blog-1743223945531919026.post-55083086376215202332009-09-19T07:24:00.000-07:002009-09-21T07:51:37.446-07:00Map Technology OverviewI've been on a technology review of late. Mostly driven by client requests. I never cease to be amazed by what is now available. So far my thoughts in brief:<br /><br />Mapserver is a pain to configure. Manually writing mapfiles, takes me back to the days of ArcIMS and axl files. Geoserver is far easier in every respect. It has a terrific admin interface. Setting up basic map services, WMS, WFS is easy. Exporting in formats read by google maps etc is also a piece of cake. If it were not for the need of a full application server, the choice of geospatial server would be easy. Geoserver also allows for easy generation of Georss, KML and viewing of map layers in openlayers.<br /><br />Caching and tiling is another area which favours Geoserver. Geowebcache is integrated into geoserver. No need for additional work. The config screen allows for easy seeding. Mapserver works with tilecache. From the work I have done so far you tile mapserver by calling tilecache and passing the mapserver url. <br /><br />I'm still working with openlayers but am so far very impressed. One thing I already notice is how much is there. I really like the Modest Maps Flex library. But with a smaller community, it does not have the same depth of code. I'm still playing here, so more feedback later.<br /><br />I'd like to know one of the big fours - mapquest, MSN, Yahoo and Google - API's. I lean towards mapquest, largely due to the feedback I have read and my impressions from conferences. I recently signed up for their developer account. A couple of people were soon emailing me with contact info. On one side I thought this great, since support might be more forthcoming. On the other side, money reared its ugly head. Use of this service beyond local testing has a price tag! Reminds me why I so favour open source.<br /><br />Other areas on my radar at the moment beyond testing the mapquest API include:<br />- Geodjango testing<br />- PostGIS and shapefile write up<br />- Javascript to Flex/Flash communication<br /><br />I'll write more on this in due course. I asked Paul Ramsey (OpenGeo and PostGIS author) his thoughts on Geoserver versus Mapserver. Here is his repy:<br /><br />If you are deep into OGC standards, Geoserver has a big advantage in<br />completeness of implementations of things like SLD and WFS. (Less on<br />WMS).<br /><br />I did a talk last year which, though tongue-in-cheek addresses the<br />more important differences. Which are philosophical more than anything<br />else. Scriptable web rendering engine vs complete spatial web<br />environment.<br /><br /><a href="http://s3.cleverelephant.ca/geoweb-mapserver.pdf">http://s3.cleverelephant.ca/geoweb-mapserver.pdf</a><br /><br />Most of the speed differences are gone at this point, they perform<br />very comparably for common use cases.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com2tag:blogger.com,1999:blog-1743223945531919026.post-17648476997322491352009-09-19T07:00:00.000-07:002009-09-24T07:03:25.684-07:00OpenlayersThe openlayers community seems to be becoming ever larger. Though I'm predominantly a Flex developer, its time I checked out Openlayers. On my recent WMS kick, I know combining WMS with other basemaps is well supported. Looking at the online docs I found this terrific <a href="http://openlayers.org/dev/examples/">examples page.</a><br />As a newbie I took out a few code examples:<br />1) Basic map<br /><br /><html><br /><head><br /> <title>OpenLayers Example</title><br /> <script<br /> src="http://openlayers.org/api/OpenLayers.js"></script><br /> </head><br /> <body><br /> <div style="width:100%; height:100%" id="map"></div><br /> <script defer="defer" type="text/javascript"><br /> var map = new OpenLayers.Map('map');<br /> var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br /> "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );<br /> map.addLayer(wms);<br /> map.zoomToMaxExtent();<br /> </script><br /></body><br /></html> <br /><br />2) WMS map<br /><br /><html><br /><head><br /> <title>OpenLayers Example</title><br /> <script<br /> src="http://openlayers.org/api/OpenLayers.js"></script><br /> </head><br /> <body><br /> <div style="width:100%; height:100%" id="map"></div><br /> <script defer="defer" type="text/javascript"><br /> var map = new OpenLayers.Map('map');<br /> var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br /> "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );<br /> map.addLayer(wms);<br /> map.zoomToMaxExtent();<br /> </script><br /></body><br /></html><br /><br />3) Locally running WMS<br /><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /> <script<br /> src="http://openlayers.org/api/OpenLayers.js"></script><br /> </head><br /> <body><br /> <div style="width:100%; height:100%" id="map"></div><br /> <script defer="defer" type="text/javascript"><br /> var map = new OpenLayers.Map('map');<br /> var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br /> "http://localhost:8080/geoserver/wms", {layers: 'topp:states_ugl'} );<br /> map.addLayer(wms);<br /> map.zoomToMaxExtent();<br /> </script><br /> </html><br /><br />4) Local WMS with Bing (note you will need to copy the OpenLayers.js file from<br /><a href="http://openlayers.org/dev/OpenLayers.js">http://openlayers.org/dev/OpenLayers.js</a>)<br /><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /> <head><br /> <title>OpenLayers Bing Example</title><br /> <link rel="stylesheet" href="../theme/default/style.css" type="text/css" /><br /> <link rel="stylesheet" href="style.css" type="text/css" /><br /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><br /> <script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&mkt=en-us"></script><br /><br /> <script src="OpenLayers.js"></script><br /><br /> <script><br /><br /> var map;<br /><br /> function init(){<br /> map = new OpenLayers.Map("map");<br /> map.addControl(new OpenLayers.Control.LayerSwitcher());<br /><br /> var shaded = new OpenLayers.Layer.VirtualEarth("Shaded", {<br /> type: VEMapStyle.Shaded<br /> });<br /> var hybrid = new OpenLayers.Layer.VirtualEarth("Hybrid", {<br /> type: VEMapStyle.Hybrid<br /> });<br /> var aerial = new OpenLayers.Layer.VirtualEarth("Aerial", {<br /> type: VEMapStyle.Aerial<br /> });<br /><br /> var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br /> "http://localhost:8080/geoserver/wms", {layers: 'topp:states_ugl'},<br /> {<br /> 'opacity': 0.4, visibility: true,<br /> 'isBaseLayer': false,'wrapDateLine': true<br /> }<br />);<br /><br /> map.addLayers([wms,shaded, hybrid, aerial]);<br /><br /> map.setCenter(new OpenLayers.LonLat(-110, 45), 3);<br /> }<br /><br /> </script><br /> </head><br /> <body onload="init()"><br /> <h1 id="title">Bing Example</h1><br /><br /> <div id="tags"></div><br /><br /> <p id="shortdesc"><br /> Demonstrates the use of Bing layers.<br /> </p><br /><br /> <div id="map" class="smallmap"></div><br /> <div id="docs">This example demonstrates the ability to create layers using tiles from Bing maps.</div><br /> </body><br /></html><br /><br />4) Openlayers controls<br /><br />For this example you'll need three files <a href="http://flexmappers.com/openlayers/OpenLayers.js">openlayers.js</a>, <a href="http://flexmappers.com/openlayers/style.css">style.css</a> and <a href="http://flexmappers.com/openlayers/theme/style.css">theme/style.css</a>. You'll need to create a theme directory for the latter. Note in theme/style.css the icons will need adding to a img directory. I have not done this here, so map icon will not appear.<br /><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /> <head><br /> <title>OpenLayers Map Controls Example</title><br /><br /> <link rel="stylesheet" href="theme/style.css" type="text/css" /><br /> <link rel="stylesheet" href="style.css" type="text/css" /><br /> <script src="OpenLayers.js"></script><br /> <script type="text/javascript"><br /> var map;<br /> function init(){<br /> map = new OpenLayers.Map('map', {<br /> controls: [<br /> new OpenLayers.Control.Navigation(),<br /> new OpenLayers.Control.PanZoomBar(),<br /> new OpenLayers.Control.LayerSwitcher({'ascending':false}),<br /> new OpenLayers.Control.Permalink(),<br /> new OpenLayers.Control.ScaleLine(),<br /> new OpenLayers.Control.Permalink('permalink'),<br /> new OpenLayers.Control.MousePosition(),<br /> new OpenLayers.Control.OverviewMap(),<br /> new OpenLayers.Control.KeyboardDefaults()<br /> ],<br /> numZoomLevels: 6<br /><br /> });<br /><br /><br /> var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br /> "http://labs.metacarta.com/wms/vmap0",<br /> {layers: 'basic'} );<br /> var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",<br /> "http://t1.hypercube.telascience.org/cgi-bin/landsat7",<br /> {layers: "landsat7"});<br /> var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",<br /> "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",<br /> {layers: "bathymetry,land_fn,park,drain_fn,drainage," +<br /> "prov_bound,fedlimit,rail,road,popplace",<br /> transparent: "true", format: "image/png" });<br /><br /> jpl_wms.setVisibility(false);<br /> dm_wms.setVisibility(false);<br /><br /> map.addLayers([ol_wms, jpl_wms, dm_wms]);<br /> if (!map.getCenter()) map.zoomToMaxExtent();<br /> }<br /> </script><br /><br /> </head><br /> <body onload="init()"><br /> <h1 id="title">Map Controls Example</h1><br /><br /> <div id="tags"><br /> </div><br /><br /> <p id="shortdesc"><br /> Attach zooming, panning, layer switcher, overview map, and permalink map controls to an OpenLayers window.<br /> </p><br /><br /> <a style="float:right" href="" id="permalink">Permalink</a><br /> <div id="map" class="smallmap"></div><br /><br /> <div id="docs"></div><br /> </body><br /></html><br /><br />5) Georss<br /><br />For this example you'll need to download this <a href="http://flexmappers.com/openlayers/georss.xml">georss.xml</a> feed (just copy source in your browser)<br /><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /> <head><br /> <title>OpenLayers GeoRSS Example</title><br /> <link rel="stylesheet" href="theme/style.css" type="text/css" /><br /> <link rel="stylesheet" href="style.css" type="text/css" /><br /> <script src="OpenLayers.js"></script><br /> <script type="text/javascript"><br /> var map, layer;<br /><br /> OpenLayers.ProxyHost = "/proxy/?url=";<br /> function init(){<br /> map = new OpenLayers.Map('map', {maxResolution:'auto'});<br /> layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br /> "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );<br /> map.addLayer(layer);<br /> map.setCenter(new OpenLayers.LonLat(0, 0), 0);<br /> map.addControl(new OpenLayers.Control.LayerSwitcher());<br /> }<br /> function addUrl() {<br /> var urlObj = OpenLayers.Util.getElement('url');<br /> var value = urlObj.value;<br /> var parts = value.split("/");<br /> var newl = new OpenLayers.Layer.GeoRSS( parts[parts.length-1], value);<br /> map.addLayer(newl);<br /> urlObj.value = "";<br /> }<br /> </script><br /> </head><br /><br /> <body onload="init()"><br /> <h1 id="title">GeoRSS Example</h1><br /><br /> <div id="tags"></div><br /><br /> <p id="shortdesc"><br /> Display a couple of locally cached georss feeds on an a basemap.<br /> </p><br /><br /> <div id="map" class="smallmap"></div><br /><br /> <div id="docs"><br /> <p>This demo uses the OpenLayers GeoRSS parser, which supports GeoRSS Simple and W3C GeoRSS. Only points are<br /> currently supported. The OpenLayers GeoRSS parser will automatically connect an information bubble to the map<br /> markers, similar to Google maps. In addition, the parser can use custom PNG icons for markers. A sample GeoRSS<br /> file (georss.xml) is included.<br /><br /> <form onsubmit="return false;"><br /> GeoRSS URL: <input type="text" id="url" size="50" value="georss.xml" /><br /> <input type="submit" onclick="addUrl(); return false;" value="Load Feed" onsubmit="addUrl(); return false;" /><br /> </form><br /><br /> <p>The above input box allows the input of a URL to a GeoRSS feed. This feed can be local to the HTML page --<br /> for example, entering 'georss.xml' will work by default, because there is a local file in the directory called<br /> georss.xml -- or, with a properly set up ProxyHost variable (as is used here), it will be able to load any<br /> HTTP URL which contains GeoRSS and display it. Anything else will simply have no effect.</p><br /><br /> </div><br /> </body><br /></html><br /><br />There are so many examples online. I walked through some, here is a list of just some of the functionality:<br /><br />Openlayers<br /><br />Overview map<br />Random pan<br />Layers on off tab<br />Arcgis restful call<br />Arcims combine<br />Bing layers<br />Add box to map<br />Buffer how many tiles are included outside the view area<br />Map click events<br />Draggable rectangle<br />Fractional zoom (rectangle zoom)<br />Adding points, lines and polygons<br />Toolbar - points, lines and polygons<br />Digitising<br />Eventing<br />GeoRSS – Flickr, markerRory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-81750433665370052632009-09-16T16:16:00.000-07:002009-09-16T16:18:55.165-07:00TileCache and Google MapsFound the following <a href="http://crschmidt.net/blog/archives/311/using-tilecache-with-google-maps-and-virtual-earth/">excellent entry</a> from Christopher Schmidt blog. I'll give it a whirl and post my results.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-90092852454615217982009-09-16T15:52:00.000-07:002009-09-16T16:06:26.056-07:00MapServer and TileCacheSpent some time today looking at using TileCache with MapServer. I used in part these <a href="http://oegeo.wordpress.com/2008/03/08/the-5-minute-guide-to-setting-up-tilecache-on-windows/">docs</a>. Other useful docs are <a href="http://tilecache.org/readme.html">here from Metacarta</a>. I walked through the following (note I am using my work with Mapserver described in an earlier post):<br /><br />1) Installed <a href="http://www.python.org/ftp/python/2.5.2/python-2.5.2.msi">Python</a><br /><br />2) Downloaded <a href="http://tilecache.org/tilecache-2.0.tar.gz">TileCache </a><br /><br />3) Unzipped the TileCache directory, ran the setup executable and copied the contents under the directory into C:\ms4w\Apache\cgi-bin<br /><br />4) Opened C:\ms4w\Apache\cgi-bin\tilecache.cgi and changed the top line to:<br /><br /> #!C:/Python25/python.exe -u<br /><br />5) I added the following to the C:\ms4w\Apache\cgi-bin\tilecache.cfg file<br /><br />[mapserver]<br />type=WMS<br />url=http://localhost:81/cgi-bin/mapserv.exe?map=/ms4w/Apache/htdocs/wms_mapserver/data/ms_wms.map<br />extension=png<br />layers=states_ugl<br />SRS=EPSG:4326<br />bbox=-97.6169,39.9179,-81.745,51.0875<br /><br />6) Running the following:<br /><br />http://localhost:81/cgi-bin/tilecache.cgi?layers=mapserver&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:4326&bbox=-97.6169,39.9179,-81.745,51.0875&format=image/png&width=400&height=300<br /><br />gives the map image served by MapServer.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-72865394875109613642009-09-16T13:44:00.000-07:002009-09-16T13:48:28.738-07:00MapQuest Flex API SamplesNow leaning towards the Mapquest Flex api. I spied the following <a href="http://developer.mapquest.com/content/codeSamples/532/Samples/Samples.html">demo applications</a>. This demonstrates with source code, some of the core functionality.<br /><br />On a side note. The AIR application <a href="http://www.adobe.com/devnet/flex/tourdeflex/">Tour de Flex</a> is well worth installing if you build Flex apps. From a mapping perspective they demo a number of the main mapping API's.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com1tag:blogger.com,1999:blog-1743223945531919026.post-56930171858127167452009-09-15T15:14:00.001-07:002009-09-16T13:49:02.422-07:00Flex Developer ListSometimes useful people to ask for solutions for those hard to solve problems. Here is one persons <a href="http://seantheflexguy.com/blog/2009/08/11/50-important-flash-platform-developers/">experts list</a>.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-91263497787105371292009-09-15T14:55:00.001-07:002009-09-15T15:03:50.292-07:00Mapping API'sI'll admit to being somewhat locked into the Modest Maps Flex API. As recent blog entries suggest, I've started looking at combining WMS and WFS data - served from MapeServer or Geoserver - with basemaps. I've had a number of people approach me about this combination, plus I've wanted the excuse the exlpore further.<br /><br />Another area which I have started investigating are other Flex/Flash mapping API's. The main four are ESRI ArcMap, Google maps, Yahoo and Mapquest. I came across the following <a href="http://blog.kevinhoyt.org/?p=187">article </a> written by Kevin Hoyt of Adobe. He compared the Google, Yahoo and Mapquest last year. Finding Mapquest the richest and best supported. He did a <a href="http://chrisgriffith.files.wordpress.com/2008/08/mappingtalk.pdf">presentation </a>which included Modest maps and ESRI's API. Its worth a read.<br /><br />For me, after chatting with Mapquest at Where 2.0 this year, and based on what I have read, I'll turn my attention here first.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-20796861887000676182009-09-13T14:34:00.000-07:002009-09-21T07:27:49.720-07:00Modest Maps, WMS and OverviewLooking at the docs on wms and multiple providers the following proved a useful link:<br /><br />http://getsatisfaction.com/modestmaps/topics/how_to_layer_two_maps_with_different_providers_for_blending_alpha_transparency_etc<br /><br />I'll post my code in due course.<br /><br />On a related note, here is a URL for an overview map with Modest maps<br /><br /><a href="http://blog.modestmaps.com/2008/11/hello-world/">http://blog.modestmaps.com/2008/11/hello-world/</a>Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com0tag:blogger.com,1999:blog-1743223945531919026.post-78126837605268241092009-09-13T12:40:00.001-07:002009-09-14T05:42:46.248-07:00GeoServer and WMSGeoserver is a truly fabulous open source geospatial server. Much easier to set and configure than Mapserver. The documentation provided is extremely comprehensive. See:<br /><br />http://docs.geoserver.org/1.7.6/user/getting-started/web-admin-quickstart/index.html<br /> <br />Here are the notes I made as I walked through setting things up.<br /><br />a) Setting up geoserver<br /><br />I am using the portable gis control panel (see earlier blog entry). Once installed it sits directly under c:/.When you open it you have the option (under web modules) to start Geoserver. <br />Access Geoserver via:<br /><br />http://localhost:8080/geoserver<br /><br />admin/password are the default credentials. If you need to change them look at:<br /><br />C:\Program Files\GeoServer 1.7.6\data_dir\security\user.properties<br /><br />b) Adding shapefile<br /><br />Under the data directory for geoserver add some new data in the data directory:<br /><br />C:\Program Files\GeoServer 1.7.6\data_dir\data\ <br /><br />In the web interface click on data -> datastores -> new. Add name and type. Next screen add path to data and data name eg. nyc_roads.shp. Now click submit. The next screen should be the featuretype editor. Now from drop down select the type eg. line add the srs, then click generate. Now click submit and finally apply. Note these two steps in this order are critical in the process.<br /><br />In the web interface under data->datastores you should now see your new data<br /><br />You can view the data in welcome->demo->map preview<br /><br />c) WMS<br /><br />In config screen choose wms. Next choose contents and add the layer you just created in this screen. You can get the SRS info from the featuretype editor under data<br /><br />One of the amazingly cool things about geoserver is the demos page in the web interface. From here you can view the results of various requests. Choose sample requests to see these options; wms, wfs etc. Also from here you can select map preview. From here you can see your newly loaded data. Another terrific thing about geoserver is the integration of openlayers. Data can be viewed directly in the geoserver interface with openlayers<br /><br />d) Geowebcache<br /><br />Another terrific part of geoserver is the integration of geowebcache. There is a nice guide to this here:<br />http://geoserver.org/display/GEOSDOC/GeoServer+GeoWebCache+Configuration<br /><br />Key directory is C:\Program Files\GeoServer 1.7.6\data_dir\gwc. Go to:<br /><br />http://localhost:8080/geoserver/gwc/demo<br /><br /><br />Here you can see all of your layers and ‘seed this layer’. Seeding is generating tiles. When you select seed this layer you will see under the gwc directory your newly generated tiles.<br />If you go to the demo page and view your data. In openlayers you have the option to view the data as a single image or tiled. The latter will show your newly generated tiles. <br /><br />If you wish to see the data in google earth. Open Google earth, choose add->network link. Add a name and the url below to the pop up. <br /><br />http://localhost:8080/geoserver/gwc/service/kml/topp:nyc_roads.png.kml<br /><br />By selecting the named link in google earth (under my places) you should see your data.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com3tag:blogger.com,1999:blog-1743223945531919026.post-11439015031616930652009-09-11T06:24:00.000-07:002009-09-11T07:18:46.451-07:00WMS and MapServerI'm in the process of setting up Mapserver to serve up maps via WMS. It has been a while. The steps I went through are as follows:<br /><br />1) Download <a href="http://www.maptools.org/ms4w/">MS4W </a>. This is a package which bundles Mapserver with PHP and Apache. Saves time on configuration. I set the Apache port to 81, since I already have another version running on 80. The default location of all installed files is c:/ms4w. <br /><br />2) Installed Quantum GIS. Again you can use another <a href="http://www.archaeogeek.com/blog/2009/09/01/portable-gis-version-2-released/">bundled package</a> which includes geoserver and many other open source tools. Alternatively you can get the software direct.<br /><br />3) Quantum GIS contains a nifty plug in for generating .map or mapfiles for Mapserver (the alternative is to write them by hand which can be a major pain). This can be done via the plugin menu option. Once installed, this is the plug in window: <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitI_Vef-QDXXXfRBJqGof58mQdTrVRXF4db7MLOQuSgQCMutb0Y_bKNUzu6qZeAmrsf-0pMCUCGe0AQYZChc83RMt2tSsW8nSbyi0XyCzhUGphqANNDyPVEjo2cvGhq1o0LrjOuG0NCHE/s1600-h/quantum.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 274px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitI_Vef-QDXXXfRBJqGof58mQdTrVRXF4db7MLOQuSgQCMutb0Y_bKNUzu6qZeAmrsf-0pMCUCGe0AQYZChc83RMt2tSsW8nSbyi0XyCzhUGphqANNDyPVEjo2cvGhq1o0LrjOuG0NCHE/s400/quantum.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5380203287053861538" /></a><br /><br />Two things to remember. First, create an empty .map file in your favourite text editor. In the plug in interface, you need to point to an existing .map file. The Quantum plug in will overwrite this file. Second, I found it easier to put the .map file and shapefiles (at least for this initial trial) in the same directory. <br /><br />You should now have a working mapfile. Now for WMS. You will need to edit the generated mapfile to add additional parameters. This and the required url parameters are a pain. After much searching I found these two links very useful:<br /><br />http://www.mapserver.org/ogc/wms_server.html#table-of-contents<br />http://ms.gis.umn.edu:8081/ms_plone/docs/howto/mapcontext<br /><br />I'll not walk too much through the additions, but they mostly involve adding elements under the METADATA tag. Here is my working mapfile:<br /><br /># Map file created from QGIS project file C:/matts/generatefile/test.qgs<br /># Edit this file to customize for your map interface<br /># (Created with PyQgis MapServer Export plugin)<br />MAP<br /> NAME test<br /> # Map image size<br /> SIZE 400 300<br /> #UNITS meters<br /><br /> EXTENT -97.616877 39.917875 -81.745000 51.087523<br /> PROJECTION<br /> 'proj=longlat'<br /> 'ellps=WGS84'<br /> 'datum=WGS84'<br /> 'no_defs'<br /> ''<br /> END<br /><br /> # Background color for the map canvas -- change as desired<br /> # IMAGECOLOR 192 192 192<br /> #IMAGEQUALITY 95<br /> IMAGETYPE png<br /> OUTPUTFORMAT<br /> NAME png<br /> DRIVER "GD/PNG"<br /> MIMETYPE "image/png"<br /> IMAGEMODE RGB<br /> EXTENSION "png"<br /> FORMATOPTION "INTERLACE=OFF"<br /> END<br /> # Legend<br /> LEGEND<br /> IMAGECOLOR 255 255 255<br /> STATUS ON<br /> KEYSIZE 18 12<br /> LABEL<br /> TYPE BITMAP<br /> SIZE MEDIUM<br /> COLOR 0 0 89<br /> END<br /> END<br /><br /> # Web interface definition. Only the template parameter<br /> # is required to display a map. See MapServer documentation<br /> WEB<br /> # Set IMAGEPATH to the path where MapServer should<br /> # write its output.<br /> IMAGEPATH '/tmp/'<br /><br /> # Set IMAGEURL to the url that points to IMAGEPATH<br /> # as defined in your web server configuration<br /> IMAGEURL 'http://localhost:81/wms_mapserver/tmp'<br /><br /> # WMS server settings<br /> METADATA<br /> 'wms_title' 'test'<br /> 'wms_onlineresource' 'http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/wms_mapserver/data/ms_wms.map&'<br /> 'wms_srs' 'EPSG:4326'<br /> "wms_extent" "201621.496941 -294488.285333 1425518.020722 498254.511514"<br /> #"wfs_title" "test WFS Demo Server" ## REQUIRED<br /> END<br /><br /> #Scale range at which web interface will operate<br /> # Template and header/footer settings<br /> # Only the template parameter is required to display a map. See MapServer documentation<br /> END<br /><br /> LAYER<br /> NAME 'states_ugl'<br /> TYPE POLYGON<br /> DATA 'C:/ms4w/Apache/htdocs/wms_mapserver/data/states_ugl.shp'<br /> METADATA<br /> "wms_name" "states"<br /> "wms_server_version" "1.1.1"<br /> "wms_format" "image/png"<br /> "wms_srs" "EPSG:4326" <br /> "wms_title" "States" ##required<br /> "wms_extent" "201621.496941 -294488.285333 1425518.020722 498254.511514"<br /> "wms_onlineresource" "http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/wms_mapserver/data/ms_wms.map?"<br /> #"wfs_version" "1.1.0"<br /> # "wfs_srs" "EPSG:4326"<br /> # "wfs_typename" "statefs"<br /> # "wfs_request_method" "GET"<br /> # "wfs_service" "WFS"<br /> #"wfs_title" "statefs" ## REQUIRED<br /> #"gml_featureid" "ID" ## REQUIRED<br /> #"gml_include_items" "all" ## Optional (serves all attributes for layer)<br /> END<br /> #CONNECTIONTYPE WMS<br /> STATUS ON<br /> TRANSPARENCY 100<br /> PROJECTION<br /> 'proj=longlat'<br /> 'ellps=WGS84'<br /> 'datum=WGS84'<br /> 'no_defs'<br /> ''<br /> END<br /> CLASS<br /> NAME 'states_ugl' <br /> STYLE<br /> SYMBOL 0 <br /> SIZE 2 <br /> OUTLINECOLOR 0 0 0<br /> COLOR 144 50 207<br /> END<br /> END<br /> END<br /><br />END<br /><br /><br />As you can see this sits in the following directory with my shapefile:<br /><br />C:/ms4w/Apache/htdocs/wms_mapserver/data<br /><br />I did my testing using Internet Explorer. As mentioned, the required url parameters are a pain. Here are the two key calls; getCapabilities:<br /><br />http://localhost:81/cgi-bin/mapserv.exe?map=/ms4w/Apache/htdocs/wms_mapserver/data/ms_wms.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities<br /><br />and getMap. Note all parameters except styles are required:<br /><br />http://localhost:81/cgi-bin/mapserv.exe?map=/ms4w/Apache/htdocs/wms_mapserver/data/ms_wms.map&service=WMS&version=1.1.1&request=GetMap&layers=states_ugl&srs=EPSG:4326&bbox=-97.6169,39.9179,-81.745,51.0875&format=image/png&width=400&height=300&styles=default<br /><br />I struggled for a while on the getMap call. One problem I realised was the BBox parameters you need to get from getCapabilities (I grabbed it directly from the mapfile). I also initially added connectiontype "wms" for the layer in the mapfile which broke everything - actually i could not generate an image. As soon as that was removed bingo.<br /><br />Grab this <a href="http://www.flexmappers.com/wms_mapserver.rar">source</a>, unrar and place in your C:/ms4w/Apache/htdocs. You should now be able to run the above.Rory Biggadikehttp://www.blogger.com/profile/15296078414551719200noreply@blogger.com1