GISOstrava2009 25.-28.1.2009,Ostrava ______ Spatialdatavisualizationbyusageofchosenfreeofchargetools forcreationofcompositewebmapapplications

Ji říArdielli 1,TomášMinar čík 2,BronislavaHoráková 3

1Institutgeoinformatiky,Hornicko-geologickáfakulta,Vysokáškolabá ňská–TechnickáuniverzitaOstrava, 17. listopadu15,70830,Ostrava-Poruba, Českárepublika [email protected] 2Institutgeoinformatiky,Hornicko-geologickáfakulta,Vysokáškolabá ňská–TechnickáuniverzitaOstrava, 17. listopadu15,70830,Ostrava-Poruba, Českárepublika [email protected] 2Institutgeoinformatiky,Hornicko-geologickáfakulta,Vysokáškolabá ňská–TechnickáuniverzitaOstrava, 17. listopadu15,70830,Ostrava-Poruba, Českárepublika [email protected]

Abstract. Thewebapplicationsenablingdynamicvisualizationofspatialdataandinteractiveuser interface are a part of today’s fast development of web applications. Many modern web map applicationsoffertheirfunctionalitybydevelopmenttoolscalledAPI.Developersgainingoptionto use these powerful tools to easier and faster creating new web map applications. Possibility of combinationmorethanoneAPIofwebapplicationsandhugeamountofdatasourcesintosingle applicationisdomainofnewtechnologycalledMashups.Firstinthisarticle,thereisdescribedthe utilizationofAMapyAPIservice,whichisdeterminesnotonlyforrapidinsertionofmapintothe webpages,butalsofordevelopmentofsophisticmapapplications.Inthebeginningofthearticle therearedescribedindividualpropertiesofthisAPI, license agreements,compatibility, functions andprogrammingpossibilitiesofthisinterfaceincludingdescriptionofbasicclasses,theirmethods and properties. The next part of the article describes web projects for building composite web applicationsonlinethroughinternetbrowser.Thistoolsarecalledmashupeditors.Withtoolslike this and new technologies can be developed robust web map applications, which could be concurrencetoexistingweb-basedmapserversforprocessingandvisualizingspatialdata. Keywords: Atlas,AMapy,Web2.0,API,application,Mashups,GIS,GeoWeb.

1 Introduction

Theformerlyunclearcontentofstaticpagesisbeingreplacedbycomponentsdynamicallycapableof reactingonneedsandwishesofhumanaswellasmachineusers.Thecreatorofwebisnotjusta group of professionals experienced in web technology anymore but continuously growing mass of users who move their information, knowledge and activities into the web environment. Regarding thesechangestodayitisoftenbeingtalkedaboutWeb2.0,a2ndgenerationweb.[4] TenyearsagoGISwereexclusivelydesktopapplications.Currentdevelopmentisheadingfrommap servers and thin clients to a new generation of products in a form of web services or so called mashupswhichinthefuturewillbeabletouse,processandmakedistributedsourcesoftheinternet availablebyaneffectiveanddynamicapproach.Hugeamountsofdatasourcesandfunctionalitiesof existingas well asfuturemapapplicationsandserviceswill allow itscombining which will leadinto formationofbrandnewproducts. Overthepastfew yearslargesoftwarecompaniessuchasGoogleandMicrosofthaveappearedin thefieldofwebapplicationsdevelopment,usableingeoinformatics.Webmaps’applicationsofthese companiesoffertousethosefunctionandpossibilitiestoallinternetusersthatuntilrecentlywereonly availableatmapservers.Thosewebprojectsalsocontainanumberofspatialdatathattheuserscan use.Withthearrivaloftechnologiesandstylesofthewebapplications’developmentstyle,mostmap applications offer their own API, through which the users can use the functionalities of these applicationswithinthescopeortheirownwebprojects. TheAPIisabbreviationofEnglishwords“applicationprogramminginterface”.Thistermisusedbythe software engineering discipline in programming techniques. It is concerned about collection of procedures, functions or classes of some library (but also possibly of some another application or some operating system’s core), which can the programmer use, when using this library. The API determines the way of calling the library’s functions from the source code of the program. The GISOstrava2009 25.-28.1.2009,Ostrava ______ functions of API are the programming complex, which the programmer is using instead of programmingthisonitsown[11]. Theso-calledmashuptechnologycameintoexistenceduetothecombinationofAPIwebapplications and various data sources. Anyone can create the mashup application by using various API web projectfunctionsandnotonlybyusingthespatialdataplacedontheinternet.Tomakesurethatthe creationofmashupwillnotbecomeaprivilegeofuserswiththeprogrammingknowledge,promising webprojectswithgraphicuserinterfacearecomingtoexistenceontheinternet.Withthehelpofthese even a user who lacks the programming languages knowledge can interactively create his own mashupapplication.

2 APIofthewebmapapplications

Many modern geoweb applications and big web portals offer their functionality by Map API. Some companies make their Map APIs freely available. Since 2005 start evolution of creating application usingMapAPI’sabroad.InCzechrepublicisdatedthestartofreleasingMapAPI’sintheendofthe year 2006 and still there is a only few usable solutions. Between the mostly used API’s with MapMashupsare: • Abroad: o GoogleMapsAPI o YahooMaps o MicrosoftvirtualearthinteractiveSDK • IntheCzechRepublic: o SeznamMapyAPI o AtlasAmapyAPI • Open-source o OpenLayers.org o Mapstraction.com

3 APIoftheCzechwebmapapplications

WebmapapplicationsoftwobiggestportalsarecurrentlymostlyusedintheCzechRepublic.Thatis Atas.czandSeznam.cz.Before,therewasonemoreproviderofCentrum.czwiththeirownwebmap application,buttherewasfusionofAtlas.czandCentrum.czintoonegroup.Thesetwoportalsallow mapapplicationsfunctionsthroughtheirownAPI.PossibilitiesofAPIutilizationandcodesamplesare innextdescribedonserviceexampleofonerandomlyselectedprovider.

3.1 IntroductiontoAMapyAPI

TheAMapyAPIistheserviceofferedbytheATLAS.CZ,a.s.company,whichisoperatorof“AMAPY API”webportal.Theservice“AMapyAPI”islocatedathttp://api.amapy.czwebaddress,whichbyhelp ofJavaScriptenablestodepictnotonlythemap’sbackgroundonitspages.Theuserisauthorized andenabledtousethisserviceaftercompletionofregularregistrationandobtaininggeneratedunique key(GUID)sent by email,on whicheachusercan pursuetheAPI. Eachkey isbindto thecertain domainnameanditisnotpossibletousethiskeyonanotherdomainname.Foreachdomainitis necessarytogeneratetheindividualkey.Fromthelocaladdresses(http://localhost)andfromthefile systemitispossibletopursuetheAPIevenwithoutgeneratedkey.ThearchitectureofAmapyAPIis basedonmodernobjectlanguageJavaScriptyear2007[1]. The map background of the Czech Republic is provided by subcontractor DPA s.r.o. company in scales1:400000,1:200000,1:100000,1:50000,1:25000,1:10000and1:5000.[2] GISOstrava2009 25.-28.1.2009,Ostrava ______ Bythehelpofprovidedprogramminginterfacetheprogrammercantocreatethemapapplications,to definethecontrolelementsofthemap,todefinemarksinthemap,tocreatetheinformbubbleswith variantcontentsandothers.Itistalkedaboutso-calledMashupapplications.Suchapplicationutilizes andpresentsdatafrommorethenonesourceandintegratesthemintoonesceneoroneinstrument. With the term Mashup application very closely relates the AJAX technology [5] (Asynchronous JavaScript and XML), which is dedicated for interactive web application development. It concerns aboutso-calledasynchronousdatatransmissionbythehelpofJavaScriptlanguageandXMLmarkup language.InrealitytheAJAXisnotconcreteindividualtechnology,butthistermspecifiestheusageof several technologies together with especial target. Then, the applications developed by this technology,areenabledtochangethepartofitswebpagecontentwithoutnecessityoftheircomplete reload from the server. Thereby it offers to the user pleasanter and more interactive space in comparison with classic web application. The dynamical changes present information and their depictionareensuredbytheJavaScriptlanguageandbyDOM(DocumentObjectModel).DOMisan APIwhichfacilitatesaccessormodificationofcontent,structureorstyleofdocumentoritsparts[9]. By this is realized manipulation with HTML elements by help of JavaScript language. For asynchronousdataexchangewithwebserverbythehelpofAJAXtechnologyisutilizedXMLformat, HTML, JSON or plain text. Communication between server and clients is carry out by XMLHttpRequest[7](XHR)interfacethroughHTTPprotocol.

3.2 Usageconditionsandcompatibility

Withopportunityofthisserviceutilizationtherearespecifiedsomeprovider’sconditions.Amongthe mostimportantpointsofgenerallicenseagreementsforusageofAMapyAPIbelongsfollowed: • Onnon-commercialpagesispossiblefreelytouseAMapyAPIwithoutrestrictions. • If the load exceed significantly the average values, the service will not be canceled, but Mashup‘suserwillbecontactedbytheproviderandtherewillbemakeanofferofadditional connectivity. • OncommercialpagesispossiblefreelytouseAMapyAPIuntiltheserviceisofferedtothe useratnocharge,publiclyandwithoutanyrestrictions. • ThereisnopossibilitytouseAMapyAPIasancomponentpartofpaidapplication,orclosed applicationlikeintranet. • MashupmustrefertoactualversionofAMapyAPI. APIwastestedonFirefox,OperaandInternetExplorer6and7webbrowsers.Safari,Konquerand KHTMLwillbegraduallyfollowed.AMapyAPIsupportsonlystandardwebbrowsersmode.[1]

3.3 AMapyAPIpossibilities

Infollowinglistarespecifiedpossibilities,whichareofferedbytheinterface: • Depictionofthemap • Additionofcontrolpanelsonmap • Depictionnon-elasticinformationbubbleforshorttextmessages • Definitionofinformationelasticbubblescontainingtext,integratedpicturegalleryorpotencyto depictHTMLpages • Informationelasticbubblescancontainbookmarksandalsocancontainfooter • Additionofmarkstothemaps • Creationofownicons • Possibilitytodrawvectorline • Settingupofscaleandcenterofthemap • Supportofmorecartographiccoordinatesystems(S42,WGS84,JTSK) • SupportforAJAX,DOMscripting,JSONandobjectmodelformaplayersdescription GISOstrava2009 25.-28.1.2009,Ostrava ______ 3.4 AMapyAPIutilization

Servicesprovidedby AMapyportalcanbeusedby thehelpofHTMLmarkuplanguageandbythe help of JavaScript language. The API has defined classes, for which is possible by the “new” constructor to create new objects and consequently to define property’s values of this objects. For some of them there are already defined events, to which there is possibility to attach the handler (method,whichservestheevent,iscalledbyoccurrenceofgivenevent).Aswellthereispossibilityto definetheindividualeventstotheobjectsandattachserviceeventsbythemethod addEven tothem. Nexttherearedeclaredfunctions,theirargumentsandreturneddatatypefortheclasses.

3.5 Controlelementsandpositioningofthemap

ThefirststepforutilizationofAMapyserviceandforlaunchingofthemapsonowninternetpageisto placethereferencetothefilecontainingJavaScriptcodeintoheadsectionofHTMLfile: AsanargumentofGUIDvariablethereispossibletoplacethegeneratedkey.TheMapisdrawninto DIV elementwithpracticallyhaphazarddimensions: Themapisanobjectof AMap classandismadebytheconstructor,wheretheargumentisavalueof DIV tag’sidentifierwhichdefinestheplacement. varMap1=newAMap("IDMap"); Theinitializationofthemapcouldtraditionallystartsupbythehelpof onload eventof BODY element. However this event occurs in the moment of complete object load. In this case it happens after complete web page loading including all pictures. Here grows the risk of even one page’s element non-loading(forexampleexternalpictureswithadvertising)andthemapwouldnotdisplay.Thereby there will be used domready event, which occurs after DOM assembling. This event occurs earlier thanonloadevent,alsoimmediatelyafterpage’scodereadin. After formation of the map there can be created and placed next objects. From among the basics belongs the control element of the map. Amapy API provides three control elements for map controlling :AMapControl,ASmallMapControlandAMapTypeControl. Forthedefinitionofthesecontrolelementsoverthemapthereexistafunctioncalled addMapPart . When the map is side moved, the control elements do not change their position [1]. The first two mentionedelementsmakepossiblethemapzoominginandzoomingoutanditsmovementintofour directions.Thedifferentisonlyintheirappearance.Thelastmentionedelementmakespossiblethe switchingamongthetypesofmap’sbackgrounds,atpresentamongairmapandbasicmap.Theuser can define own elements (so-calledmap parts) with the help of AMapPartDraggable abstract class. ThefinalmapwithtwoaddedcontrolelementsplacedonownwebpageisdepictedattheFig1.

3.6 Marksandpointelementsonthemap

Amarkgraphicsymbolonthemapcanbemadebythepositioningofobjectof AMarker class.Firstit is necessary to define a point for positioning together with coordinate system using the object of AGeoPoint class,andthentocreateamarkandconsequentlyaddittothemapbythehelpofmap’s addOverlay method. For addition of more number of marks, which are saved in array type variable,serve the method addMarkers . AMapy support three coordinate systems: the military S42, theglobalGPSandJTSKofCzechtouristclub.Themarkobjectcanberepresentedbythepictureor by the plain text. It can respond to a lot of events. As the mark, it is possible to use one of the predefinedicons,oritsappearanceandpropertiesdefinein AIcon object,bywhichwecandefineour ownpicture.Itcanbedefinedasa.giffileformatpictureortransparent.pngfileformat,therecanbe shadows, description for the icon, the different appearance for three state types (normal, hover, GISOstrava2009 25.-28.1.2009,Ostrava ______ active),ortheiconcanbecreatebyCSScascadingstylesheets.NextpreviewofHTMLlanguageand JavaScriptsourcecodepresentsmapcreation,controlelementsplacingonthemapandadditionof themark. Borehole�Map�|�AMapy�API varPage={ load:function(){ varMap1=newAMap("IDMap");//creationofthemap Map1.loadMaps();//loadingthemap Map1.addMapPart(newASmallMapControl());//additionofzoomandmovementcontrolelement Map1.addMapPart(newAMapTypeControl());//additionofmapchangecontrolelement varpoint=newAGeoPoint(3460690,5551757,ACoordinateSystem.S42);//definitionofthepoint varmark=newAMarker(point);//creationofthemark Map1.addOverlay(mark);//additionofthemarktothemap } } window.addEvent('domready',Page.load.bind(Page));