Home
CartoWeb Documentation
Contents
1. gt zoomPointLocationRequest gt scale 200000 Now request object is ready SOAP method is called try result Sclient gt getMap request print ri Sresult esatch Seapranlt Stanit 4 onime Sra e gt realt sieiealinveyy gS Result is shown below It includes relative paths to generated images and new bounding box computed from requested scale stdClass Object timestamp gt 1107925732 serverMessages gt Array imagesResult gt stdClass Object className gt ImagesResult mainmap gt stdClass Object isDrawn gt 1 path gt images 110839565198671 jpg width gt 500 height gt 500 format gt keymap gt stdClass Object isDrawn gt path gt width gt height gt format gt scalebar gt stdClass Object isDrawn gt 1 path gt images 110839565198672 png width gt 300 height gt 31 format gt locationResult gt stdClass Object className gt LocationResult 136 Calling Plugins bbox gt stdClass Object minx gt 536770 840477 miny gt 136770 840477 maxx gt 563229 159523 maxy gt 163229 159523 scale gt 200000 1 4 3 Executing a Query The following code shows how to use queries to display hilighted selection and to retrieve corresponding attributes First thing to do is to declare the SOAP client Class SoapClient will need the WSDL co
2. MapServer PHP MapScript from MapServer gt 4 4 See http www maptools org php_mapscript for more information and installation instructions Note If you are using Debian and you need to install MapServer you can have a look at Appendix A Mapserver Debian Installation Note If you are using Windows simply use the Windows Installer Section 1 1 2 CartoWeb Download If you absolutely want to install MapServer manually see Appendix B Apache amp Mapserver Windows Manual Installation PostgreSQL with PostGIS Support Optional If you want spatial database support in CartoWeb you will need to install PostGIS of the PostgreSQL database See http postgis refractions net for more information 1 1 2 CartoWeb Download There are two ways to get CartoWeb 1 Complete package from the official website o Download CartoWeb package from http cartoweb org downloads html It is recommended that you download the version with demo for a better user experience o Uncompress the archive somewhere in your path accessible by your web server 17 Installation 2 From CVS Get the current development version via CVS using the following command cvs d pserver anonymous dev camptocamp com var lib cvs public co cartoweb3 From CVS with cw3setup php If you already have the cw3set up php file which comes along the CartoWeb package or CVS source you can fetch CartoWeb from CVS and set up it at once See Secti
3. Warning Setting this option to false means that your template won t be updated any more Pay attention to this if you need to change them on the server 5 2 WSDL Cache When using SOAP and the useWsd1 option is set to true in the client_conf client ini or server_conf server ini the WSDL generated document can be cached for more performance This is the purpose of this cache option So it should be activated in production environment and turned off during development if your changes have an impact on the WSDL 5 3 MapInfo Cache MapInfo is a structure generated on the server and used by the cartoclient to access static server information This cache keeps a copy of the MapInfo structure on the http smarty php net 44 Caches Configuration client or the server so that the client does not need ask it everytime and the server can avoid regenerating it from scratch 5 4 MapResult Cache This is a server side only cache which caches the requests made to the server This cache works at the Php level meaning that it can be used when CartoWeb is used in direct or SOAP mode For the distinction between these two modes see Section 4 2 client ini However the XML SOAP cache is more appropriate when using SOAP mode see details in the next chapter 5 5 XML SOAP Cache This one is also a server side only cache caching requests at the lowlevel XML SOAP exchange This means this cache is only effective when
4. gt defaultTableFlags gt returnAttributes true Srequest gt queryRequest gt defaultTableFlags gt returnTable true Srequest gt queryRequest gt querySelections array Now request object is ready SOAP method is called REIENZ result Sclient gt getMap S request printlriSresult catch SoapFault S fault print Sfault gt faultstring R Result is shown below It includes relative paths to generated images and new scale computed from requested bounding box Query results include one table per layer No results were found in layer swiss_layer_1 and two results in swiss_layer_2 As requested attributes here attribute_3 and attribute_4 are returned for each row stdClass Object timestamp gt 1107925732 serverMessages gt Array 138 Calling Plugins imagesResult gt stdClass Object className gt ImagesResult mainmap gt stdClass Object isDrawn gt 1 path gt images 110846607738541 jpg width gt 500 height gt 500 format gt keymap gt stdClass Object isDrawn gt 1 path gt images 110846607738542 png width gt 150 height gt 99 format gt scalebar gt stdClass Object isDrawn gt path gt width gt height gt format gt locationResult gt stdClass Object className gt LocationResult bbox gt stdClass Object minx gt 550000 miny gt 100
5. lt complexType gt e array list of layers lt complexType name SwitchInit gt lt all gt lt element name id type xsd string gt lt element name label type xsd string gt lt all gt lt complexType gt e id switch ID e label switch label lt complexType name ArrayOfSwitchInit gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types SwitchInit gt lt restriction gt lt complexContent gt lt complexType gt e array list of switches lt complexType name LayersInit gt LALEA lt element name notAvailableIcon type xsd string gt lt element name notAvailablePlusIcon type xsd string gt lt element name notAvailableMinusIcon type xsd string gt lt element name layers type types ArrayOfLayer gt lt element name Switches type types ArrayOfSwitchInit minOccurs 0 gt lt all gt lt complexType gt 116 Calling Plugins e notAvailablelcon filename of icon for not available layer current scale is above or below this layer maximum minimum scale e notAvailablePlusIcon filename of icon for not available layer current scale is above this layer maximum scale e notAvailableMinusIcon filename of icon for not available layer current scale is below this layer minimum scale e layers list of layers e switches list of switches 1 2 3 Location This includes configuration specif
6. lt complexType gt e className ImagesResult or extended class name if project implements an extension e mainmap main map image information see Section 1 3 2 1 Images Request for a description of type Image e keymap key map image information e scalebar scale bar image information 1 3 3 Layers The Layers plugin handles layers selection Its request object includes list of layers to be displayed on main map This plugin has no specific result object 1 3 3 1 Layers Request lt complexType name LayersRequest gt lt sall gt lt element name className type xsd string gt lt element name layerIds type types ArrayOfLayerId gt lt element name resolution type xsd int gt lt element name switchId type xsd string gt lt all gt lt complexType gt e className LayersRequest or extended class name if project implements an 121 Calling Plugins extension e layerlds list of layers to include in map generation see Section 1 1 1 Simple Types for a description of type ArrayOfLayerld e resolution MapServer resolution Set this to null if you want to use default resolution e switchId current switch ID 1 3 3 2 Layers Result lt complexType name LayersResult gt lt all gt lt element name className type xsd string gt lt all gt lt complexType gt e className LayersResult or extended class name if project implements an extension 1
7. title or note Text formatting is achieved using usual CSS like parameter fontFamily font Size expressed in points color Small exception fontItalic fontBold fontUnderline are booleans Box properties background color border size color and style padding are set in the same way whatever the block type is Width is generally detected automatically according to the text length On the other hand the system has poor means to evaluate its height so it is recommended to set it by hand Note that padding space between border and content is taken into account only in the horizontal direction for text blocks To remove a block border one can simply set its width borderwidth to 0 Note that some border styling parameters are not available with all pdfEngines For instance zIndex 2 weight 10 verticalBasis top poeks shied Plock ait ib blocks titel blocks title verticalMargin 15 hCentered true fontSize 20 fontItalic true fontBold true fontUnderline true pilock senei plock sr erei pock smenel bilcoks cic aie dl oulieyeliess ieab ie ll blocks title backgroundColor eeeeee height 15 YOO OD OG OY OY blocks enel It is possible to specify a text content in the configuration file by using the content parameter Note that n strings in the content value will result in line feeds in the final block blocks myText content This is myText block content blocks myTe
8. In the mapfile you must include the routing layer its connection to the database a symbology for the route and a first route using a unique identifier The data parameter will be overwritten by the routing plugin to draw the route chosen by the end user Example LAYER NAME graph TYPE LINE TRANSPARENCY 80 CONNECTIONTYPE postgis CONNECTION user DB_USER password DB_PASSWD host DB_HOST dbname DB_NAME DATA the_geom from SELECT the_geom from routing_results as foo using unique gid wsing srid 1 TEMPLATE te CLASS NAME 0 STYLE SYMBOL circle GEZE LO COLOR Omi ako END END END 1 2 4 2 5 General Configuration For the demo we suggest that you select your route by starting from a town until an other town This is possible because for each object of a european towns layer we have identified the nearest object of the roads_europe_vertices table That is why in the demoRouting configuration there is a client side configuration Normally in the plugin routing client side only allows you to type an id of object from which to start and an other to finish the route No configuration is needed So if you use demoRouting extension you must specify client side the e postgresRoutingVerticesTable vertices table e stepName vertices table col containing informations you want to propose a choice on e dsn the connexion string to the database Anyway server side you must specify e the routing table postgresRout
9. other times Will be empty if script is executed on a client only trace file or if 189 Performance Tests direct mode is on e Exec MS obj time elapsed while creating Mapserver main object It includes reading the mapfile Will be empty is script is executed on a client only trace file e Exec MS other time elapsed in other Mapserver tasks Will be empty is script is executed on a client only trace file e Exec total time elapsed in total If direct mode is off it also includes time elapsed in SOAP data transmission 9 2 3 Graphical Interface Unix like To have more information about execution times and calls stack you can use a powerful graphical viewer called KCachegrind This tool is available on Unix like environments only On Win32 it can be used via KDE on CygWin KCachegrind is included in KDE package kdesdk To install it on a Debian distribution type apt get install kcachegrind APD package includes a script called pprof2calltree that can translate a trace generated by APD to a file in KCachegrind format To translate a pprof file type pprof2calltree f lt pprof_file gt gt dev null Redirecting to dev nu11 is needed because script generates a large number of PHP notices Then you can open the resulting file in KCachegrind 190 Upgrading Views Data 10 Upgrading Views Data 10 1 Introduction Views saves given CartoWeb states by recording the plugins session data Only client side pl
10. psql d demo_plugins f tmp airport sql S shp2pgsql builtupa shp agglo gt tmp agglo sql S psql d demo_plugins f tmp agglo sql S shocpgse poelbnda shp district gt imp dis trie sql peed el deme plugins E timp district sql shp2pgsql mispopp shp town gt tmp town sql S psql d demo_plugins f tmp town sql Note shp2pgsql is a command line program that exports a shapefile into SQL commands Don t forget to specify its location on your system to use it You have to specify the path to the shapefiles if they aren t in the current directory Execute cw3setup php file with the fetch demo option to download geographic datas cw3setup php Options To finish demoPlugins installation you will need to launch the cw3setup php with the config from file parameter pointing to a property file containing database configuration informations Such a file is provided in the cartoweb3 projects demoPlugins demo properties file You need to edit this file and change the parameter to match your environment In particular the DB_HOST DB_USER DB_PASSWD and DB_PORT options need to match your database access configuration This file contains comments about the description of each variables Here s an example how to call the cw3setup php script with the config from file option php cw3setup php install base url http www example com cartoweb config from file projects demoPlugins demo pr
11. Development Configuration Developers should absolutely set the following variables to true in their config on both client and server sides Warning These parameters will be overrided by the profile parameter See Section 4 1 Common client ini and server ini Options e showDevelMessages true e developerIniConfig true 5 2 4 Unit Tests Code should produce no notices before any CVS commit Code should pass all tests This also means that the developpers should add and run unit tests for every new 167 Code Convention feature they add See Chapter 6 Unit Tests 5 3 PHP 5 3 1 Coding Style Developers should use the PEAR coding standards as the coding style reference in CartoWeb with some exceptions Have a look at http pear php net manual en standards php Following are briefly described some guidelines to respect 5 3 1 1 Indent Developers should respect some indentation conventions when writing PHP code in CartoWeb e 4 spaces indentations are recommended e the use of tabs for indentation is prohibited use space instead select the appropriate preferences in your favorite code editor if needed 5 3 1 2 Control Structures Control statements should have one space between the control keyword and opening parenthesis It is also recommended to use curly braces even when they are optional This is correct if condition 5 3 1 3 Function Calls Functions should b
12. Projects Handling If showProjectChooser is true a dropdown menu will appear in your CartoClient interface giving the list of all projects available in your projects directory Selecting one will make it the active one Your choice is propagated from page to page Note that if the selected project has showProject Chooser set to false the project selection dropdown will no more appear keeping you from activating another project To go back to the initial project call the initial client php page without posting the HTML form 3 2 5 Using a Modified client jphp This should be avoided in production but may be useful in development if you have to frequently switch the working project add a new file client_myproject php in the root htdocs directory This file only sets the environment variable and then calls the normal client php Each project has so its own URL lt php S_ENV CW3_PROJECT myproject require_once client php aS 36 Configuration Files 4 Configuration Files When installing Cartoweb the administrator of the application may want to adapt it to the environnement use This can be easily done using configuration parameters Some are required and Cartoweb won t correctly work if they re not set Others are optional but could hardly change the application behavior You ll also find specific config parameters in the plugins related chapters of this documentation 4 1 Common client ini and serve
13. Standard Structures s eeeseseeeseeeessesesesresstseresresseseresresseesresresseeee 108 LT Simple Types naccaniiuniaddabusiadics Galea 108 Mt 2 Shapes on e a ee aat E a E e o e ta 109 T13 Tables oipcacats caszatiancenseasnevsans sh ieee Ea TEER E AAS 110 12 Call topetMapInfo niecne a E amaeten 112 1 2 1 Global Server Configuration ceeeeeeeeeeeseeeeteeeees 112 12 2 Layers na er a aeae 114 1 2 3 LOCATION ie ele tesina eee eee 117 MDA Layer Reorder cy gssuienksdunsitianasaounaaeatg cad she a R 118 1 3 Call to getMap isicccistiatsiansaniacigedets hguadantesdaatasasiad degeaatasephaawvartes 119 1 3 1 Global Str ctUrES iei tsisa shassi 119 1 3 2 THA BOS r are EE E E A EEA E RRE 120 NS LAYTE a ae 121 LSA Layer REOrder x sesieditiaj iecisvriad ageeatisesendnsidens sean ads 122 I S52 Location esinlenen raes ge Ea eas 122 13 6 QUETY asia aa aa E a ARN a ea a 127 B57 OUUIDE snn E e a a a a ESS 129 LAL Examples inn a a R EE IN 131 1 4 1 Retrieving Server Configuration eee eeeeeeseeeeeeeee 132 1 4 2 Getting a Map Using a Point and a Scale oo 134 LA Ss EXECU A QUEEY rsu aeatepantsads tcaueescanttuns das taeeeve 137 2 N Ww PIUZINS sonic tomen na a deg a A aad 141 2 des WW Wa ALE PI SINS enrete ae e a teea oei 141 Qe Ll ADOPTION eeina nn an e a E a 141 2 1 2 Plugins and Coreplugins sssssessssseesseessesssesssesesssressses 141 2 1 3 Pl gins Str ct te ssndnniinssudninnn kna na 141 2 2 WHS a PID
14. gt lt element name idAttribute type xsd string gt lt element name idType type xsd string gt lt element name selectedIds type types ArrayOfString gt lt element name useInQuery type xsd boolean gt lt element name policy type types QuerySelectionPolicy gt lt element name maskMode type xsd boolean gt 127 Calling Plugins lt element name hilight type xsd boolean gt lt element name tableFlags type types TableFlags gt lt all gt lt complexType gt e layerld layer ID on which query will be executed e idAttribute name of ID attribute e idType type of ID attribute string or int e selectedIds list of IDs e useInQuery if true will force query to use this layer e policy type of selection e maskMode if true will apply a mask instead of a simple selection This won t work when using MapServer s hilighting feature see Chapter 9 Queries e hilight if false selection won t be hilighted on map e tableFlags table flags see Section 1 1 3 Tables for a description of type TableFlags lt complexType name ArrayOfQuerySelection gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types QuerySelection gt lt restriction gt lt complexContent gt lt complexType gt e array list of query selections lt complexType name QueryRequest gt lt all gt lt element name
15. layers like objects in layers ini Layers and LayerGroups They play fairly different roles and consequently have different possible attributes Layers have a 1 to 1 correspondance to Mapserver layers as defined in the layers map while LayerGroups group together atomic Layers or other LayerGroups 6 2 2 Layers Options 47 Layers As seen before the Layer object maps directly to a layer in the mapfile By default all layers in the mapfile are made available as a Layer in the layers ini with an identifier having the same name as the name of the mapserver layer Thus if you have the following option in your mapfile LAYER NAME my_layer TYPE line END This is equivalent as writing the following configuration in the layers ini layers my_layer class Layer layers my_layer label my_layer layers my_layer msLayer my_layer Tip If you don t need special parameters see below for your layer then you can avoid adding it in the layers ini However if you want these layers to appear in the layer list you still have the responsibility to affect them a parent layer using the children property of the LayerGroup layer declarations Here is the syntax for the various configuration parameters of a Layer e layers layerld className Layer defines the object as a Layer layerld is a string that uniquely identifies the object The general rules of syntax for a ini file must be respected in the choice of the layerl
16. with given lt argument gt argument Of course interface defined methods must be implemented in the matching plugins Plugins can implements one or more CartoWeb interfaces Implementing interfaces is not mandatory when writing a plugin but not doing so will keep plugins from being implicitely called by the main program As a result methods from plugins with no interface implementation also called service plugins must be explicitely called by another piece of code class ClientYourPlugin extends ClientPlugin implements Sessionable here comes your plugin client class def generally an other plugin GuiProvider bha baa ions e7 For a comprehensive list of available client and server interfaces see client 144 New Plugins ClientPlugin php and server ServerPlugin php files or take a look at the CartoWeb PHP API documentation 2 2 4 Plugin Creation Check List CartoWeb3 Plugins Board Plugins interfaces summary and entry points Smeline for CartoClsent and CartoServer ha ndieMain ma pT ot handieke ymanToo get tools ntUser handie init Sessionabie loadSession Sessionabie create Session nerProvider titerPostRequest rovider titerGe te quest GuiProvider handicH tp PostRequest GuiProvider handieH tp GetRequest ServerCaller DulldRequest ServerCaller overmdeRequest handicitnPo stRequest handiethtnGetRequest renderFomn bulldRequest reiaizeResut ha
17. 0 Ss Tyalue 2 row 2 return array O gt array new_column_1 gt cell_value_l_row_1 new_column_2 gt cell_value_2_row_1 1l gt array new_column_1 gt cell_value_l_row_2 new_column_2 gt cell_value_2_row_2 See Section 2 4 3 2 9 ColumnAdder to know more about parameter ScolumnPosition 2 4 3 2 11 Column reorder public function addColumnReorder groupid StableId columnIds Column reorder rule allow you to reorder the columns and their contents Parameter columnIds should contain an array of column IDs given the new column s order Note that all the IDs must appear in columnIds even they don t move 159 New Plugins 2 4 3 3 Precedence of Rules Depending on rule type rules are set for a group a table or a column Parameters SgroupId tableId or columnId can point to one object or to a group of object using wildcard e column_1 rule will be executed on columns called column_1 only e col rule will be executed on columns with name starting with col e rule will be executed on any columns For instance following rule may be executed on groups with name starting with myGr tables called myTable and all columns Sregistry gt addColumnFilter myGr myTable array this myCallbackMethod Only one rule of each type may be executed on one item If two or more rules apply most specific rule will be choosen In
18. 2 Character Set Encoding Configuration Character set configuration is needed when CartoWeb strings may include international characters with accents or other special characters Two types of encodings must be set e how files map files configuration files etc are encoded on server and on client To set this encoding add the following line in server ini and in client ini EncoderClass config lt encoder_class gt e how CartoWeb exports including HTML output must be encoded To set this encoding add the following line in client ini EncoderClass output lt encoder_class gt Where lt encoder_class gt is the class used for encoding Currently following encoder classes are implemented e EncoderIso handles strings coded in ISO 8859 1 e EncoderUTF handles strings coded in UTF 8 104 Templating 16 Templating 16 1 Introduction Smarty Template Engine is a convenient way to write HTML templates for dynamic pages It enables to delocalize a great amount of layout processing Thus it is pretty easy to customize a CartoWeb application layout without affecting the application core CartoWeb templates are located in templates root directory and in plugins templates directories see Section 2 3 Plugins More info about Smarty templates can be found here http smarty php net A comprehensive online documentation including a reference and examples is available in various languages here http smart
19. 3 1 Meta Data Here are the meta data that can be set to mapfile s layers wow e id_attribute_string nameltype describes the attribute used for the id and the type of the id Type can be either integer or string Caution case sensitive 62 Queries e query_returned_attributes attributel attribute2 the names space separated of the fields returned by a query If not set all fields are returned Caution case sensitive Example METADATA alate Sure srring Pi string query_returned_attributes FID FNAME END 9 3 2 Hilight Configuration Hilight plugin can be used by any plugin to hilight objects on the map In basic CartoWeb installation only Query plugin uses this functionality As Hilight plugin is not a core plugin it must be loaded in order to use it with queries 9 3 2 1 Normal Mode Hilight on a specific layer can be generated by several means special layer activation special class activation dynamic layer class generation Decision is made in the following order looks for a layer named lt layer_name gt _hilight 2 if not found looks for a class named hilight in the current layer if not found dynamically creates a layer if meta data hilight_createlayer is set to true 4 if meta data hilight_createlayer is not set or set to false dynamically creates a class Here are the meta data that can be set to mapfile s layers e hilight_color 0 255 0 255 0 255 the hi
20. MapServer PHP Mapscript http mapserver gis umn edu doc44 phpmapscript class guide html module MapServer must be installed prior to any CartoWeb setup MapServer resources e MapServer HomePage http mapserver gis umn edu e MapServer Download http mapserver gis umn edu dload html e MapServer Documentation http mapserver gis umn edu doc html e MapServer PHP Mapscript Class Reference http mapserver gis umn edu doc44 phpmapscript class guide html 3 3 Web Service Architecture SOAP One of the CartoWeb specificities is its ability to work along a client server model as well as a stand alone application Thus it is possible to host a CartoWeb client known as CartoClient on one machine and have it requesting a CartoWeb server known as CartoServer located on a separated server A CartoServer can be called by several CartoClient simultaneously On the other hand a CartoClient can query several CartoServer for instance in the frame of different projects Section 3 4 2 Projects 10 Architecture CartoWeb offers two access modes e as aweb service CartoClient and CartoServer then interact using remote procedures based upon SOAP http www w3 org TR soap12 e as a standalone application Procedures are then performed directly between CartoWeb components bypassing the SOAP calls Direct mode SOAP mode 11 Architecture 3 aas a Multi client mode Of course it is possible to co
21. a Unix like shell enviroment the command line to use is CARTOWEB_TEST_PROJECT lt myproject gt lt php bin gt phpunit php projects_AllTests projects AllTests php 6 3 Running Tests Unit tests are runned using the command line interface CLI To run a test case or a test suite type the following command in directory lt cartoweb3_root gt tests lt php bin gt phpunit php lt test class gt lt php file gt Where lt php bin gt is the PHP binary lt test class gt is the name of the test class AllTests client_AllTests client_CartoclientTest etc and lt php file gt is the name of the PHP file containing the test case client CartoclientTest php Result should look like this PHPUnit 2 0 3 by Sebastian Bergmann Time 0 0410950183868 There was 1 failure 1 testpointtobbox expected same lt 113 gt was not lt 123 gt home yves cartoweb3 proto2 tests common BasicTypesTest php 59 home yves cartoweb3 proto2 tests phpunit php 24 FAILURES Tests run 12 Failures 1 Errors 0 Incomplete Tests 0 Content type text html X Powered By PHP 5 0 1 In this case 12 tests were run with one failure 179 Code Documentation 7 Code Documentation CartoWeb code documentation is generated using PhpDocumentor http www phpdoc org a JavaDoc style doc generator CartoWeb already includes version 1 3 0rc3 of PhpDocumentor 7 1 Generating Documentation Documentation is generated using script makedo
22. add PHP code into mapfiles True mapfiles are then generated by a batch script The generated layers are called Auto Layers 6 5 1 Auto Layers in layers ini First you have to declare the list of auto layers indexes Indexes will be used as suffixes for generated layers autoLayersIndexes indexl index2 Then you can use auto layers just as other layers In this exemple an auto layer myAutoLayer_ was declared in the mapfile template see Section 6 5 2 Mapfile Templates layers layerl className LayerGroup layers layerl children layer2 myAutoLayer_index1l layers layer2 className LayerGroup layers layer2 children myAutoLayer_index2 6 5 2 Mapfile Templates Mapfile templates for auto layers are PHP files The main template must be called mapId map php If this file exists then CartoWeb assumes that auto layers generation is used If the file does not exists CartoWeb looks for a standard mapid map The following functions are predefined and can be used in mapfile templates e printLayer name contents adds a new auto layer The name is the final name of the layer without the index suffix Contents include Mapserver layer definition with PHP code for parts that will be different for each instance of auto layer e printIndex adds the current auto layer index Must be used in auto layer contents 53 Layers e printName adds the current auto layer full name Must be used in auto layer cont
23. among others is the ability to filter log message according to their severity Each log message has a severity which may be ALL DEBUG INFO WARN ERROR FATAL OFF As described in the configuration file comments the lines like log4php logger CLASSNAME can be used to apply a filtering of the log message for the class CLASSNAME For instance adding a line log4php logger Cartoclient INFO means that only log message of severity INFO or above will be printed This is useful to avoid displaying unwanted log messages 184 Logging and Debugging 8 2 2 Default Log File Location From what was said in the previous section just uncommenting the line log4php rootLogger means that the CartoClient log messages will be written to log cartoclient log and the CartoServer ones to log cartoserver log Of course the Log4php configuration files can be adapted to write messages elsewhere 8 2 3 Using Log4php in Source Files The Log4php usage in code is quite easy 1 For objects it is advised to store a Logger object as an instance variable class MyClass var Logger Lup private Slog lees PRCoOnsitrucitom a publi Fonction Cometae Sthis gt log amp LoggerManager getLogger __CLASS___ emer a Pacis CONG Gucta ens For non object a reference to a Logger object can be obtained this way Slog amp LoggerManager getLogger __METHOD__ Tip Using __METHOD__ allows the same
24. assimilated text format The returned CSV file can then be opened and edited in any text editor or rendered as a table document in OpenOffice or MS Excel For instance Td Object Description 70 Export Plugins ujn a Line CSV export links are generally displayed in the viewer at the bottom of each queries results tables Each link can only export a single layer table at a time A few configuration parameters are available in client_conf exportCsv ini e separator indicates what character should be used to distinguish each tabular mom cell value Default is semi colon e textDelimiter tells what character should be used to delimit the text in each cell It is specially useful when the character used as the separator may be found within the cell content Default parameter value is double quote ie The alias is defined to overcome INI syntax issues e filename specifies the filename naming convention to use It can include the table name using the table keyword and the generation date under various formats Date formating is performed by indicating between a couple of brackets the keyword date followed by a comma and PHP date like date format see http php net date Default filename convention is date Ymd Hi _ table csv which gives for instance 20050220 2021_myLayer csv e Ifthe charsetutf boolean is set to true the result file will be UTF 8 encoded Else ISO 8859 1 encoding is used which is
25. block extent orientation horizontallvertical indicates if content will be displayed form left to right or from bottom to top only for text blocks z Index integer indicates how overlapping blocks must be stacked The higher the zIndex the higher the block in the stack foreground weight integer indicates in what order blocks with the same zIndex must be processed Low weighted blocks are handled first inNewPage boolean indicates if a new page must be added before printing the block 76 PDF Export e inLlastPages boolean indicates if block must be added in a new page at the end of the document e width float block width in distUnit e height float block height in distUnit e multiPage boolean if true given block will be displayed on every document page e parent string if specified current block will be printed inside given parent block e inFlow boolean if true block will be printed right after previous block preserving the vertical alignment e caption string for table blocks only name of separated block used to describe table caption formatting e headers string for table blocks only name of separated block used to describe table headers colunms titles formatting e allowedRoles comma separated list of strings list of roles allowed to draw the current block e i18n boolean if true block content is translated using CartoWeb Gettext system 118n stands for
26. can be used to maintain persistence of a selection 1 3 6 2 Query Result lt complexType name QueryResult gt salba lt element name className type xsd string gt lt element name tableGroup type types TableGroup gt lt all gt lt complexType gt e className QueryResult or extended class name if project implements an extension e tableGroup group of tables which contains query results one table per layer 1 3 7 Outline The Outline plugin allows to draw shapes on the main map Shapes can also be drawn as a mask ie as holes in a rectangle covering map It returns total area covered by shapes Outline request is not mandatory As Outline plugin is not a core plugin it must be activated in order to use the following request result objects 1 3 7 1 Outline Request lt complexType name Color gt lt all gt lt element name r type xsd int gt lt element name g type xsd int gt lt element name b type xsd int gt lt a gt lt complexType gt e r red 129 Calling Plugins e g green e b blue lt complexType name ShapeStyle gt lt all gt lt element name symbol type xsd int gt lt element name size type xsd int gt lt element name color type types Color gt lt element name outlineColor type types Color gt lt element name backgroundColor type types Color gt lt element name transparency type xsd int gt lt all gt lt complexTyp
27. client Views php They are saved in a ViewsUpgrade php file located in the same directory than the plugin client side class file for instance coreplugins location client Filters naming convention is lt UppercasedPluginName gt V lt initialVersion gt ToV lt initialVersion t1 gt Some basic methods rename remove add are available in every filters but you may 191 Upgrading Views Data define your own transformers methods Details about basic methods are given in ViewUpgrader Class documentation CartoWeb API manual At least an upgrade filter class must redefine the cal1Filters method that indicates the sequence of transformations to apply An example of filters might be lt php coreplugins location client ViewsUpgrade php s Class rese i var game arkanoid var Si A Upgrades from V1 to V2 SA class LocationV1ToV2 extends ViewUpgrader protected function callFilters PENIS radad CESE LOCOS Upgrades from V2 to V3 aA class LocationV2ToV3 extends ViewUpgrader protected function callFilters Sthis gt rename test foo Sthis gt add bar new test Sthis gt add someProperty 2 skthis zadd t caranba y Oret this gt remove someProperty Warning It is the responsibility of each developer to provide adapted filters when he she updates plugin session containers Warning Upgrade filters do not support non object type
28. document generation A format is determined by its biggest dimension bigDimension and its smallest dimension smal1Dimension The label parameter will be translated using Cw3 I18n internationalization system Chapter 15 Internationalization It is not required to be identical to the format object id On the other hand the latter id must be textually listed in general formats parameter or else it will not be taken into account In addition a couple of format parameters can be specified horizontalMargin and verticalMargin override the corresponding general parameters if different margins must be applied for the given format maxResolution indicates the highest allowed resolution for the given format it enables to limit the applied resolution when for instance printing big dimensioned maps For instance formats settings formats A4 label A4 formats A4 bigDimension 297 fFormats A4 smallDimension 210 formats A3 label A3 formats A3 bigDimension 420 fFormats A3 smallDimension 297 formats A3 horizontalMargin 30 formats A3 verticalMargin 30 formats A3 maxResolution 150 12 3 3 Blocks Configuration Whatever their types image text table legend blocks use the same PHP object model and as a result the same object properties Some parameters can be used in several ways depending on the block type Some others are simply ignored Blocks naming is quite free but some names are reserved to system defin
29. e shortcuts label 0 1 2 label of the shortcut appears in the direct access dropdown list on the client e shortcuts bbox 0 1 2 geographic bbox of the shortcut e recenterMargin margin to add around the centered on object valid for lines and polygons Expressed in percent of the width height of the object e recenterDefaultScale scale to use when the centered on object is a point 7 3 Related Elements Elsewhere The maximal extent of the geographical zone is set by the EXTENT command in the mapfile The initial bbox is set by the active initialMapState It is to be configured in the myMap ini file using the following syntax mapInfo initialMapS tates initialMapStateld location bbox xmin ymin xmax ymax 58 Image Format Options 8 Image Format Options The plugin images is the core plugin that deals with the formatting options for the main map It handles the size of the image and its filetype 8 1 Client side Configuration Here are the options that can be set mapSizesActive boolean if true displays a drop down list of available mapsizes if false a fixed size is used defined by the two following parameters mapWidth mainmap width in pixels if mapSizesActive false mapHeight mainmap height in pixels if mapSizesActive false mapSizes width 0 1 2 available mainmap width in pixels for mapsize when mapSizesActive true mapSizes height 0 1 2 avail
30. e width width in pixels 108 Calling Plugins e height height in pixels lt complexType name GeoDimension gt lt all gt lt element name dimension type types Dimension gt lt element name bbox type types Bbox gt lt a gt lt complexType gt e dimension dimensions in pixels e bbox bounding box see Section 1 1 2 Shapes for a description of type Bbox 1 1 2 Shapes These types define a hierarchy of shapes As heritage and polymorphism cannot be used type Shape includes all attibutes of its children types lt complexType name Bbox gt lt all gt lt element name minx type xsd double gt lt element name miny type xsd double gt lt element name maxx type xsd double gt lt element name maxy type xsd double gt lt all gt lt complexType gt e minx minimum x coordinate e miny minimum y coordinate e maxx maximum x coordinate e maxy maximum y coordinate lt complexType name Point gt lt all gt lt element name x type xsd double gt lt element name y type xsd double gt lt all gt lt complexType gt e x x coordinate e y y coordinate lt complexType name ArrayOfPoint gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types Point gt lt restriction gt lt complexContent gt 109 Calling Plugins lt complexType gt e array list of poi
31. ed 200 Presentation and Architecture Part I Presentation and Architecture This first part of the documentation is an overall presentation of both the visible and the hidden features of CartoWeb The goals are first to give an idea of what CartoWeb can readily do if used as it is shipped and second to explain why it is a powerful framework to build more advanced applications Project Presentation 1 Project Presentation 1 1 About CartoWeb CartoWeb3 is a comprehensive and ready to use Web GIS Geographical Information System including many powerful features As a modular and extensible solution it is also a convenient framework for building advanced and customized applications Developed by Camptocamp SA http www camptocamp com it is based on the UMN MapServer http mapserver gis umn edu engine and is released under the GNU GPL license http www gnu org copyleft gpl html 1 2 Credits To date the following people have been more or less involved in the development of CartoWeb e Yves Bolognini e Mathieu Bornoz e Oliver Christen e Damien Corpataux e Olivier Courtin e Daniel Faivre e Alexandre Fellay e Marc Fournier e Florent Giraud e Pierre Giraud e David Jonglez e Fr d ric Junod e Sylvain Pasche e Claude Philipona e Arnaud Saint Leger e Alexandre Saunier Cartographic Functionalities 2 Cartographic Functionalities 2 1 Introduction CartoWeb is quite a complex piece
32. gt lt element name icon type xsd string gt lt element name link type xsd string gt lt element name aggregate type xsd boolean minOccurs 0 gt lt element name rendering type xsd string minOccurs 0 gt lt element name metadata type types ArrayOfString minOccurs 0 gt lt all gt lt complexType gt e className layer class name LayerGroup Layer or LayerClass e id layer ID e Jabel label to be displayed This label is not yet translated using internationalization e children list of children e minScale minimum scale at which layer will be displayed e maxScale maximum scale at which layer will be displayed e icon filename of the static icon for the layer Dynamic legends are described in Section 6 4 Layers Legends 115 Calling Plugins e link if set layer name is clickable e msLayer MapServer layer id e aggregate if true children are not displayed and cannot be selected individually e rendering how layer will be displayed tree block radio or dropdown See Chapter 6 Layers for more details on this option e metadata list of meta data defined in server configuration file Format of each string in list is variable_name value lt complexType name ArrayOfLayer gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types Layer gt lt restriction gt lt complexContent gt
33. gt projects test_project po server projectmap fr po Edit french files with Poedit or any editor e Onclient cd lt cartoweb_home gt scripts php client2pot php Copy lt cartoweb_home gt projects test_project po server po to lt cartoweb_home gt projects test_project po server fr po Edit french file with Poedit or any editor Merge and compile files with the following commands cd lt cartoweb_home gt scripts php po2mo php Now you should have the file test_project projectmap mo in directory lt cartoweb_home gt locale fr LC_MESSAGES The directory fr LC_MESSAGES will be created if it does not exist 15 1 6 Debuging translation problems There can be several reasons why the translation is not working First you need to check if gettext is correctly installed and configured For so run the following scripts cd lt cartoweb_home gt scripts testgettext sh This will test if Gettext is correctly installed in your system Note Unix like system only this script is not intended for Windows users cd lt cartoweb_home gt scripts php testgettext php This will test if Gettext works correctly with php 102 Internationalization Once you have verified Gettext is installed and run correctly check if there are no errors in your po files e Verify you do no have duplicate msgid in your po files Each msgid must be unique in a po file A typical error message would be Error messag
34. horizontalPan type types PanDirectionType gt arean lt complexType gt e verticalPan type of vertical panning e horizontalPan type of horizontal panning lt complexType name PanLocationRequest gt lt all gt lt element name bbox type types Bbox gt lt element name panDirection type types PanDirection gt lt all gt lt complexType gt e bbox current bounding box see Section 1 1 2 Shapes for a description of type Bbox e panDirection panning directions 1 3 5 1 3 Zoom Point Request lt simpleType name ZoomType gt lt restriction base xsd string gt lt enumeration value ZOOM_DIRECTION_IN gt lt enumeration value ZOOM_DIRECTION_NONE gt lt enumeration value ZOOM_DIRECTION_OUT gt lt enumeration value ZOOM_FACTOR gt lt enumeration value ZOOM_SCALE gt lt restriction gt lt simpleType gt e ZOOM_DIRECTION_IN zoom in default is x2 e ZOOM_DIRECTION_NONE no zoom recenter on point only e ZOOM_DIRECTION_OUT zoom out default is x0 5 e ZOOM_FACTOR zoom using a custom factor e ZOOM_SCALE zoom to a fixed scale lt complexType name ZoomPointLocationRequest gt lt sall gt lt element name bbox type types Bbox gt lt element name point type types Point gt lt element name zoomType type types ZoomType gt lt element name zoomFactor type xsd float minOccurs 0 gt lt element name scale type xsd integer minOccurs 0 gt
35. is not logged in she is rerefenced as the anonymous user Role A user can have zero or more roles associated to her These roles are used to allow or deny a permission to a resource of feature Permissions Permissions describe parts of the application which can be allowed or denied access A permission can have roles for which access is allowed and roles for which it is denied 14 2 Auth Plugin The security system in CartoWeb was developped to be modular and to allow different authentications systems to be easily plugged in This section describes one implementation of authentication user password and roles management which is the auth plugin shipped with CartoWeb E Cartoclient Title Login dialog Please enter your login and password Username Password Submit Click here to go back to the map 94 Security Configuration The auth plugin is not a core plugin That s why you need to enable it if you want to enable users to log in See Chapter 4 Configuration Files how to enable it in the list of plugins If it is not activated the login dialog won t be available so users will remain anonymous The next section describes the configuration file of the auth plugin It is basically the management of usernames passwords and roles 14 2 1 auth ini Client side The auth ini configuration is located in the client This file contains the list of usernames their password and the roles they belong to e authA
36. keep standard Mapserver resolution Srequest gt layersRequest gt className LayersRequest 137 Calling Plugins Srequest gt layersRequest gt layerIds array swiss_layer_l Visas lene 2 2 Srequest gt layersRequest gt resolution null In this case the location request object is of type bbox Only new bounding box is required Srequest gt locationRequest gt className LocationRequest Srequest gt locationRequest gt locationType bboxLocationRequest Srequest gt locationRequest gt bboxLocationRequest gt bbox gt minx 550000 Srequest gt locationRequest gt bboxLocationRequest gt bbox gt miny 100000 Srequest gt locationRequest gt bboxLocationRequest gt bbox gt maxx 600000 Srequest gt locationRequest gt bboxLocationRequest gt bbox gt maxy 150000 The query will be performed on a rectangle on all selected layers ie layers defined in layers request object IDs and attributes will be returned Srequest gt queryRequest gt className QueryRequest Srequest gt queryRequest gt bbox gt minx 570000 Srequest gt queryRequest gt bbox gt miny 120000 Srequest gt queryRequest gt bbox gt maxx 580000 Srequest gt queryRequest gt bbox gt maxy 130000 Srequest gt queryRequest gt queryAllLayers true Srequest gt queryRequest gt defaultMaskMode false Srequest gt queryRequest
37. lt all gt lt complexType gt 125 Calling Plugins e bbox bounding box unused when zoom type ZOOM_SCALE e point point to recenter on e zoomType type of zoom e zoomFactor zoom factor unused when zoom type ZOOM_FACTOR e scale fixed scale unused when zoom type ZOOM_SCALE 1 3 5 1 4 Recenter Request lt complexType name IdSelection gt lt all gt lt element name layerId type xsd string gt lt element name idAttribute type xsd string gt lt element name idType type xsd string gt lt element name selectedIds type types ArrayOfString gt lt all gt lt complexType gt e layerld ID of layer on which query will be executed e idAttribute name of ID attribute e idType type of ID attribute string or int e selectedIds list of IDs lt complexType name ArrayOfIdSelection gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types IdSelection gt lt restriction gt lt complexContent gt lt complexType gt e array list of ID selections lt complexType name RecenterLocationRequest gt lt all gt lt element name idSelections type types ArrayOfIdSelection gt lt all gt lt complexType gt e idSelections list of ID selections 1 3 5 2 Location Result lt complexType name LocationResult gt lt all gt 126 Calling Plugins lt element name className ty
38. of software This chapter is only a quick and consequently incomplete overview of the standard functionalities that are somehow visible for an end user The internal architecture and all the hidden features that make CartoWeb customizable and extensible are presented in the next chapter 2 2 Overview The first figure is an overall view of the user interface of the demo that is shipped with CartoWeb The numbers refer to more or less visible underlying features They are Main map Dynamic keymap Navigation tools zoom in zoo out panning Layers tree Geographic query tool Redlining tools to draw points lines rectangles polygons Measuring tools distances and surfaces Language switch internationalization support SOP OOTY BON RON RO NM les Login link users and roles support gt Print dialog PDF production Cartographic Functionalities a s LEF aiii Camptocamp CartoWeb3 Demonstration GIS IT Engineering About Outline Themes Print Search Background C None C Vector Raster Human activities BM Toms O Tow Agglomeration Bo Transports GC N Roads r Category Hydrology v amp teelands VV Rivers F m DB s Retesh o 41 82 123 164 kw 171500000 z Scale Mapsize 620x420 7 Powered by CartoWeb Camptocamp SA 2 3 Navigation Interface There are many possibilities to navigate on the main map that is to change the scale and the p
39. r alt gt Following list shows all CartoWeb resource types e Htdocs root directory o path htdocs css toto css o Smarty r type css toto css r o generated URL css toto css e Coreplugins o path coreplugins layers htdocs css toto css o Smarty r type css plugin layers toto css r o generated URL layers css toto css e Plugins o path plugins hello htdocs css toto css o Smarty r type css plugin hello toto css r o generated URL hello css toto css e Projects o path projects myproject htdocs css toto css o Smarty r type css toto css r o generated URL myproject css toto css e Projects Coreplugins override o path projects myproject coreplugins layers htdocs css toto css o Smarty r type css plugin layers toto css r o generated URL myproject layers css toto css e Projects Plugins override o path projects myproject plugins hello htdocs css toto css o Smarty r type css plugin hello toto css r o generated URL myproject hello css toto css e Projects specific plugins o path projects myproject plugins myplugin htdocs css toto css o Smarty r type css plugin myplugin toto css r o generated URL myproject myplugin css toto css 106 Developer Manual Part Ill Developer Manual As is implied by its name this part of the documentation is aimed at those who need to customize or extend CartoWeb for their specific needs 107 Calling Plugins 1 Calling Plugins This cha
40. result More specific parameters such as map location or content are defined in other plugins 1 3 2 1 Images Request lt complexType name Image gt salta lt element name isDrawn type xsd boolean gt lt element name path type xsd string gt lt element name width type xsd int gt lt element name height type xsd int gt lt all gt lt complexType gt e isDrawn true if the image should be generated when used in a request or if it was generated when returned in a result e path relative path of generated image Not used in request e width image width e height image height lt complexType name ImagesRequest gt sarka lt element name className type xsd string gt lt element name mainmap type types Image gt lt element name keymap type types Image gt lt element name scalebar type types Image gt 120 Calling Plugins lt all gt lt complexType gt e className ImagesRequest or extended class name if project implements an extension e mainmap main map image information e keymap e scalebar key map image information scale bar image information 1 3 2 2 Images Result lt complexType name ImagesResult gt lt all gt lt element name className type xsd string gt lt element name mainmap type types Image gt lt element name keymap type types Image gt lt element name scalebar type types Image gt lt all gt
41. the controller is off e viewStorage string file l db tells what storage container must be used file or database e viewablePlugins comma separated list of strings list of plugins that must 90 Views have their data saved in views Note that viewable plugins must implement the Sessionable interface If you wish to save data from extended plugins you must add the extended plugin to the list not the standard one eg myLocation instead of location e viewMetas comma separated list of strings list of metadata fields that must be saved in addition to the viewable plugins data for instance author email description Common metadata fields such as viewTitle are anyway saved Note that metadata fields must have homonym form fields in plugins views templates views tpl to be taken into account e viewDsn string DSN Data Source Name gives the database connection parameters Only used in database storage mode Any DSN format supported by PEAR DB can be used See PEAR DB manual for more info about DSNs at http pear php net manual en package database db intro dsn php Note that you can call any database server type as long as it is supported by PEAR DB and that your PHP distribution has the matching extension enabled e viewAuth comma separated list of strings list of roles allowed to perform views edition actions Given roles must match client_conf auth ini defined ones See also Chapter 14 Security Configu
42. the following rule definition only the third rule will be executed on a table myTable in a group myGroup Sreqietry saddcolumncetector eS Ue array column i column 2 Ji Sregistry gt addColumnSelector myGr array column_1 Sregistry gt addColumnSelector myGr myTable array column_2 Sregistry gt addColumnSelector myGroup toto array column_3 2 4 3 4 Executing Rules 2 4 3 4 1 On Client Each time a table group is created it must be stored in Tables plugin in order to display it StablesPlugin Sthis gt cartoclient gt getPluginManager gt tables StablesPlugin gt addTableGroups newTableGroup Tables rules are executed automatically at the same time 2 4 3 4 2 On Server Rules execution must be done explicitly on server A call to Tables plugin applyRules method is needed for each new table group before returning it to client StablesPlugin Sthis gt serverContext gt getPluginManager gt tables readyForClientTableGroups StablesPlugin gt applyRules newTableGroup 160 New Plugins 161 Using the Security Infrastructure 3 Using the Security Infrastructure 3 1 Introduction This chapter describes the security infrastructure from the developer point of view For generatil details about security and its configuration see Chapter 14 Security Configuration The security management in cartoweb is separated in the following parts e Manag
43. to add to selection o query_unselect IDs of objects to remove from selection o query policy selection policy POLICY_XOR POLICY_UNION or POLICY_INTERSECTION default is POLICY_XOR o query_maskmode 0 or 1 default is 0 If 1 will show selection as a mask o query_hilight 0 or l default is 1 If 0 won t shows selection hilighted o query_return_attributes 0 or l default is 1 If 0 won t return attributes other than IDs o query_return_table or l default is 1 If 0 won t return any table results Note that for Query plugin display of extended selection must be disabled in client s query ini in order to use above parameters see Section 9 1 Client side Configuration 2 4 2 3 Example The following class implements a filter which allows to recenter on an object while hilighting it class ClientFilterIdrecenter extends ClientPlugin implements FilterProvider public function filterPostRequest FilterRequestModifier request public function filterGetRequest FilterRequestModifier request Sid Srequest gt getValue id esr eae inf Slayer Grid elasshi light Srequest gt setValue query_layer Slayer 154 New Plugins Srequest gt setValue query_maskmode 1 Srequest gt setValue query_select id Srequest gt setValue id_recenter_layer Slayer Srequest gt setValue id_recenter_ids id 2 4 3 Tables
44. 000 maxx gt 600000 maxy gt 150000 scale gt 377952 96 queryResult gt stdClass Object className gt QueryResult tableGroup gt stdClass Object groupId gt query groupTitle gt Query tables gt Array 0 gt stdClass Object tableId gt swiss_layer_1 tableTitle gt swiss_layer_1l numRows gt 0 totalRows gt 0 offset gt 0 columniIds gt Array columnTitles gt Array noRowld gt rows gt Array 1 gt stdClass Object 139 Calling Plugins tableId gt swiss_layer_2 tableTitle gt swiss_layer_2 numRows gt 2 totalRows gt 0 offset gt 0 columnIds gt Array 0 gt attribute_3 1 gt attribute_4 columnTitles gt Array 0 gt attribute_3 1 gt attribute_4 noRowId gt rows gt Array 0 gt stdClass Object rowId gt 123 cells gt Array 0 gt Foo 1 gt 84 98 1 gt stdClass Object rowId gt 456 cells gt Array 0 gt Bar 1 gt 32 47 140 New Plugins 2 New Plugins 2 1 What are Plugins 2 1 1 Definition CartoWeb plugins are modular packages of files PHP classes HTML templates images and other resources that are used to perform a dedicated action main map formatting layers browsing interface map browsing zooming paning etc queries user authentication search interfaces an
45. 0ff hexadecimal code for blue 12 3 1 General Principle The PDF document to generate is described using elementary objects blocks 78 PDF Export e texts titles copyrights dates e images maps logos e tables queries results e legend list of icons labels for each printed layers Those blocks are drawn and positioned on the document pages according to properties detailed in each block In addition some data must be specified to describe the general document characteristics such as formats pages size orientation available resolutions PDF engine and more Parameters containing several values are represented using comma separated lists of strings integers If some values contain special characters such as accentuated letters quotes or other exclamation marks it may be wiser to encapsulate the whole parameter value between double quotes Warning Note3 don t forget to activate the plugin by adding it in the loadPlugins from BOTH CartoClient and CartoServer configuration files client_conf client ini and server_conf lt mapId gt lt mapId gt ini For instance loadPlugins hilight outline exportPdf 12 3 2 Overall Configuration Two objects are available for overall configuration 12 3 2 1 general This is where you can set the list of available resolutions and formats made available to the user through dropdown menus Use commas to separate the available values defaultResolution and d
46. 13 1 Introduction Views are recordings of CartoWeb maps states at a given moment One may see them as a kind of bookmarks while browsing maps in CartoWeb interface users can save the current state map extent selected layers queries annotations etc under a label of their choice It is then possible to access later those saved states Views are shared among users and are in the current version available to every user Access to views edition functionalities creation modification deletion can be restricted to some categories of users The default configuration only allows admin roled users to perform view edition 13 2 Views Configuration The views device consists of two parts e amain controlling system that handles views detection loading recording and storage e a views plugin that provides a graphical interface for performing views loading and edition This plugin is not mandatory to have views working but greatly enhances the device usability 13 2 1 Views Plugin No configuration is required for that plugin However it still needs to be activated using the client_conf client ini loadPlugins parameter For instance loadPlugins auth exportPdf views 13 2 2 Main Views Controller Main views controller configuration is done in the client_conf client ini file The dedicated parameters are e viewOn boolean true l false activates deactivates the main view controller Views plugin will not work if
47. 3 3 Initial Mapstates Tip initialMapStateId may be determined using several means By order of priority 1 URLs using GET parameter initialState 2 PHP environment variables Place S_ENV CW3_INITIAL_MAP_STATE_ID foobar in your PHP code before calling CartoWeb client ini 4 Ifno initialMapStateIdcan be determined CartoWeb use first initialMapState available Session handling e sessionNameSuffix string Optional suffix used to distinguish CartoClient sessions parts for a given user In most cases it is not necessary but may be needed when using for instance sub projects This string is an ulimited comma separated list of t ype value couples Three types are available o str a constant string o conf uses value of one of the current client ini configuration parameters o env uses value of given PHP environment variable if set For instance sessionNameSuffix Wereg coton Cconb prorile envimyinvvar sessionNameSuffix SEI BIOS S ER Dant env CW3_APP_ID sessionNameSuffix Tools configuration e initialTool indicates which tool is activated when in initial state If not specified the first tool in the toolbar is activated Possible values are zoomin zoomout pan query distance surface Project handling configuration e showProjectChooser truelfalse Shows a drop down list for selecting the active 38 Configuration Files project e availableProjects li
48. 3 4 Layer Reorder The LayerReorder plugin handles layers reorder selection Its request object includes list of layerlds rightly ordered to be displayed on main map This plugin has no specific result object 1 3 4 1 Layer Reorder Request lt complexType name LayersRequest gt lt all gt lt element name className type xsd string gt lt element name layerIds type types ArrayOfLayerlId gt lt all gt lt complexType gt e className LayerReorderRequest or extended class name if project implements an extension e layerlds list of layers to include in map generation rightly ordered from top to bottom see Section 1 1 1 Simple Types for a description of type ArrayOfLayerld 1 3 5 Location The Location plugin handles position and moves on the map Its request process 122 Calling Plugins includes different position methods such as recentering on a specific object or moves relative to previous position It returns the new bounding box and scale 1 3 5 1 Location Request lt simpleType name LocationType gt lt restriction base xsd string gt lt enumeration value bboxLocationRequest gt lt enumeration value panLocationRequest gt lt enumeration value zoomPointLocationRequest gt lt enumeration value recenterLocationRequest gt lt restriction gt lt simpleType gt e bboxLocationRequest recenters on a bounding box e panLocationRequest moves horizontaly verticaly
49. 81 4 4 2 Grouping Tools Icons CartoWeb offers the possibility to display tools icons in separated locations of its interface For instance browsing icons may be displayed in the general toolbar whereas outline pictos may only appear in a dedicated folder To do so simply add an integer group index for each tool in matching plugin configuration file For instance groupDistance 2 By default all tools icons are affected to group 1 Note that the parameters naming convention is the same than for weight parameters see Section 4 4 1 Ordering Tools Icons only substituting the group prefix to the weight one It is also possible to specify a global plugin group index that will be applied to all the given plugin tools if no individual group index has been set To do so use the groupPlugin in the matching plugin configuration file as follows groupPlugin 3 To take benefit of the tools groups update the main CartoWeb template file templates cartoclient tpl by including the toolbar tp1 template at the correct places with the correct group indexes as follows include file toolbar tpl group 2 For more information about templates writing see Chapter 16 Templating 4 5 Developer Specific Configuration Some configuration parameters can be activated to retrieve more display information targetted to the developers like special timing messages or setting the Php configuration to display notices on the page These c
50. 9 New Plugins images js function checkMapsize alert foobar To add a new form field in a separated area and consequently in a separated template there is no other way than to modify the client Images PHP class in order to call the additional template in a special method The extension approach is thus required Then create a yourProjectImages directory in projects yourProject coreplugins as follows projects yourProject coreplugins yourProjectImages projects yourProject coreplugins yourProjectImages client projects yourProject coreplugins yourProjectImages client ClientYourProjectImages php It can seem a little tricky but the new template file say yourImages tp1 will not be stored in projects yourProject coreplugins yourProjectImages templates as one can expect it but in projects yourProject coreplugins images templates with the templates of the overriden part of the coreplugin Remember templates are stored in the overriden part and PHP classes in the extended part lt yourImages tpl gt lt input type text name testField value SimagesTest gt lt php version Id ClientYourProjectImages php v 1 8 2005 02 23 11 52 43 johndoe Exp S class ClientYourProjectImages extends ClientImages indicates that we want to use current plugin instead of regular images plugin public replacePlugin return images overloaded method public function rend
51. CartoWeb Documentation 3 1 0 Edition to Published 2005 11 11 CartoWeb Documentation ii CartoWeb Documentation Table of Contents I Presentation and Architecture oc cov osca scncekadstsls Dociasmoucuasa ni ancaaandutsdvbestoriaanasirintes 1 Le Project Presentauiom wi nciaiiisansigiia anita ii n R nani 2 1b AA DOULC AEG WED ii in n ta a aiaei i 2 WZ Credits aa E E a EE R AR AEST 2 2 Cartographic Functionalities vi niccisesicsscacinuicat ghectesda dda aamscees exe oateaeuciaaets 3 2 ly TMMOAUCHONs nun a eden ai alesis 3 2 2 OVETVIEW aisanana aigesan aaa a aiaa aoaeiaa siaa 3 2 3 Navigation Interface is sissaicassncasdasesvedoasesnadeasudeneenssaeadedadeendeessoocties 4 2 4 Arbitrarily Complex Hierarchy of Layers eeeeseeeeerereeresee 4 Dds Map Q eri eSis onunn nni a R N Ra 5 2 6 Annotation and Redlining seseseeeesssessessseesseesseessseesseesseesseresseee 6 2 1 MG ASUTING Tools merkra a RAA E E ASEE ES 7 2 9 Int rnatonaliZation st e jesnahanst ators aa iiah ncuettt i sets aeretaahineaadeee 7 Di De PNCCE SS RAG DES nno n ada esdecisoniadweas deans ota AR 7 2 10 PDF Output and Other Export Formats sseseeeeeseereeserereeresee 8 3 Architecte sosessiccxiaaiaces es Wtenb eat E R a 10 Dil Introd cti i sis erenn e r a ia aiie 10 3 2 MapServer MapScript ssiicicigecttiss psatscaesdedisasdca es thgeditacaseacevenedeas 10 3 3 Web Service Architecture SOAP sssssssssssssssssssseseesssseessssrsssss
52. F export plugin PHP code see code documentation for PdfBlock class Those default properties can be partially or totally overriden using a template object whose syntax is similar to this template type text template fontFamily times template fontSize 12 template fontItalic false whereas real blocks are described this way blocks title weight 10 blocks title verticalBasis top blocks title verticalMargin 15 Template described properties have a global scope whereas blocks ones are specific to the given block Properties names are identical for both template and blocks objects Properties not related with the given block type are generally ignored for instance fontSize is not taken into account if block is an image A lots of properties use CSS like denominations and effects All following parameters names must be precede by either template or blocks lt block_name gt prefixes e type textlimageltablellegend block type indicates what kind of processing must be applied e content string optional for text blocks the textual content for image blocks the image filename for table blocks a comma separated list of textual content limited to one row commas delimit cells e fontFamily string name of font family to use Naming depends on used 75 PDF Export pdfEngine font Size float font size in points pt font Italic boolean if true text will be emphasized fontBol
53. IN otie Select os erea a a a 142 2 21 Introd ction recco eii i nE aE 142 2 2 2 Plugin or Coreplugin ssessesssessssssessessserssereseeesssressrese 143 2 2 3 How Plugins Are Called ay sticisstccesastsvseadevas deeds scceansedesss 143 2 2 4 Plugin Creation Check List ssseesseeesesssessseeesssesseese 145 2 2 5 Automatic Files Inclusion sssoseeseesseessesssesssesessseesseese 146 2 3 Adapting a PlUgID icen a i a aa ai 146 23l APPROACHES cieisne scene nn se pad ached R E NR 146 2S 25 Qverridings A PLUGIN Soit ienris iieiea ii 147 2 3 3 Extending a Plugin ssssssesseesssesessseesseessersseeseeessseessrese 147 2 3 4 Combining Both Approaches ssssssesesessseesseseesseessees 149 2 4 Special PIUZINS a iiesciecsesissavesgsnets siae nn R sentaaseaeese 151 CartoWeb Documentation 2 4 1 Export PHS UTS ionin aig adlsancigu ads d oad sues its seven detes 151 2 A 2 Filters eiin siti ial ar a ea 153 24 3 LADIES eint i ii a 155 3 Using the Security Infrastructure ssssseesseesseeseesseeessesseesseeeseeesseee 162 Dek Introd cti OM erena a aa E aia 162 3 2 Plugins Managing Security Database and Authentication 162 3 3 Plugins Granting or Denying Access to Objects Features in CartoWeb onsets ieas e AEE aas Ki aaas 162 A Intern tio alizati n ssia E E E assertions E taeaoee 164 A Vc Prams ations in E E E R A 164 4 amp 2 Character Set Encoding cssss stgczssgecscunsucevassdauadagaybeaeiavetiedaenv
54. InternationalizatioN Translated contents may be standard texts or even URLs useful for instance to display a logo adapted to the used language Some additional block properties are available but are automatically set depending on other parameter values and thus are not listed above private access PHP built in default values e type NULL e content empty string e fontFamily times e fontSize 12 e fontItalic false e fontBold false e fontUnderline false e color black e backgroundColor white e borderWidth 1 e borderColor black e borderStyle solid e padding 0 77 PDF Export e horizontalMargin 0 e verticalMargin 0 e horizontalBasis left e verticalBasis top e hCentered false e vCentered false e textAlign center e verticalAlign center e orientation horizontal e zIndex 1 e weight 50 e inNewPage false e inLastPages false e width NULL e height NULL e multiPage false e parent false e inFlow true e caption empty string e headers empty string e allowedRoles all e 118n false 12 2 4 Colors definition Colors definitions in exportPdf ini configuration file are done using hexadecimal color codes or a few textual aliases such as white black red green blue For instance general overviewOutlineColor template backgroundColor template borderColor blocks title color 12 3 Tutorial red white 000000 hexadecimal code for black 000
55. Ojoedemss debug Turn on output debugging writableowner OWNER The user who should have write permissions for 18 Installation generated files OVS Toot CVS Root directory to use when fetching CartoWeb project out of CVS s fetch trom cvs Fetch CartoWeb from CVS and install it in the current directory or in the directory given by the install location parameter NOTE You must be located where cartoweb3 directory will be created not inside like other commands cartoweb cvs option OPTIONS A string which will be given to the cvs checkout command of cartoweb not projects For instance to fetch a specific branch use r MY_BRANCH Or for a specific date DEA SSD AUS SU US es Cees eteh fron dir DIRECTORY Copy CartoWeb from the specified directory into the current directory or in the directory given by the install location parameter NOTE 1 You must be located where cartoweb3 directory will be created not inside like other commands NOTE 2 You may either use a path relative to the target cartoweb3 directory or an absolute path eS tcl el OC aN Directory where to install CartoWeb when using fetch from cvs dir options delete existing Overwrite existing directories if any no symlinks Do not use symbolic links even if your operating system supports them lt Gontig Erom file FTE Tocar TonTon ao CONTI Gurattonutd 1S for leuLomar1e variable replacement in in files NOTE You may eithe
56. PDF document general activatedBlocks comma separated list of strings names of blocks that will be used in the document Names must match block objects names See Blocks configuration section general overviewScaleFactor float sets the extension of the overview map The bigger this parameter the wider the extension Default 10 general overviewColor string sets the inner color of the current map outline in the overview Default none general overviewOutlineColor string sets the border color of the current map outline in the overview Default red general pdfEngine CwFpdflPdfLibLite name of the PDF engine to use For now only FPDF is available and must be called using CwFpdf pdfEngine value A PDFLib Lite version is very partially implemented and as a result should not be used for now pdfEngine value PdfLibLite general pdfVersion string PDF version that must be used only available with PdfLibLite pdfEngine general output inlinelattachmentllinklredirection indicates how generated PDF file must be output default redirection inline file is generated and displayed on the fly might not work with buggy IE attachment generated on the fly but a dialog box asks the user weither the file must be opened or saved link PDF file is actually written on the server and a link pointing towards it is displayed redirection PDF file is written on the server and than user s browser is automatically re
57. PIP VSR POEL rreran ena e a E E S EE EO EE ESE OaS 12 12 1 Introd ction sanina iia eai iiaia 72 12 2 Configuration Reference lt eis c c02 acs aainesosad as anaaases dete slesnaamosnseds 12 12 2 1 General Configuration saiacicietscsisanciiciess callie 72 12 2 2 Formats Configuration vsss4545 Siensides Sodas baveyasseerghedsuaeseueats 74 12 2 3 Blocks Configuration 0 ceeccceesceceeececeeeceeeeeeeeeseeeesaes 75 12 2 4 Colors definition feats canines Wasdagdnctesde tus a eeaysuntians aes tandenieted 78 12 3 T toria snn hie elon nial ec a ten Gee 78 123l General Principle ptysie tent anecs 78 12 3 2 Overall Configuration 200 0 ee ceeececeeececeeeceeeeeeeeeseeeesees 79 12 3 3 Blocks Configuration 2 siass giuisaeadi sdacgdckededag loco antenesoets 81 12 3 4 Roles Management x j5icsssagicdevsisdeatisssbadestesedets ss goudedestane 89 13 VIEWS cect teach anal daha easels a Red aa a aa Gaeta a alah aon hate 90 13 1 Introd ction seinir ssania eee 90 13 2 Views Confiourati n esineeseen lees n E N a 90 13 2 1s Views PIOUS nenen n anen n 90 13 2 2 Main Views Controller sssssesssesssesessseesseesseesseesseeesseee 90 13 3 Views Usage peercciresosiiii isra ipa iE Ka aa E eias 92 133 1 Loadi g VieWsSeisinricie nir e E 92 13 3 2 Editing VieWSacianiiiiuninddakssiadicws ai 92 14 S curity COMMSULATION ssie rresten soete seiere iais 94 14 1 Introduction isnin e iisa 94 42 Aut PUSI neroni R A toate 94 14 2 1
58. SymbolSize 57 CSV export plugin 70 D displayExtendedSelection 61 drawQueryUsingHilight 62 E enableTransparency 56 Export plugins 70 151 extent 58 F filename CSV 71 Filters 153 force_imagetype 60 Formats configuration PDF 74 formats object PDF 81 G General configuration PDF 72 general object PDF 79 H hilight_color 63 hilight_createlayer 63 hilight_transparency 63 HTML export plugin 70 l idRecenterActive 57 idRecenterLayers 57 id_attribute_string 62 ignoreQuery Threshold 62 Image blocks PDF 86 image mode 71 imagetype 60 initial mapstate 40 Internationalization I18n 105 L labelMode 67 layergroups 48 layerReorder 55 layers 48 Legend 52 Legend blocks PDF 88 lineLayer 68 loggedIn 95 M mapHeight 59 mapld 34 mapSizes height 59 mapSizes label 59 mapSizes width 59 mapSizesActive 59 mapSizesDefault 59 mapWidth 59 200 Index maskColor 68 mask_color 65 mask_transparency 65 maxMapHeight 59 maxMapWidth 59 maxResults 62 maxScale 58 minScale 58 multipleShapes 67 O outputformat 60 outside_mask 65 Overall configuration PDF 79 P panRatio 57 PDF 72 persistentQueries 61 Plugin adaptation 146 Plugin creation 142 Plugin extension 147 Plugin overriding 147 Plugins 141 Plugins calling 143 Plugins interfaces implementations 143 Plugins structure 141 pointLayer 68 polyLayer 68 P
59. Tables plugin is responsible for table formatting and display 2 4 3 1 Tables Structures Tables plugin declares several structures to help plugin developer manage tables These structures are e Class Table which includes in particular a list of rows class TableRow e Class TableGroup which includes in particular a list of tables Table groups are used for instance to separate table results coming from several plugins e Class TableFlags which defines parameters that will be useful for a plugin using tables Typically a plugin using table will include a TableFlags in its request and a TableGroup in its result This is the case for Query plugin which is the only core plugin which uses tables 2 4 3 2 Setting Rules Tables plugin maintains an object called the registry one on client and one on server This object allows to add table rules which will describes how tables must be displayed It is recommended to add rules in plugin s initialize method so they are ready at the earliest stage To obtain the registry object first you have to get the Tables plugin object On client public function initialize StablesPlugin S this gt cartoclient gt getPluginManager gt tables Sregistry StablesPlugin gt getTableRulesRegistry Add rules here 155 New Plugins On server plugin manager is stored in ServerContext object IER Se StablesPlugin Sthis gt serverContext gt getPluginMana
60. Tests php coreplugins AllTests php plugins AllTests php For the test_main project the hierarchy is the following coreplugins AllTests php plugins AllTests php misc AllTests php Mise tests gt 175 Unit Tests Each directory including tests root directory has a file named AllTests php This is called a test suite It is used to run all tests of a specific directory ie package Warning All test case and test suite classes must have the name of their file relative path without extension with replaced by _ For instance class client_CartoclientTest file name must be lt cartoweb3_root gt tests client CartoclientTest php The following example shows a test in common BasicTypeTest php file Example 6 1 Simple test case BasicTypesTests php lt php require_once PHPUnit2 Framework TestCase php require_once CARTOWEB_HOME common basic_types php j class common_BasicTypesTest extends PHPUnit2_Framework_TestCase public function testBboxFrom2Points Sbbox new Bbox Spointl new Point 12 34 Spoint2 new Point 56 78 Shbox gt S eELrromZPoi nts Spointl Spornt2 this gt assertEquals 12 bbox gt minx this gt assertEquals 34 bbox gt miny this gt assertEquals 56 bbox gt maxx this gt assertEquals 78 bbox gt maxy Each function with name starting with test will be considered as a test case by the automate
61. a Scale The simpliest way to obtain a map from CartoWeb server is to send an X Y location and a scale 134 Calling Plugins First thing to do is to declare the SOAP client Class SoapClient will need the WSDL code dynamically generated by script cartoserver wsdl php lt php Sclient new SoapClient http url to server cartoserver wsdl php mapld swiss_project swiss The map ID is required also in the request object Srequest gt mapId swiss_project swiss In this example only main map and scale bar are requested So key map s isDrawn attribute is set to false Srequest gt imagesRequest gt className ImagesRequest Srequest gt imagesRequest gt mainmap gt isDrawn true Srequest gt imagesRequest gt mainmap gt path Srequest gt imagesRequest gt mainmap gt width 500 Srequest gt imagesRequest gt mainmap gt height 500 Srequest gt imagesRequest gt mainmap gt format Srequest gt imagesRequest gt keymap gt isDrawn false Srequest gt imagesRequest gt keymap gt path Srequest gt imagesRequest gt keymap gt width 0 Srequest gt imagesRequest gt keymap gt height 0 Srequest gt imagesRequest gt keymap gt format Srequest gt imagesRequest gt scalebar gt isDrawn true Srequest gt imagesRequest gt scalebar gt path Srequest gt imagesRequest gt scalebar gt width 100 Srequest g
62. a aiaia 33 3 Projects HANGING euere a E E A airanauancdoate 34 3 1 Introd ct on wpcioneinh aie haiti neil Gh 34 D D Using Projects simre nutes ae e ao ae ae aeai e aati 35 3 2 1 Apache Environment Variable cece eeeeeseceeeeeeeeeneee 35 3 2 2 Using current_project txt yaveacigducsoses sors aureasduvetines tate tan dapueeee 35 3 2 3 Using a GET Parameter lt 2 sccasaisisasasesesdevtecedens saeaacsdasdine 35 3 2 4 Using the Projects Drop down List eee eeeeeeeeeeeeees 35 3 2 5 Using a Modified client php sssessssssesssesssesesssresssessesssee 36 A Config ration Fil S peieioccsd nie i a aa aaraa 37 4 1 Common client ini and server ini Options sssesesssessssseesssessee 37 4 amp 2 Cent I sneis Gel Mies eae a t ae e a alah stan ae 37 4 3 Server Configuration Files c ccccssescacsnssacestasessactaansccers tedeaeeaverens 39 A Sl UO CUCU ON sei a e eee te 39 4 3 2 Main Server Configuration File server ini 40 4 3 3 Map Configuration Files 2 0 0 eeececsseceeseeeeeseeeeeeteeeees 40 4 4 Ini Files for Plugins s sis cccesssvenacsisescadesspavcdsaseesnceassnecdeasdeeedeadeetecs 41 4 4 1 Ordering Tools Icons ssessssssesssesssssessseessessseresssessseessres 41 4 4 2 Grouping Tools Icons ssssssessseseseseesseessessersssressseessrese 42 4 5 Developer Specific Configuration ssssssssessssesesssessseseesseessees 42 5 Caches Configuration onisciente 44 5 LoS marty Cacheiro a E E A
63. able mainmap height in pixels for mapsize when mapSizesActive true mapSizes label 0 1 2 label that describes mapsize appears in drop down list If not specified a lt width gt x lt height gt pattern is used as the label mapSizesDefault integer indicates the default mapsize to be used among the above Only when mapSizesActive true If no mapsize settings are found the default mapsize is 400x200 pixels 8 2 Server side Configuration Here are the options that can be set maxMapWidth maximum allowed width in pixels of the generated mainmap If the value requested by the client is greater maxMapWidth takes precedence over it maxMapHeight maximum allowed height in pixels of the generated mainmap If the value requested by the client is greater maxMapHeight takes precedence over it 8 3 Related Elements in Mapfile 8 3 1 General Image Type 59 Image Format Options The general output fileformat is handled by Mapserver The basic command in the mapfile is IMAGETYPE png jpeg gif Then the OUTPUTFORMAT objects may set properties for each possible fileformat Example for jpeg OUTPUTFORMAT NAME jpeg DRIVER GD JPEG MIMETYPE image jpeg IMAGEMODE RGB FORMATOPTION QUALITY 85 EXTENSION jpg END See the available options for each format in the Mapserver doc Important note if you intend to use pdf printing interlaced png images are not supported by the fpdf library that is us
64. aced plugin name For instance to extend the layers coreplugin CartoClient part in your myProject project create a ClientMyProjectLayers php as follows lt php package CorePlugins version Id ClientMyProjectLayers php v 1 8 2005 02 23 11 52 43 johndoe Exp Sy class ClientMyProjectLayers extends ClientLayers public function replacePlugin return layers Add or overload methods here To be activated extended plugins AND coreplugins must be explicitely be declared in the loadPlugins parameter of your project general configuration files loadPlugins exportPdf auth myProjectLayers With no surprise extended classes can take advantage of the tools provided by the interfaces their parent classes implement By implementing additional interfaces they will have access to complementary interactions as well In that case don t forget to overload the matching interface defined methods in your extended class For instance ClientMyProjectLayers extends ClientLayers implements ToolProvider ES weap Uf 148 New Plugins Tip To use new config parameters in your extended plugin add them in the ini file of your project original plugin eg projects lt your_project gt client_conf lt original_plugin gt ini 2 3 4 Combining Both Approaches If you need to modify add templates or resources overrriding AND PHP classes extension you can combine both approaches by followi
65. agement CartoWeb enables to perform roles restrictions on most of the PDF document parts general access formats resolutions blocks All these elements can be restricted to some authorized users For a more detailed discussion of the concept of security restriction and roles see Chapter 14 Security Configuration To do so simply add to considered objects blocks an allowedRoles property set to the comma separated list of roles you want to restrict them to For instance e to enable PDF printing only for loggedIn users use general allowedRoles loggediIn e toreserve A3 format to editors or admins use formats A4 allowedRoles editor admin e to set a resolution limit for anonymous users when printing in A3 you can define 2 similar formats with different maxResolution and allowedRoles properties general formats A4 A3 A3full formats A4 label A4 formats A4 bigDimension 297 fFormats A4 smallDimension 210 formats A3 label A3 formats A3 bigDimension 420 formats A3 smallDimension 297 formats A3 maxResolution 150 formats A3 allowedRoles anonymous formats A3full label A3full formats A3full bigDimension 420 formats A3full smallDimension 297 formats A3full allowedRoles loggedIn Note that all formats that may be used must any way be specified in general formats e to hide a block for non admin users use blocks overview allowedRoles admin 89 Views 13 Views
66. ainmap zIndex blocks mainmap weight Lene blocks overview parent mainmap ii blocks overview zIndex Block margins are used to position a given block Horizontal positioning is achieved by specifying the horizontalBasis the side of the document leftlright used as a reference and the horizontalMargin the latter value tells how far in distUnit the block will be spaced from the reference line For instance to position a block at 10mm from the document right side use the following configuration general distUnit mm IE blocks myBlock horizontalBasis right blocks myBlock horizontalMargin 10 If you want to horizontally center a block it is simply done using blocks myBlock hCentered true Block centering overloads any other kind of positioning margin Vertical positioning is achieved in the same way substitute the dedicated keywords The inFlow parameter defaults to true except if set differently in the template block As aresult blocks with the same z Index will be positioned right below the first block preserving the left side alignment To cancel this behavior set inFlow to false In that case the given block will be positioned related to the previous block using margin or centering ways 12 3 3 3 Text Blocks Text blocks are boxes with a textual content The text is set in the content parameter in case of a static block content has to be left blank for visitor set blocks such as 83 PDF Export
67. alMargin 0 ate ate fontFamily times fontSize 12 fontItalic fontBold false black backgroundColor borderWidth 0 25 borderColor black solid false color white borderStyle padding 3 horizontalMargin 0 left verticalBasis top horizontalBasis hCentered false zIndex templ template templ template textAlign center ate verticalAlign center orientation horizontal 12 3 3 2 Blocks Positioning CartoWeb uses a CSS like syntax for blocks description and positioning Description depends on the block type and is detailed in following sections Blocks are positioned one after the other beginning by the ones with the lowest z Index vertical position the low zIndex ed blocks are placed under the high zIndexed ones ie closer to the background When blocks have equal zIndexes those with lowest weight are processed first Eventually if blocks have identical 82 PDF Export zIndexes and weights the system will use general activatedBlocks order to make its choice Blocks with different zIndexes wil not interact except if one is marked has the other s parent in that situation the child block will be located inside the parent block instead of using the general referencial All following siblings will share the same parent block except if they have a inFlow false property Parent blocks must have lower zIndexes than their children For instance blocks m
68. ally rendered using a new line for each result line and simply separating result elements with blank spaces For instance blocks myText content db pgsql user password localhost dbname select name phone_number from phone_book where area_id 12 Tip It is possible to make some text blocks have their contents translated by setting their i18n parameter to true For instance blocks myTextBlock content This text will be translated blocks myTextBlock il8n true Translatable blocks are CartoWeb built in blocks copyright and date as well as your own text blocks Some other CartoWeb built in blocks such as legend scaleval page or query results table blocks are translated anyway Note that you will have to explicitly add those entries to your Gettext PO files since there is no way for script client 2pot php to automatically detect them Tip 85 PDF Export The date text block is fully customizable You may specify the date format using PHP date formatting http php net date Both configurations are correct use to add the date string in complete sentence blocks date content Generated on Y m d H i by CartoWeb3 or if the date string is alone blocks date content Y m d H i If you want to have the date block translated set its i18n parameter to true and add the translated version including date format to your PO files 12 3 3 4 Image Blocks Image blocks are used to displa
69. also customize transparency values available in this selector with a comma separated value in transparencyLevels A transparency value is a integer between 1 to 100 with 100 mean an opaque layer as 1 mean a nearly invisible one 56 Navigation 7 Navigation The plugin location is the core plugin that deals with geographic navigation on the map It handles bboxes visible areas and scales it drives the tools zoom in zoom out and panning the directional arrows around the main map and the overview map The corresponding configuration files are Location ini client side and location ini server side 7 1 Client side Configuration Here are the options that can be set e scalesActive boolean if true the scales dropdown list is displayed default false If no visible scales are defined on the server a simple input text will be displayed e recenterActive boolean if true the coords recentering form is displayed default false e idRecenterActive boolean if true the id recentering fields will be displayed default false e idRecenterLayers the comma separated list of layers which will appear in the id recentering selection form If this list is absent all msLayers appear in the form e shortcutsActive boolean if true the shortcuts direct access dropdown list are displayed default false e scaleUnitLimit scale above which DHTML measures use km below they use m e panRatio ratio for panning by c
70. ame check as above 163 Internationalization 4 Internationalization 4 1 Translations Texts to be translated can be found in e Smarty templates see Section 16 2 Internationalization e Client and server ini files and map files see Chapter 4 Configuration Files e Client and server PHP code In the last case the script which finds strings to be translated see Section 15 1 2 PO Templates looks for calls to gt functions There are two different gt functions e 118n gt tries to translate the string given as argument and returns the translation This function assumes that string is UTF 8 encoded and returns a string ready for output see Section 4 2 Character Set Encoding It can be used on client side only e 118nNoop gt does nothing during runtime noop stands for no operations Call to this function is only needed to indicates that the string must be translated This function can be used on client and server side Below is an example on how to use I18nNoop gt Example for use of I118n gt functions client side a class ClientMyPlugin extends ClientPlugin implements GuiProvider ServerCaller public function initializeResult S myPluginResult Retrieves message Sthis gt message myPluginResult gt message public function renderForm Smarty S smarty Translation and display Ssmarty gt assign message 118n gt Sthis gt
71. apsadsvcendentasshadestesstatesasecdeneess 191 10 1 Tntrod ction snie e a a te eiae ais 191 10 2 Upgrade Tools ornis eiin E Re E 191 10 2 L Views Versions stein te dei etena tie a a 191 10 2 2 Upgrade Filters nssnciniicsn ieina 191 10 2 3 Upgrade Configuration ssessseseesssesssssesssseesssressee 192 A Mapserver Debian Installation 2000 0 eee eeeceecseececesececeeceeceeeeecsteeecsteeeenaeees 194 A 1 Setting Up Your Repository and Preferences File eee 194 A 2 Installing the packages c icassisisais Liccecascassasteasd cndacd sien ence dedatesuptalevanese 194 B Apache amp Mapserver Windows Manual Installation secsec 195 B 1 Apache PHPS Install sswccissdesecesesaancccesetesesensvaracdeondeecvanvcczanedebeaesosnads 195 B 2 Mapserver Mapscript Install 00 0 eee eeeececeeececeeececeeececseeceeseeeesaes 196 C DocBook Documentation Generation 0 ceecceeeeececeeeeeceteeeceteeeesteeeenaeees 198 C 1 Documentation Generation on UNIX like System 0 0 0 eee 198 C 1 1 Tiny DocBook Install eee ceeceeeeceeeeeeeceeeeeeeteeeeeneeeee 198 CV 2 JAT Vista ies ieoi aa a E Paes are RS 198 C 1 3 Create a Symbolic Link to Documentation Source 199 C14 XHTME Generationer igras Seat ieas 199 C 1 5 PDF Generation 2 aee icon atic iini nitis 199 C 2 Documentation Generation on Windows using Cygwin 4 199 TiO seh vies hea bbacieeec a Sowbddde ined ewe pedossdecaden Uo dandeve ena ees seed
72. artoWeb for running tests and infrastructure classes for more simple test case writing 177 Unit Tests 6 2 2 1 HttoUnit Based Tests To test features of the cartoclient the HttpUnit http httpunit sourceforge net software is used It is written in Java and there is no Php port The http unit tests are run if you have a JVM in you path For more information about running HttpUnit tests see the test s client httpunit README file in the CartoWeb distribution 6 2 2 2 Testing CartoWeb Plugins Plugins are a main component in CartoWeb architecture That s why there is support to maintain common code used for testing plugins As described in Section 6 2 1 General Information About Writing Tests the tests for plugins have to mirror the file hierarchy of the base application That s why there are coreplugins and plugins directories where test for core plugins and plugins are stored respectively Note Tests are also available for projects So to test a plugin in a project the path of the test will be lt cartoweb3 gt lt projectname gt tests plugin lt pluginname gt Testing plugins is separated into two tasks 1 Locally testing client common or server classes For plugin client classes it requires a CartoClient environment available and identically a CartoServer environment for testing server classes 2 Remote plugin tests throught the webservice API This kind of tests are related to the server p
73. ase letter Avoid using abbreviations 169 Code Convention 5 3 1 8 2 Functions and Methods Functions and methods should be named using the studly caps style also referred to as bumpy case or camel caps function handleKeymapTool Functions and methods names should always describe actions Developpers should declare the access modifiers public private protected for each function or method 5 3 1 8 3 Constants Constants should always be all uppercase with underscores to seperate words 5 3 2 Comments 5 3 2 1 Php Doc Comments To improve php code and object structure readability automatic code documentation is implemented in CartoWeb It is based on specific comments describing classes methods interfaces and objects See Chapter 7 Code Documentation for more information 5 3 2 2 Inline Comments As often as necessary the developers should add code comments to explain verbosly the purposes of commands 5 4 HTML Coding Standards In CartoWeb mainly for the templates HTML coding should respect some rules To take benefits of recent browsers enhancements and above all to make HTML codes easier to read and maintain some HTML coding guidelines should be followed e for indentation preferably use 2 white spaces such an indentation might be used for javascript coding as well e Generated HTML pages should be XHTML 1 0 say Transitional for now valid and pass matching W3C validation http
74. auth ini Client side enoonsoneneneessssnsoseeesesssssseseeeese 95 14 2 225 pecial Role Names ciciscgcocuasucaesecheradaeaybyasiaes oesi 95 14 3 Global CartoWeb Permissions 0 ceeccceesceceeececeeececeeeeeeeaeees 96 14 4 Plugin Specific Permissions c ceesceceenceceeeceeeeeeeceeeeeesaeees 96 14 4 1 Layers Related Permissions ceescceeesceesseeeeeeeeeeees 96 14 4 2 PDF Printing Permissions ceeesseeeeceeeeeeeeseeeeeeeees 98 15 Internationali zation jpecciiccvcasis seadinecvcisisadeaccravaccesassseedeaavecseeededenteaswaeans 99 Wg AT ras VALOIS gest ties te te tie hts Aare ge ens de cenit ke cot a teeta ened 99 15 11 Comfisuration lt scicniiiccisesad lisesi n 99 P5512 PO Templates iono nkra tines 100 151 3 Trams lating vsin instrai eina 101 15 1 4 Compiling PO to MO nssssssssesssessssssssssesssrsseessssessseessse 101 13 155 Example cujtaiciankvinnntiinudaknsiiadices aN a 101 15 1 6 Debuging translation problems seseseseceseeereeeeseee 102 15 2 Character Set Encoding Configuration 20 0 0 eeeeeeeeeeeeeees 104 16 Lemp lating serere a e TEE airetaaencies 105 16 1 Introduction reinurnnsnin oina a a T a na 105 CartoWeb Documentation 16 2 Internationalization 5 oss spasceuh lies ae daahen ponds 14 adele ate aenaeedacten 105 16 3 RESOURCES nsina nanni ieee 105 MI Developer Man al errre nesteet iaa tii eE aE 107 Le Callinig PIUSINS seiiet aa ia ean 108 1 1
75. ayer lt layer_name gt _mask is not defined e outside_mask layer_name name of layer which will mask the outside aka complement If not set will try to find a layer named default_outside_mask Examples Mask using lt layer_name gt _mask layer LAYER NAME foo END LAYER NAME foo_mask END Mask using lt layer_name gt _mask layer and an outside mask LAYER NAME foo METADATA Youbside mask bar END END LAYER NAME foo_mask END LAYER NAME bar END Mask using dynamically generated layer and default outside mask LAYER NAME foo METADATA hese Color WASS AIS AA mask_transparency 60 END END 65 Queries LAYER NAME END default_outside_mask 66 Annotation and Redlining 10 Annotation and Redlining Imagine you want to draw some features points lines polygons in your map to show specific data and or print it The outline plugin is what you need It allows you to draw features and to annotate them with label texts It s also possible to use polygons shapes as a mask layer see Mask mode User can choose between mask or draw mode with radio buttons See Section 10 2 1 outline ini for more information Shapes colors and styles should be set with specific configuration in the mapfile See Section 10 3 Related Elements in Mapfile The total area of the drawn polygons is displayed on the interface 10 1 Client side Configura
76. b and gives some tips for debugging the application The two concepts are somewhat related as logging is often used as a way to ease debugging 8 2 Logging Logging is an important feature for being able to see what happens debug more easily the application and track invalid or unexpected situations The logging framework used for CartoWeb is Log4php http logging apache org log4php Log4php is a portage to Php of the famous Log4j Java logging library Thus Log4php has lots of similarities with Log4j and users familiar with it will have no problems understanding it 8 2 1 Log4php Configuration Files Log4php settings are customizable in the client_conf cartoclientLogger properties configuration file on the CartoClient and server_conf cartoserverLogger properties on the CartoServer For the detailed syntax of the configuration file see the Log4php documentation A very short introduction is given there The line log4php rootLogger DEBUG A1 can be uncommented which will activate the loggers defined in the lines starting with log4php appender NAME where NAME is the name in the list DEBUG Ai After the loggers are activated the the log output will be redirected to the corresponding location In the line log4php appender Al file LOG_HOME cartoclient log the LOG_HOME variable has a special meaning it is expanded to the log directory of the CartoWeb distribution One powerful feature of Log4php
77. bjects can be done using standard Mapserver queries or using special Hilight plugin See Section 9 3 2 Hilight Configuration for more information Results are returned and displayed using Tables plugin See Section 9 1 2 Tables Configuration for more information 9 1 Client side Configuration 9 1 1 query ini Here are the options that can be set in client s query ini e persistentQueries if true queries will be persistent If false selection is lost after next page reload Note that persistency will work only with layers with id_attribute_string set see Section 9 3 Related Elements in Mapfile e displayExtendedSelection if true shows form for selection extended functions This form is mainly used by developers see TODO link to developer s doc e queryLayers the comma separated list of layers which will appear in the extended selection form If this list is absent all msLayers appear in the form e returnAttributesActive if true the layers attributes can be requested If false only object IDs will be returned default false e weightQuery integer which defines display order of the query tool icon in toolbar default 40 Negative weighted tools are disabled 9 1 2 Tables Configuration Tables plugin can be used by any plugin to manage transfer and display tables structure In basic CartoWeb installation only Query plugin uses this functionality 61 Queries To configure table appearanc
78. c php Gel SERIUjES php makedoc php This will generate documentation in directory CARTOWEB_HOME documentation apidoc 7 2 DocBlocks DocBlocks are comments located at the beginning of a file or just before a class a method a function outside a class or a variable declaration These comments will be parsed by PhpDocumentor to generate documentation For a full description of DocBlocks see official PhpDocumentor documentation http phpdoc org docs HTMLSmartyConverter default phpDocumentor tutorial_phpDocumentor howto pkg html basics docblock 7 2 1 DocBlocks Types In CartoWeb we use e Page level DocBlocks one DocBlock for each PHP file e Class method class variable and function outside a class DocBlocks one DocBlock for each e Require include define if needed one DocBlock for each or all 7 2 2 DocBlocks Contents e Short description if needed a one line description e Long description if needed a longer description e package lt package gt file class we use one package for each directory which 180 Code Documentation contains PHP files it means there are the following packages Client Server Common CorePlugins Plugins Scripts Tests author lt author gt file author with email address version Id file always Id content automatically set by CVS param lt type gt lt description gt method type mandatory description if needed return
79. callback method with the following signature static function myCallbackMethod table_id column_id eucreshy toee array 157 New Plugins Meola iY Ss Wyerlline il seeny i 5 column_2 gt value_2_row_1 WILY SS Array Wero line il Ss yale il row 25 Foe lumn 2 ss tya lue 2 row 2 return array 0 gt cell_value_row_1 1 gt cell_value_row_2 2 4 3 2 8 Row Unselector public function addRowUnselector groupiId Stableld Scolumnid rowIds Row unselector rules allow to remove some rows from a table Parameter rowIds contain IDs of row that must be removed 2 4 3 2 9 ColumnAdder public function addColumnAdder S groupiId Stableld ScolumnPosition newColumnIds SinputColumniIds callback Column adder rules allow to add one or more columns to the table Parameter newColumnIds should contain the list of new column IDs Values of columns given in parameter inputColumnIds will be transfered to the callback method for cell content calculation Parameter caliback should contain a pointer to a callback method with the following signature static function myCallbackMethod table_id array Column Ei gt sealant column_2 gt value_2 return array new_column_1 gt cell_value_l1 new_column_2 gt cell_value_2 Parameter columnPosition indicates where the new columns must be inserted It should be an instance of class ColumnPosition Positions can be ab
80. cells type types ArrayOfString gt lt all gt lt complexType gt 110 Calling Plugins e rowld row ID e cells cell contents see Section 1 1 1 Simple Types for a description of type ArrayOfString lt complexType name ArrayOfTableRow gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types TableRow gt lt restriction gt lt complexContent gt lt complexType gt e array list of rows lt complexType name Table gt lt all gt lt element name tableId type xsd string gt lt element name tableTitle type xsd string gt lt element name numRows type xsd integer gt lt element name totalRows type xsd integer gt lt element name offset type xsd integer gt lt element name columniIds type types ArrayOfString gt lt element name columnTitles type types ArrayOfString gt lt element name noRowId type xsd boolean gt lt element name rows type types ArrayOfTableRow gt lt all gt lt complexType gt tableld table ID e tableTitle table title e numRows number of rows in table e totalRows total number of rows in context for future use e offset current position in context rows for future use e columnlds column IDs see Section 1 1 1 Simple Types for a description of type ArrayOfString e columnTitles column titles see Section 1 1 1 Simple Ty
81. className type xsd string gt lt element name bbox type types Bbox gt lt element name queryAllLayers type xsd boolean gt lt element name defaultMaskMode type xsd boolean gt lt element name defaultHilight type xsd boolean gt lt element name defaultTableFlags type types TableFlags gt lt element name querySelections type types ArrayOfQuerySelection gt lt all gt lt complexType gt e className QueryRequest or extended class name if project implements an extension e bbox bounding box when querying with a rectangle see Section 1 1 2 Shapes for a description of type Bbox e queryAllLayers if true will execute query on all selected layers ie layers sent through Layers request see Section 1 3 3 1 Layers Request Unused when 128 Calling Plugins bounding box is not specified e defaultMaskMode mask mode for new layers returned by query and but not yet in array querySelections Unused when queryAllLayers false e defaultHilight highlight for new layers returned by query and but not yet in array querySelections Unused when queryAllLayers false e defaultTableFlags table flags for new layers returned by query and but not yet in array querySelections see Section 1 1 3 Tables for a description of type TableFlags Unused when queryAllLayers false e querySelections list if query selections It contains all objects that must be hilighted and
82. crolkoie Wai 2a 0 area_fixed_value 10 END lone END The metadata key exported_values is a bit special It gives the list of metadata keys coma separated which will be transmitted to the client This is required for the metadata keys describing layer security for instance as they are used on the CartoClient 6 3 2 Metadata in layers ini The configuration file layers ini may also contain metadata key value pairs This is needed for LayerGroup objects as these have no counterparts in the mapfile For simple layers the metadata specified in the layers ini take precedence over the values from the mapfile For each layer object in the layers ini file the following syntax is used to set metadata e layers layerld metadata METADATA value For instance layers group_admin className LayerGroup layers group_admin children grid_defaulthilight layers group_admin metadata security_view admin 6 3 3 Using the metadata fields in templates layers tpl Metadata declared in mapfiles or layers ini can be used in the layers tp1 Smarty templates using the following notation capture name caption Selement layerLabel lt a href lang Selement layerMeta lang amp client_id element layerMeta client_id gt element layerMeta complex_label lt a gt 51 Layers capture As we can see in the previous example metadata values can be used through the layerMeta property of the element Smarty var
83. ctive boolean Whether to show the Authentification login logout buttons note this is not related to the fact the authentification system will be active or not e users USERNAME List of users and their passwords USERNAME is the name of the user for whom the password is set Passwords values are md5sums of the password To get this value you can type in a shell echo n mypassword md5sum Example users alice e3e4faee0cc7fc55ad402f517cdaf40 e roles USERNAME List of roles for each user USERNAME is replaced by the user for whom the roles are set Some roles have a special meaning see Section 14 2 2 Special Role Names 14 2 2 Special Role Names The auth plugin configuration described in the previous section references the notion of users and roles Basically a role can be any string the application will only use them as a way to check if a feature is allowed or not However a set of role name have a special meaning They are described below Special Roles all This role belongs to any user It is useful in case a permission should not be restricted access loggedIn This role is given to all users who have logged in the application It means they are identified to 95 Security Configuration the system with a username anonymous This role is given to all users not known to the application This role is attached to anyone who has not yet entered her username and password Example 14 1 Special Role Nam
84. d boolean if true text will be bold weighted font Underline boolean if true text will be underlined color string color of text in hexadecimal code rrggbb A few color aliases white black are available as well backgroundColor string background color in hexadecimal code or color aliases borderWidth float border line width in distUnit borderColor string border line color in hexadecimal code or color aliases borderStyle solididashedldotted border line style Only available with PdfLibLite pdfEngine solid value is used for other pdfEngines padding float vertical and horizontal distance between block content and its borders in distUnit horizontalMargin float horizontal margin in distUnit around the block outside borders verticalMargin float vertical margin in distUnit around the block outside borders horizontalBasis leftlright indicates what document side must be used for horizontal positioning verticalBasis toplbottom indicates what document side must be used for vertical positioning hCentered boolean if true block is horizontally centered overloads horizontalBasis property vCentered boolean if true block is vertically centered overloads verticalBasis property textAlign centerlleftlright indicates how content must be horizontally aligned within the block extent verticalAlign centerltoplbottom indicates how content must be vertically aligned within the
85. d e g no are allowed e layers layerld msLayer string name of the corresponding Mapserver layer in the mapfile e layers layerld label string caption of the layer in the layer tree on the client this is a raw label before any internationalization The i18n scripts automatically include this label in the strings that can be translated e layers layerld icon filename filename of the static picto that illustrates this Layer in the layer tree The path is relative to layers ini See also Section 6 4 Layers Legends for a description of the automatic legending process e layers layerld link url provides a link for the layer e g to some metadata makes the caption in the tree clickable 6 2 3 LayerGroups Options Here is the syntax for the various configuration parameters of LayerGroups Note that 48 Layers a special LayerGroup with layerld root must be present Unsurprisingly it is the root top level of the hierarchy It doesn t appear in the visible tree e layers layerld className LayerGroup defines the object as a LayerGroup layerld is a string that uniquely identifies the object The general rules of syntax for a ini file must be respected in the choice of the layerld e g no are allowed e layers layerld children list of layerlds comma separated list of layerlds these children may be Layers or other LayerGroups e layers layerld children switchlId list of layerlds comma sepa
86. d many more 2 1 2 Plugins and Coreplugins There are two kinds of plugins e coreplugins fundamental plugins that perform low level actions such as map size handling browsing tools layers selection Plugins that are frequently used in many CartoWeb applications may be included in this category as well They are always available and activated As a result other plugins may interact with them Coreplugins files are grouped in the coreplugins directory e plugins normal plugins perform more specificactions and are not always activated Normal plugins activation is done by setting the loadPlugins parameter in client_conf client ini for CartoClient plugins and in server_conf lt mapId gt lt mapid gt ini for CartoServer ones For instance loadPlugins auth outline exportHtml Since they are not always available simple plugins usually do not rely on each other On the other hand it is not a problem for them to call some coreplugins functionalities if the latter are publicly accessible Simple plugins files are grouped in the plugins directory The general philosophy is to gather all files of a given plugin in the same dedicated directory including files from both CartoClient and CartoServer sides of the plugin Thus it is easy to plug a new module in CartoWeb architecture by simply pasting it in the plugins or coreplugins parent directories Note however that plugins configuration files named lt pluginName gt ini are placed
87. d plugin session containers 10 2 3 Upgrade Configuration See Section 13 2 2 Main Views Controller Only two of these parameters are related to views upgrading viewLogErrors enables to log outdated views loadings whereas viewUpgradeOut dated is useful to activate or not the upgrading device if 192 Upgrading Views Data deactivated outdated views parts are discarded 193 Mapserver Debian Installation Appendix A Mapserver Debian Installation Some Debian packages are available for Php5 and Mapserver A 1 Setting Up Your Repository and Preferences File Add the following to your etc apt sources list cartoweb deb http dev camptocamp com packages debian prod sarge main deb src http dev camptocamp com packages debian prod sarge main You may want to pin c2c packages higher than 1000 to have them preferred over the upstream ones even if downgrading Add in etc apt preferences Package Pin release o c2c Pins enion eyi ILLOO A 2 Installing the packages To install Mapscript and PHP 5 type the following apt get update apt get install php5 mapscript If want to install PostGIS and PostgreSQL apt get install libpostgis1l pg80 If want to install the pgdijkstra PostgreSQL extension apt get install pgdijkstra Some of the packages were inspired from http agrogeomatic educagri fr 194 Apache amp Mapserver Windows Manual Installation Appendix B Apache amp Mapserve
88. d test runner You may also want to use functions set Up and tearDown to initialize and clean a test environment Method assertEquals tests if two values have the same values If not the test will be added to the final report as failure As stated previously all test classes have to belong to a test suite The next example shows how such a test suite is built by grouping all tests together in the suite method 176 Unit Tests Example 6 2 Test suite AllTests php lt php require_once PHPUnit2 Framework TestSuite php require_once CartoclientTest php require_once CartoserverServiceTest php class client_AllTests publies catre runc Erom surtedy 4 Ssuite new PHPUnit2_Framework_TestSuite Ssuite gt addTestSuite client_CartoclientTest Ssuite gt addTest Suite client_CartoserverServiceTest return Ssuite All test suites are then grouped together into the root test suite It is shown there for information Example 6 3 Root directory s AllTests php lt php require_once PHPUnit2 Framework TestSuite php require_once client AllTests php require_once common AllTests php class AllTests public static function surted Ssuite new PHPUnit2_Framework_TestSuite Ssuite gt addTest client_AllTests suite Ssuite gt addTest common_AllTests suite return Ssuite 6 2 2 Specific Information for Tests This section describes specific features developped in C
89. de e htdocs Web accessible directory e server Server side plugin code e templates Smarty templates 2 4 Projects The aim of projects in CartoWeb is to clearly separate mainstream files from project specific files Developers should thus only work in projects and not modify add delete files in the root directory This will ensure smooth updates The directory projects my_project has exactly the same structure as the root directory shown above Section 2 2 Global Directory Structure Files added in directory projects override corresponding files of the root directory For instance if you want to change the layers template i e basically the representation of the layers hierarchy simply copy the default coreplugins layers templates layer tpl tO projects my_project coreplugins layers templates layer tpl and make your changes there For more information about projects see Chapter 3 Projects Handling 33 Projects Handling 3 Projects Handling 3 1 Introduction Projects are used to customize a CartoWeb application to your needs By creating a new project you can override templates resources files pictures style sheets JavaScript files etc configuration files and even add new plugins or modify existing ones It is strongly recommended to use projects when deploying a CartoWeb application with non standard layout or plugins The main reason is the necessity to keep upstream files unchanged in
90. de dynamically generated by script cartoserver wsdl php lt php Sclient new SoapClient http url to server cartoserver wsdl php mapld swiss_project swiss The map ID is required also in the request object Srequest gt maplid swiss_project swiss In this example only main map and key map are requested So scale bar s isDrawn attribute is set to false Sreq Sreq Sreq Sreq Sreq Sreq Sreq Sreq req req req req req req req req uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images uest gt images Request gt className ImagesRequest Request gt mainmap gt isDrawn true Request gt mainmap gt path Request gt mainmap gt width 500 Request gt mainmap gt height 500 Request gt mainmap gt format Request gt keymap gt isDrawn true Request gt keymap gt path Request gt keymap gt width 100 Request gt keymap gt height 100 Request gt keymap gt format Request gt scalebar gt isDrawn false Request gt scalebar gt path Request gt scalebar gt width 0 Request gt scalebar gt height 0 r Request gt scalebar gt format 8 Two layers are displayed Resolution attribute is set to null to
91. depending on the switch ID may add this ID as a suffix to the children option layers layerId className LayerGroup layers layerId children switchl layerl layer3 layers layerId children switch2 layer2 layer3 layers layerId children switch3 Special suffix default can be used to define a default children list layers layerId className LayerGroup layers layerId children switch2 layer2 layer3 layers layerId children default The following layer group definitions are equivalent layers layerId className LayerGroup layers layerId children default layer4 layers layerId className LayerGroup layers layerId children layer4 6 3 Metadata in Mapfile and layers ini Metadata are keyword value pairs which can be associated to a MapServer layer in the mapfile or to a Layer or LayerGroup in the layers ini configuration file These metadata are used in several different contextes such as layer specific configuration security handling The metadata related to the functionalities of CartoWeb are described in the documentation of the corresponding plugins 6 3 1 Metadata in Mapfiles 50 Layers Specifying metadata in mapfiles is based on the standard MapServer syntax For instance LAYER NAME my_layer Daci METADATA exported_values security_view security_edit security_view admin security_edit admin editors Hre aner pure steing F Ppi errang mask_transparency 50 mask t
92. direct mode is not used and can be used for any webservice for which the output only depends on the input arguments 5 6 Caches Configuration 5 6 1 Rationale All cache configuration name are in the form noxxxName where xxx is the name of the cache This is so so that if the parameter is not available its default value will be false meaning that all caches are active by default for maximum performance Warning These parameters will be overrided by the profile parameter See Section 4 1 Common client ini and server ini Options 5 6 2 Client and Server Cache Options These parameters are available in client_conf client ini for client and server_conf server ini for server e noWsdlCache truelfalse disables the caching of wsdl ignored if useWsdl is false e noMapInfoCache truelfalse disables the caching of MapInfo requests 5 6 3 Server Cache Options 45 Caches Configuration These parameters are available in server_conf server ini e noMapResultCache truelfalse disables the caching of getMap requests e noSoapXMLCache truelfalse disables the caching of SOAP XML requests 46 Layers 6 Layers 6 1 Introduction Geographical data are most often apprehended as thematic layers you may have a layer Rivers a layer Aerial view a layer Average income just to cite a few examples Now the basic purpose of any viewer is to make these data available to users by allowing navigati
93. directed towards it general filename string indicates how generated PDF files must be named It is possible to specify a date formatting using PHP date format see http php net date Default is map date dMY His pdf which gives for instance map 03Jan2005 193256 pdf general distUnit mmlcmlptlin unit used to measure blocks distance properties Only one unit can be used in the whole configuration general horizontalMargin float horizontal distance between the sheet border and the useful area in distUnit general verticalMargin float vertical distance between the sheet border and the useful area in distUnit general allowedRoles comma separated list of strings list of roles allowed to print PDF documents general importRemotePng boolean if true remote PNG files gathered using 73 PDF Export a URL are copied in a local directory before being included in the PDF document This option is recommended when using physically separated CartoClient and CartoServer See Chapter 4 Configuration Files PHP built in default values e pdfEngine CwFpdf e pdfVersion 1 3 e distUnit mm e horizontalMargin 10 e verticalMargin 10 e formats NULL e defaultFormat NULL e resolutions 96 e defaultResolution 96 e activatedBlocks NULL e filename map date dMY His pdf e overviewScaleFactor 10 e overviewColor NULL e overviewOutlineColor red e output redirection e allowedRoles empty ie n
94. e Failure while launching msgcat to code iso 8859 1 use first output www cartowe www cartoweb3 projects demo po demo en po www cartoweb3 projects demo po client en po output is www cartoweb3 projects demo po client en po 392 duplicate message definition www cartoweb3 projects demo po client en po 390 this is the location of the first definition msgcat found 1 fatal error duplicate message definition on line 392 in client en po e Check if you have several fuzzy entries in your merged po file the file that is automatically created by gettext merging the client and server po files This happens when you have used the same msgid in different po files Note Each po file contain a single fuzzy entry at the beginning this should not be removed fuzzy MS e msgstr POT Creation Date 2005 09 13 09 36 0200 n e Gettext automatically comments msgid and msgstr that are not found anymore in your templates Commented lines start with Sometimes this is unwelcome simply uncomment the lines e If your CartoWeb profile is set to production Section 4 1 Common client ini and server ini Options do not forget to clean the temporary templates files by typing php cw3setup php clean See Section 1 1 3 2 4 Cleaning Generated Files Map PDF Temporary Files and Smarty Cache for more details Note It can also be usefull sometimes in development mode 103 Internationalization 15
95. e use tables client side rules described in Developer s Documentation Section 2 4 3 Tables 9 2 Server side Configuration 9 2 1 query ini Here are the options that can be set in server s query ini e drawQueryUsingHilight if true query hilighting will use Hilight plugin In this case Hilight plugin must be loaded on server If false objects will be hilighed using MapServer query functionality See also Section 9 3 2 Hilight Configuration default false e noRowld if true row id will not be included in the table In this case the row id will not be displayed in the output table html pdf etc default false 9 2 2 MapServer Query Configuration MapQuery plugin can be used by any plugin to retrieve objects information from MapServer Following options can be set in server s mapquery ini e maxResults Maximum number of results to handle in the query plugin This limit is to avoid high load on the server It should be the client responsibility not to ask too many objects to avoid reaching this limit Ignoring big queries can be done with the ignoreQueryThreshold parameter which give a better behaviour for the user e ignoreQueryThreshold Do not take into account the elements selected by a shape rectangle polygon in a query if this shape intersects more than ignoreQueryThreshold objects It should be less than maxResults to have informative messages to the user 9 3 Related Elements in Mapfile 9
96. e Usage general allowedRoles loggedIn 14 3 Global CartoWeb Permissions The whole application can be denied access to anonymous users only authenticated or a set of users can access the application Anonymous users arriving on the main page will see a login dialog page if they have no rights to view the page if the auth plugin is not loaded they will simply see a denied page This feature can be parametrized on the CartoClient in the client ini configuration file e securityAllowedRoles list List of roles which are allowed to access the cartoweb Set to all if no if no restriction is given see Section 14 2 2 Special Role Names for typical predefined roles Example 14 2 Global Permissions Usage securityAllowedRoles loggedIn 14 4 Plugin Specific Permissions The main part of permissions is set in the different plugins of CartoWeb For instance permissions related to which layer can be viewed are set in the layer plugin configuration files and pdf printing permissions in the pdf plugin These sections either describes the plugin permissions which can be used or make references the the corresponding chapters 14 4 1 Layers Related Permissions It is possible to restrict which layer can be viewed by a set of users For instance only 96 Security Configuration logged in admin users can be allowed to view security sensitive layers These layer permissions are inherited by children It mean
97. e called with no spaces between the function name the opening parenthesis and the first parameter spaces between commas and each parameter and no space between the last parameter the closing parenthesis and the semicolon This is correct Svar foo Sbar Sbaz Squux 168 Code Convention 5 3 1 4 Function Definitions Function declarations follow the one true brace convention Arguments with default values go at the end of the argument list Always attempt to return a meaningful value from a function if one is appropriate 5 3 1 5 Class Modifiers Modifiers keywords public protected private are mandatory in class members and methods definitions It is recommended to use private for most members and properties Use public only for methods that needs to be accessible from outside the class In coreplugins or plugins classes it is generally better to use protected instead of private since most methods may have to be redeclared in extended classes projects plugins Then only use private for members properties you do not want to be redeclared 5 3 1 6 Nesting Avoid deep blocks nesting This is correct Loe Si 0p Si Ss rH I if something Sa continue doMore 5 3 1 7 PHP Code Tags Always use lt php gt to delimit PHP code not the lt P BS shorthand 5 3 1 8 Naming Conventions 5 3 1 8 1 Classes Classes should be given descriptive names that should always begin with an upperc
98. e gt e symbol index of Mapserver symbol e size size of shape e color color e outlineColor outline color e backgroundColor background color e transparency transparency lt complexType name LabelStyle gt lt eulil gt lt element name font type xsd int gt lt element name size type xsd int gt lt element name color type types Color gt lt element name outlineColor type types Color gt lt element name backgroundColor type types Color gt lt all gt lt complexType gt e font index of Mapserver font e size size of font e color color e outlineColor outline color e backgroundColor background color lt complexType name StyledShape gt sanba lt element name shapeStyle type types ShapeStyle gt lt element name labelStyle type types LabelStyle gt lt element name Shape type types Shape gt lt element name label type xsd string gt lt all gt lt complexType gt e shapeStyle style of shape 130 Calling Plugins e labelStyle style of label e shape shape can be a point rectangle line or polygon see Section 1 1 2 Shapes for a description of type Shape e label content of label lt complexType name ArrayOfStyledShape gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types StyledShape gt lt restriction gt lt complexContent gt lt c
99. e in the graphical interface of the views plugin This value is usefull to know the time of the creation modification of a view only available with option viewStorage db 13 3 Views Usage 13 3 1 Loading Views Any defined view may be loaded by any users Loading a view may be achieved selecting it among a dropdown views list Two dropdown lists are available e apublic one that only displays views labels that have been marked as visible by their creators e a selector within the Views plugin edition interface This view selector contains all views including the ones that have not been marked as visible by their creators Note that this selector provides a view ID integer input as well Views may also be loaded using GET parameters in URLs that look like http lt cartoweb client base url gt handleView 1 amp viewLoad 1 viewLoadid lt viewId gt or simply http lt cartoweb client base url gt view lt viewld gt Tip Views not marked as visible may anyway be loaded by anyone Visible only means that their labels appear in the public view dropdown selector whereas invisible ones don t 13 3 2 Editing Views Views edition is restricted to users whom roles match at least one of those specified 92 Views in the client_conf client ini viewAuth parameter see Section 13 2 2 Main Views Controller Views editors can create update or delete views 13 3 2 1 Saving a View To save the cur
100. e where the metadata key is set on a layer group in the lt layers gt ini configuration file layers group_admin className LayerGroup layers group_admin children grid_defaulthilight layers group_admin metadata security_view admin In this example the admin role is set for the layerGroup called group_admin You 97 Security Configuration can notice the very similar syntax as used in the mapfile Warning Don t forget to set applySecurity to True in the layers ini CartoClient configuration file otherwise security metadata keys won t be taken into account 14 4 2 PDF Printing Permissions The roles management in Pdf printing is explained in detail in Chapter 12 PDF Export In particular see Section 12 3 4 Roles Management 98 Internationalization 15 Internationalization 15 1 Translations Translation handling in CartoWeb was designed to use gettext http www gnu org software gettext manual However internationalization architecture is ready for other translation systems 15 1 1 Configuration For now only gettext translation system is implemented If gettext is not installed you can use a dummy translation system which translates nothing To use gettext you will need to have PHP gettext module installed Translation system is now automatically set to gettext if gettext is installed otherwise it s disabled Parameter 77 8nClass is now deprecated 15 1 1 1 Unix like In Unix li
101. eaosnacteenuhesbeansiocsaes 61 DTA QUE IMU Seasccesactssreacieeacensals saecesunec AE a Ea 61 9 1 2 Tables Configuration ix cae mera scat cccotda iene usnesecnten aire taaeaciasee 61 9 2 Server side Configuration av sscssessas vs deccsasangssadevesdccessseaeaieedassans 62 9 2 A gueri e ous dagivalnecauseatodaces E ER 62 9 2 2 MapServer Query Configuration ssssssessseseseeeesseesseee 62 9 3 Related Elements in Mapfile 00 eee eeecceceeeeceeececeeeceesteeeesaes 62 OS als Meta D t iocnsssinesnosnenesunitanni aines 62 9 3 2 Hilight Configuration ioss 55 45005 5e0525asehen shes setsacenceadaheadeoetacsans 63 10 Annotation and Redlining eee ceeececeeneceeeeeceeeeeceeeeeceeeeeceeeeeeteeeee 67 10 1 Client side Configuration s 00 25 aici shnesoadesoees triaseesandsaueiedacsatte 67 LO outlineant acanna inaa 67 10 2 Server side Configuration go ossievegihosassucessesderadayoateceseeaedamondterns 67 10 21 0UtliNne Di veioieseaniiiini atenieni iaasa 67 10 3 Related Elements in Mapfile sossnneeesseessessseeesseessseesssesseessee 68 LOS Layers enni a E aN Ei 68 10 3 2 Labels aise tates rse eea et e aaaea a ES 68 II Export Pl s ennen nierit a E RAT EES aiaa 70 KIT TPO CECE LO Iie oseese e E ae 70 11 2 HFEMLC EX poit coynei auan nen na T N A 70 CartoWeb Documentation ITS CSV EPOE cease ccvonss des sashes tess asad adeno wig HR saad E ad 70 PLA Image Qunpul sou ecieis ers n s a e ai sai 71 2
102. ed blocks such as title mainmap overview scalebar note copyright queryResult legend page scaleval tlcoords brcoords System blocks should not be renamed Note that blocks that are not mentioned in general activatedBlocks won t be 81 PDF Export displayed in any case general activatedBlocks mainmap title note scalebar overview copyright page logo scaleval tlcoords brcoords queryResult legend 12 3 3 1 Block Template and Overriding Since all blocks descriptions are based on the same PdfBlock object a template block has been defined to factorize blocks common configuration for instance font family background color borders padding etc It is also a way to specify default blocks parameters values It is then possible to personalize blocks by overriding those properties within the block own description Blocks configuration overriding can be schemed as follows PHP PdfBlock hard coded gt gt gt block template user configured gt gt gt final block user configured Note that it is not necessary to redefine properties in blocks or in their template if their current values defined in parent structures are already OK For instance FeO OCIS templ default settings ate type text template templ template templ template templ template template templ template templ template templ template template ate ate ate ate ACE vertic
103. ed in this module Consequently you must have the option FORMATOPTION INTERLACE OFF in the definition of the png OUTPUTFORMAT Here is the complete object OUTPUTFORMAT NAME png DRIVER GD PNG MIMETYPE image png IMAGEMODE PC256 EXTENSION png FORMATOPTION INTERLACE OFE END 8 3 2 Automatic Image Type Switch It is often desirable to adapt the imagetype of the map to the represented data Typically vector data is well rendered in png while the colors of a raster background require either jpeg or png24 format CartoWeb includes a mechanism that automatically switches the format when specific layers are selected A special metadata of the layers triggers this behavior METADATA force_imagetype jpeglpng END This metadata overrides the general fileformat of the mainmap but not of the legend icons these stay in the initial fileformat 60 Queries 9 Queries Core plugin Query allows to search for geographical objects Found objects are hilighted and if requested related data are returned to client Depending on configuration and user choices queries are executed on one layer several layers or all layers currently displayed on map Queries can be executed on a rectangle selection or using a list of object IDs This second way to execute a query is used in particular to maintain selection persistence object IDs are stored client side and sent to server each time the page is reloaded Hilighting o
104. ee 10 3 4 Modularity Projects and Plugins eeeseeseeeeseeeeeeeeseseresersreserssee 12 JA LS PIUSINS neeem E E E es 12 3 4 2 Projects in ina a e aa E ARRS 13 S255 Templates Segore er ee a e a r EE o ue EES Oras 14 3 6 Users and Roles aigiiivotatects ent EE TE 14 3 7 Performance Enhancement s cssa fascia tanccesr Mona senbese eaciaceaatoniads 14 Th User Manual 3hcnussitvenaidas andi a a E A E NLS 15 le Installatioi eiua a a aaa ionet a tuts a a aS 16 1 1 CartoWeb Installation 20 scc tsssiesntetiauidecnsieitbasareatetewentiaessa 16 1 1 1 Prerequisite for Installing CartoWeb ssec 16 1 1 2 CartoWeb Download sccc ci sccccesieeiciestsetieccastescceadadacedes 17 1 1 3 UNITX like Installation c esscscrascessioiaairtecasdeoualeciats 18 1 1 4 Windows Installation ccc eccccccecesssceeeeeenteeeenssteeeens 21 t2 ems Installation oces rinii inaa a a 24 12 1 Introductio nergsesinronpsodsiai uni alanine 24 1 2 2 istallato ii seii a a iia 24 1 2 3 Routing specific installation esseeeeseeeeeeeeeeeeresreeseeresee 26 1 2 4 Extensions Description sssessesssesssesessseessressersseesseeesseee 27 PESADA CLE Y a AE elect E EESE FE EEE 31 CartoWeb Documentation a SAN ORIG E ON Sack e a teak a URE ee ae 31 2 2 Global Directory Structure iicseccisscsse sd desecedisentedenaesdantasvanccedesedea 31 2 3 PAUBITISY c regasesc tay buassayegieoechouigen a eaa ao ea ESES AORE 32 DAs Projects sieis eaa aa aE A aa E
105. eendiessahsueansesdguadayrebaceateesesacsnness 180 7 1 Generating Documentation cceeeeeceeceeceeeeeeeeeeeceteeeeeteeeees 180 T2 Doc BlockS eds ons cass pacatiaws tanks EA EN a a eai 180 L2AeDoCBlOcks Types 118s Gunn iassdaadiiandenis 180 1 22 DOeBlOcks COMMS cestiti eite sorire ges ata 180 T23 Example seier arrea A EERTE E 181 8 Logging and Debugging sessssssesssessssssssssesesseresseessressereseeeseeessseesseese 184 8 1 Introductio neri innnan a aa a a a anaa 184 CartoWeb Documentation AAD DG BIND tom E E Sah aa Rai E A diilucs 184 8 2 1 Log4php Configuration Files 20 0 0 ceeceeeeeeeeeeeeeseeeeeees 184 8 2 2 Default Log File Location cscisccssscseessaceentecessssabedecavseces 185 8 2 3 Using Log4php in Source Files cee eeeeeeeeeeeeeeeeeeeees 185 8 3 Deb gdih t ses cates case Pisrons tay hahaa a a a i 185 8 3 1 Understanding Exceptions and Stack Traces 186 8 3 2 Using Direct for More Verbosity 0 ceeeeeeeseeeeteeeeeeee 186 9 Performance Pests c c2c0sa ceil eek scclae ieee tere waren edness 188 DCL SIMiaim Patanie ters i2ccciess estos pepe ana niet sh net ai 188 92 Executing Tests sieke R ER aes 188 9 2 1 APD Module Installation 20 0 0 eeeeeeeceeeseeeeeteeeeeeeees 188 9 2 2 Simple Execution Times 254 cssccevsseceesseassaceesdeencenssces 189 9 2 3 Graphical Interface Unix like eee eeeeeeereeeneeeee 190 10 Upgrading Views Data c iiicicesidiveiseaitas
106. efaultFormat are used to preselect options in the matching dropdowns If for some reason the system failed to determine what resolution and format the user desires it will use those default values Specify the default orientation to select in user interface as well You don t need to set a list of available orientations since it is already fixed to portrait landscape The activatedBlocks parameter lists the blocks that may be drawn in the document It does not mean that they will For instance the title block will not appear if no title 79 PDF Export input has been submitted by the user Choose the PDF generator you want to use For now only FPDF is fully available PDF Lib is only partially implemented and should not be used Set the output parameter in order to choose how the generated file will be served download box link inline The distUnit parameter is very important since it sets the unit used to measure the length specified in every blocks However it does not affect font sizes that are always indicated in points pt horizontalMarginand verticalMargin indicate how much space will be kept blank around each page No block will be printed below these distances from the sheets borders Note that these values can be overriden in the formats description For instance general settings general formats A4 A3 general defaultFormat A4 general resolutions 96 150 300 general defaultResolution 96 general ov
107. efines the RGB color of the mask This color is used to fill the polygons outside s area Drawn polys will appear as holes in a colored sheet showing the map under This parameter is optional and set by default to 255 255 255 white e areaFactor defines an optional value for ratio by which the area is multiplied before it is returned to the client For example people can use it to convert square meters to square kilometers 10 3 Related Elements in Mapfile 10 3 1 Layers Specific layers must be set in the mapfile in order to draw the shapes LAYER NAME cartoweb_point_outline ANGE 1 JEXCVEN IL END LAYER NAME cartoweb_line_outline TYPE LINE END LAYER NAME cartoweb_polygon_outline TYPE POLYGON END The point layer is optional as it can be replaced by polygon layer when missing Don t forget that layers names must be set in the server side outline ini file See Section 10 2 1 outline ini 10 3 2 Labels In case of using labels i e labelMode set to true see Section 10 1 1 outline ini a LABEL object is needed in the layers class 68 Annotation and Redlining Example LAYER NAME cartoweb_point_outline TYRE JPOLNI CLASS STYLE END LABEL FONT Vera TYPE truetype COLORS 5 lees amos STEZE LO END END END You will find more examples looking in the test map file in server_conf directory Export Plugins 11 Export Plugins 11 1 Introduction It is possible to e
108. ement of the user password roles database Securit yContainer class in common SecurityManager php e Management of user authentication calling checkUser and setUser setUserAndRoles in SecurityManager e Granting access to objects based on the current roles 3 2 Plugins Managing Security Database and Authentication Point 1 and 2 in the previous section are the responsibility of specific plugins For an example see the auth plugin 3 3 Plugins Granting or Denying Access to Objects Features in CartoWeb This point is the most important for plugin developers wanting to use the CartoWeb security mechanisms to allow or deny an access to a feature object The plugin can call the method hasRole roles on the current security manager For an example let s take the pdf plugin which has to restrict printing some formats only to allowed users in the ini file we could have formats A4 allowedRoles printers admin In the plugin we can then check the permissions with in the routine building the available format list 162 Using the Security Infrastructure foreach formats as format add the format to the list Sroles this gt getRolesForFormat format this should get it from the ini if SecurityManager getInstance gt hasRole S roles continue skips unauthorized resolution for this user do the work with the format in the routine handling the user passed parameters to the s
109. ent php and or the ServerContext getCorePluginNames one in server ServerContext php For instance private function getCorePluginNames return array images location layers query mapquery tables yourPluginName To load a regular plugin update the 1oadPlugins parameter from client_conf client ini and or server_conf lt mapId gt lt mapId gt ini as in following example loadPlugins auth outline exportHtml 2 2 3 How Plugins Are Called As explained in Section 2 1 What are Plugins plugins are independent aggregations of PHP code that are called by the CartoWeb core classes to perform dedicated actions Plugins are called several times during the program execution entry points Thus they can interact at various level of the application To determine what plugins must be called at what moment and to perform what action plugins must implement one or more of the CartoWeb plugin interfaces according to the object oriented programing meaning The interfaces define methods that will be triggered by the main program during its execution For example you can take a look at the following simplified cartoclient doMain method main program defined in client Cartoclient php private function doMain Sthis gt callPluginsImplementing InitUser handleInit Sthis gt getMapInfo if Sthis gt isRequestPost 143 New Plugins Sthis gt cartoForm Sthi
110. ents e getIndex returns the current auto layer index It can be useful for instance in conditional statements Must be used in auto layer contents e includeFile path adds the content of another PHP mapfile template Here is an example MAP NAME MyMapfile CAINE 10 iLO iO i lt php printLayer myAutoLayer_ lt lt lt AUTOLAYER This is my auto layer with index lt php printIndex gt LAYER NAME lt php printName gt TYPE POLYGON CLASS NAME MyClass STYLE COLOR lt php if getIndex index2 print 200 200 255 Gules josie WA aks OW AWe is END END END AUTOLAYER gS END 6 5 3 Batch Script Script makemaps php located in directory scripts generates mapfiles out of mapfile templates for all projects Mapfiles are generated in the same directory The script must be called once during installation and then each time a change is made to the mapfile templates It uses filelayers ini to find out which auto layers are needed For instance with the following layers ini myAutoLayer_index3 won t be generated autoLayersIndexes indexl index2 index3 layers layerl className LayerGroup layers layerl children layer2 myAutoLayer_index1l layers layer2 className LayerGroup layers layer2 children myAutoLayer_index2 54 Layers At least one file is generated Its name is auto mapId all map and it contains all auto layers used in file layers ini When children
111. er ieena p E E E aN A Ea iiaa 53 6 5 1 Auto Layers in layers ini eessseesseesseesseeesseessseessresseessee 53 6 5 2 Mapfile Templates idsaigunainddniwdaadicn auiiiain 53 6 9 3 Batch SCH Pt os orte e eeren o e e E ai 54 6 6 Layer Reorder Plugin ssessssssesssesessseesseesseesseesseresseeesseessresseessee 55 6 0 1 Pl gin activation bereon onii e E E R 55 6 6 2 Layer GxClusiOn sissu pnn am nnn a anas 56 6 6 3 Transparency selector seeseesseeesseessessseeesseessseessresseessee 56 Ta NAVISAUIONE sesoses ran e a E E aa ia 57 7 1 Client side Configuration ss ssssesesssesssseessseessresseesseeeseeessseesseese 57 7 2 Server side Configuration ssesesesssesesseessseesseesseesseeesereessesseese 58 7 3 Related Elements Elsewhere seseeseeeeseseseeressesereererserererreesesee 58 8 Image Format Options ssessssssessssssesssesesseesseresseesseesseeesseessseessresseessee 59 8 1 Client side Configuration s sseessssesessseesseeessseessresseesseesseeesseee 59 8 2 Server side Configuration sssessssesssssessseeessseessresseesseesseresseee 59 8 3 Related Elements in Mapfile siccisscccsscaseveccevayidogssshecnsteesocaveonscodes 59 8 3 1 General Image Type ssssssssssessssssesssesessseesseesseesseesseresseee 59 8 3 2 Automatic Image Type Switch sessssesesssessesssessseesseee 60 ON QUenes aana a sis Rohs Mas aS ee 61 9 1 Client side Configuration c 12s4s6sesseesveesdeseties d
112. erForm Smarty Stemplate a Simage2 Smarty var must have been added in cartoclient tpl Stemplate gt assign image2 Sthis gt drawNewImagesField parent renderForm Stemplate additional method private function drawNewlImagesField Ssmarty new Smarty_Plugin S this gt getCartoclient this Ssmarty gt assign imagesTest Foobar return S smarty gt fetch yourImages tpl 2 gt Don t forget to activate the extended plugin in projects yourProject 150 New Plugins client_conf client ini loadPlugins yourProjectImages 2 4 Special Plugins 2 4 1 Export Plugins Export plugins allow to export maps and data Concepts described below provide tools to help writing such plugins In brief export plugins follow these steps in order to generate an output e Retrieve last request that was sent to server e Call all plugins to ask for request modification eg map resolution changes keymap generation enabled disabled etc e Call server to get a new modified result e Use the result to generate output e Return output in a standardized form 2 4 1 1 Export Plugin Naming Convention Warning Export plugins MUST have names that begin with the string export for instance exportPdf exportCsv Or exportHtml When extending export plugins same rule must apply For instance exportExtendedPdf 2 4 1 2 ExportPlugin Class ExportPlugin implements a special type of c
113. erviewScaleFactor 10 general defaultOrientation portrait general activatedBlocks mainmap title note scalebar overview copyright queryResult page legend logo scaleval tlcoords brcoords general pdfEngine CwFpdf general pdfVersion 1 3 general output inline general filename map date dMY Hi pdf general distUnit mm general horizontalMargin 10 general verticalMargin 10 general importRemotePng false Some overview map settings are available as well The overviewScaleFactor indicates how wide the overview will be compared to the mainmap actual extent overviewColor and overviewOut lineColor respectively set the inner and border colors of the mainmap outline in the overview map Note that the out line plugin must be activated ie added in the client ini loadPlugins parameter for those settings to be taken into account Tip To use the classical MapServer keymap in place of the overview set the overview block content parameter to static see Section 12 3 3 Blocks Configuration as follows blocks overview content static PDF Export In that case parameters overviewScaleFactor overviewColor overviewOut lineColor are ignored 12 3 2 2 formats Formats objects describe the PDF pages sizes bigDimension smallDimension One can describe as many formats as desired Moreover there is no theoritical page size limit except that the bigger the maps the longer the
114. es o mapinfo_cache Client side server configuration cache see Section 5 6 Caches Configuration o mapresult_cache Client requests and associated server results cache see Section 5 6 Caches Configuration o pdf Pdf generated cache files o soapxml_cache Client SOAP XML requests and associated server results cache see Section 5 6 Caches Configuration o wsdl_cache Client side WSDL cache see Section 5 6 Caches Configuration 2 3 Plugins Modularity is a key feature of CartoWeb Its functionalities are packaged in logical sets called plugins that aim to be independent from each other although some dependencies cannot be totally avoided Some plugins core plugins cannot be disabled while the other ones must be explicitly loaded in the server and or client configuration files 32 Structure Nearly all plugins have configuration options set in ini files The full description of these options makes the bulk of this user manual Modifying existing plugins or writing new ones requires some acquaintance with PHPS5 as it involves some coding The related documentation is thus reported to the developer s part of this manual see Section 2 1 What are Plugins but that shouldn t deter anybody from experimenting with it Each plugin directory contains one or more subdirectories Here are all the possible subdirectories e client Client side plugin code e common Client and server co
115. f my_mapfile To point to the new mapfile change the maplId value in projects my_project client_conf client ini You can add project specific plugins in directory projects my_project plugins To load the new plugin add its name in client ini and or my_mapfile ini loadPlugins variable 3 2 Using Projects There are several ways to tell CartoWeb what project to use 3 2 1 Apache Environment Variable Set environment variable CW3_PROJECT in Apache configuration lt Directory your cartoclient path gt Options FollowSymLinks Action php script egqi bin phys AddHandler php script php E Pare SetEnv CW3_PROJECT your_project_name lt Directory gt Warning You will need Apache s Env module to use SetEnv command To load this module add the following line to your Apache configuration LoadModule env_module usr lib apache 1 3 mod_env so 3 2 2 Using current_project txt Add a file named current_project txt in CartoWeb root directory This file must contain a single line with project name 3 2 3 Using a GET Parameter You can pass a GET parameter project YOUR_PROJECT to the client php script for instance http path to cartoweb client php project myProject 3 2 4 Using the Projects Drop down List Have a look at the configuration of client ini described in Section 4 2 client ini in particular directives showProjectChooser and availableProjects to display the project selection drop down menu 35
116. files and projects you wish to keep Note See note on Section 1 1 3 2 6 1 Install Notice here the delete existing parameter Needed here because cart oweb3 already exists Without it the cw3setup script issues a warning and stops 1 1 3 2 7 Update CartoWeb from CVS To keep your CartoWeb up to date with the development version simply type the following command in the cart owWeb root folder cvs d pserver anonymous dev camptocamp com var lib cvs public update Warning This may have some serious effects on your existing developments it is recommended you backup the CartoWeb root folder and all subforders before execution 1 1 4 Windows Installation 1 1 4 1 Windows Install with Win32 Installer Recommended e Download the WAMP installer at http www wampserver com Double click on the executable to launch it This will install Apache with PHPS e Download the CartoWeb installer at http cartoweb org downloads html Double click on the executable to launch it This will install MapServer and CartoWeb e That s it Point your browser to http localhost cartoweb3 htdocs client php Once it is installed you can modify CartoWeb setup with the command line script cw3setup php Section 1 1 3 UNIX like Installation from either a DOS or a Cygwin prompt See Section 1 1 4 3 CartoWeb Setup for more info about how to use those interfaces 1 1 4 2 Windows Manual Install 21 Installatio
117. generated for all projects 15 1 3 Translating As for any gettext system translating PO files can be done in Emacs in Poedit http poedit sourceforge net or in any text editor Translated PO files must be saved under name lt template_name gt lt lang gt po where lt lang gt is the 2 letters ISO language en fr de etc For instance the mapfile test of test_main project will have three PO files in its PO directory for a complete french translation e server fr po e server test fr po e client fr po 15 1 4 Compiling PO to MO To compile all PO files to MO files gettext s binary format use the following commands on client side This should be done each time configuration client or server is updated and after each system update All languages are compiled at the same time cd lt cartoweb_home gt scripts php po2mo php Warning When CartoWeb is installed in SOAP mode the script uses PHP curl functions to retrieve PO files from server to client PHP curl module must be installed 15 1 5 Example To translate texts in french for project test_project and map file projectmap follow these steps e On server cd lt cartoweb_home gt scripts php server2pot php 101 Internationalization Copy lt cartoweb_home gt projects test_project po server po to lt cartoweb_home gt projects test_project po server fr po and lt cartoweb_home gt projects test_project po server projectmap po to lt cartoweb_home
118. ger gt tables WA woe Now you are ready to add rules Next sections describe the different types of rules Registry s method signature is explained for each type Once rules have been added in registry they must be executed on tables See Section 2 4 3 4 Executing Rules for a description of table rules execution 2 4 3 2 1 Column Selector public function addColumnSelector S groupiId S tableId columnIds Column selector rules allow to keep only a subset of columns from the source table Parameter columnIds should contain an array of column IDs determining which columns to keep 2 4 3 2 2 Column Unselector public function addColumnUnselector SgroupiId StableId columnIds Column unselector rules allow to keep only a subset of columns from the source table by removing a list of columns Parameter columnIds should contain an array of column IDs determining which columns to remove 2 4 3 2 3 Group Filter public function addGroupFilter S groupId callback Group filter rules allow to modify group title Parameter ca1iback should contain a pointer to a callback method with the following signature static function myCallbackMethod group_id group_title return group_new_title 2 4 3 2 4 Table Filter public function addTableFilter S groupId S tableId callback 156 New Plugins Table filter rules allow to modify table title Parameter caliback should contain a pointer to a callback me
119. gh resolution aerial views may only be visible within an organization while external users should be content with satellite photographs A basic file based authentication mechanism is included but any other mechanism that is able to authenticate an user and to link him to a role could be used as well 2 10 PDF Output and Other Export Formats CartoWeb is able to output a fully configurable PDF document Some options can be chosen by the end user in the following dialog while the CartoWeb admin defines which elements maps legends tables additional logos or watermarks are to be printed and sets their positions within the page Cartographic Functionalities Themes Pririt Search Format and Resolution dpi Orientation g Portrait C Landscape Title Hote Options lw Scalebar E Oye rrien E Quen Results J Legend C On map C In new page a Mone Frim Other output formats include the graphic formats jpeg png of the map itself simplified html templates and comma separated values tables of the query results Architecture 3 Architecture 3 1 Introduction CartoWeb uses an innovative design and state of the art technologies The following sections briefly review the main employed approaches 3 2 MapServer MapScript CartoWeb is based on the UMN MapServer http mapserver gis umn edu engine Interactions between CartoWeb and MapServer are achieved using the
120. gs This is wrong lt BODY gt lt P gt This is a paragraph lt P gt lt BODY gt This is correct 171 Code Convention lt body gt lt p gt This is a paragraph lt p gt lt body gt This is wrong lt table WIDTH 100 gt This is correct lt table width 100 gt 5 4 3 Closing 5 4 3 1 All Elements Non empty elements must have an end tag This is wrong lt p gt This is a paragraph lt p gt This is another paragraph This is correct lt p gt This is a paragraph lt p gt lt p gt This is another paragraph lt p gt 5 4 3 2 Empty Elements Empty elements must either have an end tag or the start tag must end with gt This is wrong This is a break lt br gt Here comes a horizontal rule lt hr gt Here s an image lt img src happy gif alt Happy face gt This is correct This is a break lt br gt Here comes a horizontal rule lt hr gt Here s an image lt img src happy gif alt Happy face gt IMPORTANT Compatibility Note To make your XHTML compatible with older browsers you should add an extra space before the symbol like this lt br gt and this lt hr gt 5 4 4 Minimization 172 Code Convention This is wrong lt dl compact gt lt input checked gt lt input readonly gt lt input disabled gt lt option selected gt lt frame noresize gt This is correct lt dl compact compact gt lt input checked checked gt lt in
121. he roads_europe table SELECT gid source_id target_id edge_id AStext the_geom FROM roads_europe limit 3 gid source_id target_id edge_id AStext 4 4 4 4 5 5 5 5 5 5 Leis LAOS il ILOSS 14 MULTILINESTRING 1062096 06 4861316 234 2869 LOSE LOSE 2ST MIGAG WIE IOMPASIWRIONE ZS0CS1 397 ATTLEE 937 065 12868 10918 ICIL 200 MCW ICI ICN PASALRUEIMEN ADOC 97 AVTIIIS DSi 7 9 6 3 3 lignes But if the data quality is poor you need to delete the duplicates edges they have the same source target pairs of vertices For example to check that you have duplicated edges you can type S SELECT FROM SELECT source 10 Larger id count AS PROM roadl group by source_id target_id order by c AS foo where foo c 2 If there is duplicated edges to delete one of two rows you can type CREATE TABLE roads_europe_tmp AS SELECT FROM roads_europe WHERE gid in SELECT gid FROM SELECT DISTINCT on source_id target_id source_id gid FROM roads_europe AS doublon DELETE FROM roads_europe S INSERT INTO roads_europe SELECT FROM roads_europe_tmp ALTER TABLE roads_europe ADD COLUMN edge_id int The following step is to create and fill the edges and vertices tables of the resulting 28 Installation graph To do so you can use create_graph_tables function S SELECT create_graph_tables roads_europe i
122. home gt documentation user_manual source like that ln s CARTOWEB_HOME documentation user_manual source C 1 4 XHTML Generation Then to generate an XHTML version of the documentation execute as follow configure make xhtml Output result will be generated in xhtm1 directory C 1 5 PDF Generation To generate a pdf version of the documentation execute instead configure make pdf Resulting pdf will be generated in book pdf file Note You need to have at least a JRE or JDK installed on your system in order to generate PDF The environment variable JAVA_HOME must also be rightly set e g export JAVA_HOME dir_path_where_jre_is_put_on_your_system C 2 Documentation Generation on Windows using Cygwin At this time the only known way to generate xhml or pdf version of the documentation on Windows is by using Cygwin You will need to install the following Cygwin packages libxml2 libxslt make Then follow the same instructions as for UNIX like system Section C 1 Documentation Generation on UNIX like System 199 Index Index A all 95 anonymous 96 applySecurity 97 areaFactor 68 authActive 95 autoClassLegend 52 B bbox initial 58 block positioning PDF 82 Blocks configuration PDF 75 81 bottomLayers 56 C charsetUtf8 CSV 71 Colors PDF 78 Column reorder 159 Coreplugins 141 crosshairSymbol 57 crosshairSymbolColor 57 crosshair
123. iable Typical usage of this feature is to render for instance several HTML links for each layers 6 4 Layers Legends CartoWeb includes a mechanism for the automatic generation of legends If desired an icon is drawn for each class of the layers There are two conditions that must be fulfilled to make it work 1 The mechanism must be enabled by setting autoClassLegend true in layers ini 2 Each class or more precisely each class that should appear in the legend must have a name Here an example LAYER NAME spur_spurweite METADATA END TYPE line CLASS NAME Normalspur 1435 mm EXPRESSION MM 1435 STYLE COLOR 0 0 255 blue END END CLASS NAME Meterspur 1000 mm EXPRESSION MM 1000 STYLE COLOR 255 0 0 red END END CLASS NAME Schmalspur lt 900 mm EXPRESSION MM lt 900 STYLE COCOR 9 A02 o EAn END END END In this case the second class would not appear in the legend because the NAME is 32 Layers commented out Provided that no static icon is defined for a layer in layers ini the icon of the first visible class is used for the layer 6 5 Auto Layers In some cases it may be useful to generate several layers out of a single template layer An example would be floors each floor must be displayed with the same color etc but the data source is different different shapefile or different where clause for a database layer In CartoWeb it is possible to
124. iable in file client_conf client ini 2 4 2 1 Interface and Classes Interface FilterProvider declares following methods e filterPostRequest FilterRequestModifier request modifies parameters transfered via a POST request e filterGetRequest FilterRequestModifier request modifies parameters fiis transfered via a GET request Class FilterRequestModifier is used to get old values from the request and set new ones It implements two main methods e getValue key retrieves old value e setValue key value sets new value 2 4 2 2 Available Parameters This is the list of parameters that can be set in a filter plugin using function setValue e Images plugin o mapsize ID of the selected map size see Section 8 1 Client side Configuration e Location plugin 153 New Plugins o recenter_bbox new bounding box comma separated coordinates eg 10 5 20 15 5 28 o recenter_x re centering new x coordinate o recenter_y re centering new y coordinate o show_crosshair O or l default 0 If 1 display a crosshair on recenter_x recenter_y o recenter_scale new scale o id recenter layer re centering on objects layer to look for IDs o id recenter ids re centering on objects list of IDs comma separated o shortcut_id ID of the selected map size see Section 7 2 Server side Configuration e Query plugin o query_layer layer to look for IDs o query_select IDs of objects
125. ic to Location plugin ie fixed scales scales limits and shortcuts lt complexType name LocationScale gt lt all gt lt element name label type xsd string gt lt element name value type xsd double gt lt all gt lt complexType gt e Jabel scale caption e value scale value to be set when scale is selected lt complexType name ArrayOfLocationScale gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types LocationScale gt lt restriction gt lt complexContent gt lt complexType gt e array list of scales lt complexType name LocationShortcut gt sarl lt element name label type xsd string gt lt element name bbox type types Bbox gt lt all gt lt complexType gt e label shortcut caption e bbox bounding box to recenter on when shortcut is selected 117 Calling Plugins lt complexType name ArrayOfLocationShortcut gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types LocationShortcut gt lt restriction gt lt complexContent gt lt complexType gt e array list of shortcuts lt complexType name LocationInit gt lt ai gt lt element name className type xsd string gt lt element name scales type types ArrayOfLocationScale gt lt element name minScale type xsd double gt lt element name
126. icitely in the main plugin PHP files Templates stored in the plugin templates directory are also accessible directly by using PHP code similar to the followin one Ssmarty new Smarty_Plugin S this gt getCartoclient S this Ssmarty gt assign foo bar return Ssmarty gt fetch yourPlugin tpl 2 3 Adapting a Plugin 2 3 1 Approaches If an already available plugin or coreplugin offers close functionalities to the ones you need if you wish to slightly modify its behavior or simply want to adapt its output to your website layout it is far easier to adapt it then to build a new one from scratch There are two levels of plugin adaptation You can e override its HTML templates resources pictos CSS or JS files and its configuration as well This approach is generally sufficient when you only need to 146 New Plugins adapt the layout e extend the main PHP classes to add your own methods or overload existing ones This approach is required when you need to add some PHP code to the plugin Both approaches are not incompatible and may be combined to obtain desired result See Section 2 3 4 Combining Both Approaches for more explanations 2 3 2 Overriding a Plugin Overriding a plugin is the simplest way to adapt it to your needs It is done by duplicating the plugin files at least the ones you want to adapt in your project frame For more information about projects handling see Section 2 4 Pr
127. ies to store all plugin related resources files and templates Create client server common if your plugin as CartoClient CartoServer and respectively common parts Create your main PHP classes files Those files must be named using the first letter capitalized name of your plugin prefixing it with Client or Server for client or server components eg Client YourPlugin php 145 New Plugins ServerYourPlugin php YourPlugin php 6 Extend clientPlugin and or ServerPlugin CartoWeb classes in the matching above files and name the result classes using their files names with no php For instance lt php X version Id ServerYourPlugin php v 1 8 2005 02 23 11 52 43 johndoe Exp R class ServerYourPlugin extends ServerPlugin 7 Make your classes implement needed interfaces and redefine corresponding methods Note that the common part class YourPlugin does not have to extend or implement any CartoWeb class or interface It is used as a container for common data and treatment used by client and server classes 8 Activate your plugin by adding its name to the loadPlugins of the matching project configuration files 2 2 5 Automatic Files Inclusion Main plugin PHP files eg client YourPlugin php ServerYourPlugin php YourPlugin php are automatically included and their contained classes and objects are directly accessible Other files in client server or common are not and must be included expl
128. iguration directories client_conf and or server_conf lt mapId gt When the plugin is launched upstream and project configuration files are merged so you don t need to duplicate the configuration parameters that stay unchanged with your adapted plugin 2 3 3 Extending a Plugin Extending a plugin is required when your adaptations involve deep changes such as additions or overloadings of methods in the plugin PHP classes 147 New Plugins To do so you will have to extend the plugin PHP classes in the object oriented programing definition Since plugin main classes are named using a plugin name based convention eg ClientLayers and ServerLayers for the CartoClient and CartoServer main classes of the layers coreplugin and since extended classes cannot have the same name than their parent class you will have to rename your plugin Any plugin name is OK as long as it is not already used but it is recommended to use a lt projectName gt lt initialPluginName gt separating words with caps Extended coreplugins directories and files must be saved in projects lt projectName gt coreplugins lt extendedPluginName gt whereas extended simple plugins ones will be located in projects lt projectName gt plugins lt extendedPluginName gt When writing your extended class the first thing to do is to specify what plugin is replaced by the new one This is done by overloading the replacePlugin method It should return the repl
129. iles o js javascript files e include libraries used by CartoWeb e locale locale files for internationalization purposes see Chapter 15 Internationalization e log logs mainly used for development and debug purposes e plugins Standard but not mandatory plugins see Section 2 3 Plugins o auth authentification plugin see Chapter 14 Security Configuration 31 Structure o exportCsv Csv export plugin see Section 11 3 CSV Export o exportHtml HTML export plugin see Section 11 2 HTML Export o exportPdf PDF export plugin see Chapter 12 PDF Export o hello test plugin o hilight hilight plugin see Section 9 3 2 Hilight Configuration o outline redlining and annotations see Chapter 10 Annotation and Redlining po PO templates files used for gettext translation system see Section 15 1 2 PO Templates projects CartoWeb user projects dir see Section 2 4 Projects scripts maintenance and administration scripts server CartoWeb server code files server_conf Cartoweb server side configuration files see Section 4 3 Server Configuration Files templates CartoWeb Smarty templates files see Chapter 16 Templating templates_c smarty templates cached files tests CartoWeb unit tests suite mainly used for development and debug purposes www data writable and web accessible directories for generated files o icons Generated icons o images Mapserver imag
130. imension pixel and geographical dimension information for key map e initialMapStates list of initial states 1 2 2 Layers This includes configuration specific to Layers plugin ie list of all available layers and their properties lt complexType name ArrayOfLayerId gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType xsd string gt lt restriction gt lt complexContent gt lt complexType gt 114 Calling Plugins e array list of layer IDs lt complexType name ChildrenSwitch gt lt all gt lt element name id type xsd string gt lt element name layers type types ArrayOfLayerId minOccurs 0 gt lt ul gt lt complexType gt e id switch ID e layers list of layers lt complexType name ArrayOfChildrenSwitch gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType ChildrenSwitch gt lt restriction gt lt complexContent gt lt complexType gt e array list of children switches lt complexType name Layer gt lt all gt lt element name className type xsd string gt lt element name id type xsd string gt lt element name label type xsd string gt lt element name children type types ArrayOfChildrenSwitch minOccurs 0 gt lt element name minScale type xsd double gt lt element name maxScale type xsd double
131. in the client_conf and or server_conf lt mapId gt depending if those plugins have CartoClient CartoServer components 2 1 3 Plugins Structure 141 New Plugins Plugins and coreplugins have the following general structure lt pluginName gt lt pluginName gt client lt pluginName gt server lt pluginName gt common lt pluginName gt templates lt pluginName gt htdocs lt pluginName gt htdocs gfx lt pluginName gt htdocs js lt pluginName gt htdocs css e client contains all specific CartoClient side PHP files e server contains all specific CartoServer side PHP files e common contains PHP files shared by both CartoClient and CartoServer sides or at least files that are not specific to one side or the other e templates contains all the plugin specific Smarty templates Since HTML templates are only used in CartoClient files from templates are only called by client code e htdocs contains all files PHP pages images JavaScript or CSS files etc that may be web accessed when running the plugin Those files are dispatched in various directories depending on their nature If necessary you can create additional subdirectories For instance java if your plugin uses a Java applet To preserve the plugin independence it is strongly recommended not to add your CSS styles in the general CartoClient style sheet but to create a specific file here that will be called separately Note that it is not requ
132. ingTable option e the routing layer in the mapfile postgresRoutingResultsLayer option e the results routing table postgresRoutingResultsTable e the connexion string to the database dsn option 30 Structure 2 Structure 2 1 Introduction This chapter is an overall tour of the CartoWeb code structure It briefly explains the role of each directory When available links to relevant chapters of this documentation are also provided 2 2 Global Directory Structure After installation CartoWeb has the following directory structure e Q lient Client specific code files e client_conf Client configuration files see Chapter 4 Configuration Files e common Common client and server code files e coreplugins Basic mandatory plugins o images Image generation see Chapter 8 Image Format Options o layers Layers management see Chapter 6 Layers o location Navigation see Chapter 7 Navigation o mapquery Perform queries based on a set of selected id s see Section 9 2 2 MapServer Query Configuration o query Perform queries on layers see Chapter 9 Queries o statictools Distance and surface calculation o tables Table rules management see Section 9 1 2 Tables Configuration e documentation documentation o apidoc PHP source code documentation o user_manual source DocBook XML source of the present documentation e htdocs Web accessible directory o css css files o gfx icons f
133. ired to actually create the whole structure described above Only directories that contain files are necessairy For instance if a plugin only perform CartoServer actions it is no use to create client templates and htdocs directories common may be usefull if not CartoServer specific classes have to be defined There are two ways to add a plugin coreplugin to CartoWeb writing a brand new one or overriding extending an existing one 2 2 Writing a Plugin 2 2 1 Introduction If no existing plugin or coreplugin fulfils your requirements and if none offers close enough functionalities to justify an adaptation you can write a new plugin Plugins main classes client and or server if any must extend CartoWeb definedclientPlugin and or ServerPlugin classes which provide base plugin tools 142 New Plugins For instance class ClientYourPlugin extends ClientPlugin here comes your plugin client class definition 2 2 2 Plugin or Coreplugin First of all you have to determine if you are about to design a simple plugin or a coreplugin To be a coreplugin your plugin must be really generic and present a great interest to the CartoWeb users community since it might be included in the upstream distribution Contact CartoWeb development team for more info In most cases it is better and sufficient to create a simple plugin To activate a coreplugin update the cartoclient getCorePluginNames method in client Cartocli
134. ke environments file etc locale alias contains aliases to installed locales For each language used a line must be present in this file The alias fr in the example below must point to a locale installed on the system fr Jee IClsl lt WSKOH i 5S il You will need to run locale gen after editing etc locale alias to regenerate system s locales To install a locale on a Debian installation use following command with root priviledges dpkg reconfigure locales If package locales has never been installed you have to install it before apt get install locales Two scripts have been prepared to check if gettext is correctly installed on the system e script testgettext sh This will compile and run a small C program that will test xgettext and msgfmt e script testgettext php Given that gettext was correctly installed on the 99 Internationalization system this will test that gettext works in PHP Note These scripts need that locales have been correctly configured They were tested on GNU Linux with a Debian Sarge install 15 1 1 2 Win32 In order to have the language translation working correctly in Cartoweb with Gettext you need to have the languages you want to use installed in the Input Locales of Windows windows 2000 Control Panel gt Regional Options gt Input Locales windows XP Control Panel gt Regional and Language Options gt Details gt Settings 15 1 2 PO Templates Texts t
135. le of Initial MapState mapInfo initialMapStates default layers polygon selected true mapInfo initialMapStates default layers point hidden true mapInfo initialMapStates map25 layers polygon selected mapInfo initialMapStates map25 layers polygon unfolded ces TEUS 4 4 Ini Files for Plugins Each plugin may have a configuration file associated with it It is located in the same directory as the myMap map and myMap ini They have the same name as the plugin and ends with ini extension For instance the layers plugin has a configuration file named layers ini All plugins configuration files are described in the next sections of this chapter Every plugin that provides tools icons can be configured for 4 4 1 Ordering Tools Icons To modify the toolbar icons sequence update the tools weight values Icons with the lowest weights are placed first in the toolbar Parameters naming convention is to concatenate the weight prefix to the capitalized first lettered tool name as in weightDistance For two words tool names eg zoom_in each word has its first letter capitalized and the _ underscore is removed For instance weightZoomIn 10 Default weights value are 41 Configuration Files e weightZoomIn 10 e weightZoomOut 11 e weightPan 12 e weightQuery 40 e weightOutlinePoint 70 e weightOutlineLine 71 e weightOutlineRectangle 72 e weightOutlinePoly 73 e weightDistance 80 e weightSurface
136. licking directional arrows Default is 1 no overlap no gap Values below 1 result in an overlap of the old and the new maps values above in a gap between these two maps e weightZoomIn integer defining display order of the zoom_in tool icon in toolbar if not specified default to 10 A negative weight disables the tool e weightZoomOut see weightZoomIn default to 11 e weightPan see weightZoomlIn default to 12 e crosshairSymbol integer numerical id of symbol to use to materialize recentering point see your symbolset file e crosshairSymbolSize integer defining the size used to display the recentering crosshair symbol e crosshairSymbolColor RGB code comma separated list of integers of the 57 Navigation crosshair color 7 2 Server side Configuration Here are the options that can be set e minScale if set minimal scale allowed e maxScale if set maximal scale allowed e scaleModeDiscrete boolean if true only specified scales see below can be set e zoomFactor the zoom factor to use whan scaleModeDiscrete is set to false e scales value 0 1 2 available value of the scale in discrete mode e scales label 0 1 2 label of the scale to be displayed in the dropdown list on the client e scales visible 0 1 2 boolean if true the scale is displayed in the dropdown list If false this scale can only be selected by zoom in zoom out Default is true
137. lient plugin with some specific functionnalities for export It implements interface GuiProvider so child classes must implement corresponding methods Class methods are e getLastMapRequest returns last used request object This is useful to prepare a new call to server in order to obtain data specific to export This call is done in method getExportResult e getLastMapResult This can also be useful in some cases to have the last returned result obect 151 New Plugins e getExportResult executes call to server in order to obtain a modified result suitable for export generation Calls all exportable plugins in order to modify request see Section 2 4 1 4 Exportable Interface e getExport abstract contains export generation itself Should prepare export configuration call getExportResult and generate export in an ExportOutput object 2 4 1 3 ExportConfiguration Export configuration objects contain information on what is needed by export plugin to generate output For instance for a CSV export no images are needed and it would be a waste of time to generate them Configuration is set in method getExport then passed to method getExportResult in order to get modified result Configuration is used by plugin to know how to modify request to retrieve useful data 2 4 1 4 Exportable Interface Exportable interface declares a method adjustExportMapRequest which modifies a standard map request
138. light color of a dynamically generated class wow e hilight_createlayer true if true a new layer will be dynamically generated for the hilight e hilight_transparency 1 100 the transparency for dynamically generated layers Examples Hilight using lt layer_name gt _hilight layer 63 Queries LAYER NAME foo END LAYER NAME foo_hilight END Hilight using class hilight LAYER NAME foo CLASS NAME hilight STYLE END END END Hilight using dynamically generated layer LAYER NAME foo METADATA hilight_createlayer true Wie Teint a ea ee NAS AS ON IM rone menas pa renca mo On END END 9 3 2 2 Mask Mode When mask mode is requested decision is made in the following order 1 looks for a layer named lt layer_name gt _mask 2 if not found dynamically creates a mask layer by copying current layer Masking process also tries to find a layer which would hide the area outside all possible selections 1 tries to activate a layer with name set in meta data outside _mask 2 if meta data outside_mask is not set looks for a layer named default_outside_mask 3 if not found no outside mask will be displayed 64 Queries Here are the meta data that can be set to mapfile s layers e mask_color 0 255 0 255 0 255 color of the mask when mask layer lt layer_name gt _mask is not defined wow e mask_transparency true transparency of the mask when mask l
139. line to be used independently of the method where it is located 2 On the Logger object several methods can be used to log messages debug info warn error fatal They take a string as argument which is the message to log Example Sthis gt log gt debug My Message Inside objects Slog gt warn My Message Outside objects 8 3 Debugging Debugging is a large topic Everyone has its preference over the tool to be used like 185 Logging and Debugging using an integrated debugging tool inside an IDE using print statements code printing and reading Because of this this section does not tells what tools to use but rather gives some tips when debugging 8 3 1 Understanding Exceptions and Stack Traces When a failure is encountered in CartoWeb the Php5 mechanism for exceptions handling is used to manage exception and display stack traces People knowing the Java language will be familiar with such stack traces The following example shows such a stack trace display It is easily understood as the list of functions called and the line numbers where the call happened Failure class SoapFault message Error 8 Undefined property ServerMapquery S currentQeury var www cartoweb3 coreplugins mapquery server ServerMapquery php 222 Backtrace file 182 var www cartoweb3 common Common php call Common cartowebErrorHandler file 222 var www cartoweb3 coreplugins mapq
140. llation 1 1 1 Prerequisite for Installing CartoWeb CartoWeb depends on several software components for its proper working Some are required and others are optional depending on what you intend to do Note Windows users can ignore this chapter and go directly to Section 1 1 2 CartoWeb Download The required software are A Web Server Such as Apache http httpd apache org PHP gt 5 0 3 See http www php net for more informations You will need to have some features available in PHP e Gettext optional You need the Gettext module if you want to enable the Internationalization in CartoWeb See Chapter 15 Jnternationalization for configuration Note If you are using the demo you need to have Gettext support installed as it uses Gettext by default If you are using Cygwin simply install the gettext devel package e Curl optional Some scripts like 118n need Curl to fetch files remotely e SOAP optional if using direct mode only You need the SOAP module if you want to use CartoWeb as a Webservice or with separated CartoClient and CartoServer This is related to the cartoserverDirectAccess parameter described in Section 4 2 client ini 16 Installation Note If you are using Windows simply use the Windows Installer Section 1 1 2 CartoWeb Download If you absolutely want to install PHP manually see Appendix B Apache amp Mapserver Windows Manual Installation
141. ls about this parameter see Section 4 2 client ini 187 Performance Tests 9 Performance Tests 9 1 Main Parameters This is a non exhaustive list of interesting parameters for CartoWeb performance tests You may want to vary these parameters values when testing performance before and after development of new functionalities e Cartoweb configuration o Local SOAP distant SOAP or direct mode o Data on PC or through NFS o Map size o Number of active layers o Dynamic legends or not e Logs and cache o MapInfo cached or not o MapResult cached or not o SOAP XML cached or not o Logs activated or not e Map data o Number of layers 10 50 250 9 2 Executing Tests This section describes performance tests execution using APD a debugging profiling tool available as a Zend PHP module 9 2 1 APD Module Installation First thing to do is to install APD s PHP Zend module You can download archive here http pecl php net package apd Follow instructions to compile APD Then load the module by adding the following two lines in php ini zend_extension lt php_home gt 1lib php extensions no debug non zts 20040412 apd so apd dumpdir tmp apd On a win32 installation 188 Performance Tests zend_extension_debug_ts lt php_lib_home gt apd dll apd dumpdir c apd traces Path to apd so may vary See also README file in APD archive You may now activate tracing by adding an empty file t
142. lt type gt lt description gt method type mandatory description if needed var lt type gt lt description gt variable type mandatory description if needed link lt class gt l lt method gt anywhere to add a hyperlink to a class or method see lt class gt l lt method gt anywhere to add a reference to a class or method see is also used for interface implementation Because PhpDocumentor doesn t inherit tags param return etc and because we don t want to copy paste these tags we add a simple see tag to interface method definition See example below 7 2 3 Example Here is a code example Please note simpleVariable doesn t need a description but var tag is mandatory here constructor doesn t need a description getters and setters are too simple to have a description but don t forget the param and return use but not abuse of link and see This can be really useful to navigate through documentation lt php x ha s a E aif EA Test file The purpose of this file is to show an example of how to use PhpDocumentor DocBlocks in CartoWeb package MyPackage author Gustave Dupond lt gustave dupond camptocamp com gt version Id This is a require description require_once required_file php of This is a short description of MyClass MyClass long descrition package MyPackage class MyClass extends MySupe
143. lugins that s why we chose to put them in the server folder of plugins For the first point mentionned above general Unit tests rules apply as described in Section 6 2 1 General Information About Writing Tests For the second point stated a help class named client_CartoserverServiceTest can be extended by the testing classes In turn client_CartoserverServiceTest extends other classes which offer additional helpful methods For the complete list of available methods please have a look at the generate API docs as more may be added in future The main useful methods are createRequest for initializing a new request getMap for lanching the request Tip 178 Unit Tests Having a look at an existing plugin test case is the best starting point for writing new tests 6 2 2 3 Tests for projects Each CartoWeb project can have its set of tests directly inside the project in a directory tests Inside this directory you have to use the same hierarchy as in the main tests directory Inside these tests directories the same mechanism is used for testing as the main tests directory The best way to get started is to have a look at the test_main project for a starting point 6 2 2 3 1 Invoking tests for a specific project For now only the command line can be used for invoking tests for a specific project An environment variable CARTOWEB_TEST_PROJECT can be used to define which test to launch Under
144. maxScale type xsd double gt lt element name shortcuts type types ArrayOfLocationShortcut gt lt all gt lt complexType gt className LocationInit or extended class name if project implements an extension e scales list of fixed scales e minScale global minimum scale e maxScale global maximum scale e shortcuts list of bounding box shortcuts 1 2 4 Layer Reorder This includes configuration specific to LayerReorder plugin lt complexType name LayerReorderInit gt lt all gt lt element name layers type types ArrayOfLayerInit gt lt all gt lt complexType gt e array layers are ordered from top to bottom of the displayed stack see below to LayerInit structure overview lt complexType name LayerInit gt salt lt element name layerId type xsd string gt lt element name layerLabel type xsd string gt lt all gt lt complexType gt 118 Calling Plugins e layerld Layer Id e layerLabel label to be displayed This label is not yet translated using internationalization 1 3 Call to getMap For each plugin SOAP XML format are described for both server calls i e requests and server results 1 3 1 Global Structures Below is a description of general requests and results which include plugin specific ones 1 3 1 1 Global Request lt complexType name MapRequest gt lt all gt lt element name mapId type xsd string gt elements specific to
145. mbine the above architectures as shown on the following figure 3 4 Modularity Projects and Plugins 3 4 1 Plugins 12 Architecture CartoWeb buzzword is modularity The application is built as a set of bricks that interact with each other Those bricks are called plugins Each plugin performs a special group of tasks such as map browsing layers management images properties users permissions data objects querying exportation and much more CartoWeb is shipped with a set of standard plugins that can be separately activated or not It is possible to write your own plugins or customize existing ones as well H 2 UE AE E E E Regular plugins including how to configure them are precisely described in Part II User Manual For more information about how to write or customize plugins see Chapter 2 New Plugins 3 4 2 Projects 13 Architecture Projects are used to separate the upstream application from its customizations They contains all the modifications and adaptations you could have performed to make CartoWeb suit your needs layout templates pictos special configurations personal plugins etc By using projects you can e keep the general application clean from tricky modifications that would compromise the future upgrades e gather your project files to easily save and copy them to another CartoWeb instance For example when copying them from your test server to your pr
146. message Example for use of Men gt functions server side Sif class ServerMyPlugin extends ClientResponderAdapter 164 Internationalization Hy public function handlePreDrawing Srequest SmyPluginResult new MyPluginResult Message must be translated but not now SmyPluginResult gt message I18nNoop gt hello world return S myPluginResult In this example message sent by server has to be translated But as translation process is always done on client we only indicates to the script that there is a text to add to the translation template 4 2 Character Set Encoding As already described in Section 15 2 Character Set Encoding Configuration character set encoding is done using Encoder set of classes It uses functions Encoder encode and Encoder decode e Encoder encode text S context converts text from context s character set to CartoWeb s internal character set UTF 8 e Encoder decode text context converts text from CartoWeb s internal character set UTF 8 to context s character Context can be either config or output default is output Corresponding configuration is set in server ini and client ini see Section 15 2 Character Set Encoding Configuration Function Encoder encode must be used in the following situation e on client or server when reading a text from a configuration file Senc
147. mment the line beginning with ROUTING_PLUGINS e Execute cw3setup php file with the config from file option as described in 26 Installation the previous steps 1 2 4 Extensions Description 1 2 4 1 demoLocation Extension This extension allows you to select geographic objects of a layer by specifying a name According to the name selected the corresponding id is fetched from the search name database and submitted to the recentering coreplugin This coreplugin selects the geographic object in the shapefile according to the id the selected layer and recenter on it The names of the id and the names on which the search is done must be specified in the metadata of the mapfile for each queryable layer These metadata are respectively jd_attribute_string for the id and recenter_name_string for the name You also will have to use the metadata exported_values to transmit these metadata to the client For example you can type METADATA exported_values recenter_name_string id_attribute_string recenter_name_string NAM oO ater pulse string OCC FID siring END The name of the database must be specified in the location ini file Note In the location ini you also need to specify the layers on which you want to do a search by name idRecenterLayers options and activate the coreplugin idRecenter idRecenterActive option 1 2 4 2 demoRouting Extension The routing module is a set of functio
148. must install it manually You can get a version of Gettext for Windows there http gnuwin32 sourceforge net packages gettext htm Also set the path to the Gettext binary in your PATH environment variable C Program Files GnuWin32 bin The example above is true if the Gettext binaries are installed in c Program Files GnuWin32 bin This is needed by the po2mo php script to merge and compile the languages translation files 22 Installation Note If you intend to use CVS in command line you need to install a CVS client Use WinCVS http www wincvs org or TortoiseCVS http www tortoisecvs org download shtml both are free Open Source clients You must add the path to the CVS binary in your PATH environment variable C Program Files TortoiseCVvs The example above is true if you installed TortoiseCVS in c Program Files TortoiseCvs 1 1 4 3 2 CartoWeb Setup with Cygwin Open a Cygwin window and go to the CartoWeb root Cline cd wamp www cartoweb3 Then see Section 1 1 3 2 1 Basic Setup Note You can download Cygwin here Cygwin http www cygwin com When you install Cygwin be sure to select the packages tar or unzip and cvs You can also install the gettext devel package so you wont need to get an external gettext installation later If you have already installed Cygwin type the following command to see what package are currently installed cygcheck G If the packages mentioned ab
149. n Instructions for Apache PHP and MapServer installation are given in Appendix B Apache amp Mapserver Windows Manual Installation Then download CartoWeb as described above Section 1 1 2 CartoWeb Download Eventually set CartoWeb up with the command line script cw3setup php Section 1 1 3 UNIX like Installation from either a DOS or a Cygwin prompt See Section 1 1 4 3 CartoWeb Setup for more info about how to use those interfaces 1 1 4 3 CartoWeb Setup 1 1 4 3 1 CartoWeb Setup with DOS Open a command prompt Start menu gt Run gt cmd and go to the CartoWeb root cd C wamp www cartoweb3 Then see Section 1 1 3 2 1 Basic Setup Note To enable you to execute PHP scripts easily like php cw3setup php someparameters instead of C wamp php exe cw3setup php someparameters set the path to the PHP binary in your PATH environment variable control panel gt system gt Advanced gt Environment Variables If there is no PATH variable add a new one If a PATH variable is already present you can add the path to php exe at the end of the existing path values but add a inbetween path1 path2 path3 C wamp php The example above is true if the PHP binary are installed in c wamp php Note If you are using the demo you need to have Gettext support installed as it uses Gettext by default If you used the win32 installer Gettext is already installed otherwise you
150. n medium depends on the template layout Note that the rendering will be applied to the children not to the LayerGroup itself which is not displayed at all o dropdown as for block rendering the LayerGroup is not displayed Its children are simply rendered as an HTML simple select options list If the selected child layer cannot be determined using posted or session saved data first child according to the layers layerId children list order is selected If any only the selected child layer s own children are displayed under the dropdown list e layers layerld metadata minScale resp maxScale one may specify a numerical 49 Layers minimal resp maximal scale for the given LayerGroup This parameter has absolutely no effect on Mapserver behavior and is only used to display out of scale icons and links in the layers tree For more info about layers ini metadata parameters see Section 6 3 2 Metadata in layers ini 6 2 4 Children Switching Children switching is useful to define several lists of children for one layer group The children that will be displayed is choosen by a special parameter the switch ID Switch IDs and labels are listed in file layers ini In default test environment a dropdown is constructed using this list and displayed in the GUI switches switchl label Switch 1 switches switch2 label Switch 2 switches switch3 label Switch 3 Then each layer group that needs to change its children
151. ndicResut ServerCaller snitializeResuit ServerCaller handeResut oalProvider qet Boats GulProvider menderFarm Exportable adjustEporta Request Sesion abie save Session See client ChentPlugin snp and clent Cartociient sip CartoServer nitializeRequest handiePreDrawing handieDrawing handiePostOrawing InitProvider gt ritiatize Chen Responder initialize Request Chen Responder overnide Request CoreP rm vider andieCoreP lugin location layers ClenRespander handieP reOrawing Citen Responder handieDrawing CoreP mo vider handieCoreP lugin images Citen Responder handieP ms Drawing See serverServerPlugin gha and serverCartaservernho Determine if you will write a plugin or a coreplugin Create a lt yourPlugin gt directory in projects lt yourProject gt plugins if you need a simple plugin Directory name will be the plugin name You can use whatever name you want except of course names of already existing plugins or coreplugins Yet it is recommended to use lowercase letters capitalizing only the first letter of each word that composes the name eg yourPluginName In case of a coreplugin there is no way to create a coreplugin in a project context Coreplugins can only be integrated in the upstream application It is not recommended to do so without CartoWeb developers agreement because of compatibility troubles that may occur when upgrading etc Create subdirector
152. ndows System32 for XP and c Windows System for 95 98 Me o Move php_mapscript_45 d11 in the extensions folder of PHP see PHPINFO default is c wamp php ext The file php_proj d11 is outdated you can ignore it o Open php ini and add a call to this extension 196 Apache amp Mapserver Windows Manual Installation extension php_mapscript_45 dll e Restart Apache and check that the mapscript module is loaded correctly look in PHPINFO e Install Proj4 by following the instructions in URL indicated in the README txt http mapserver gis umn edu cgi bin wiki pl WindowProjHowTo gt Using Prebuilt Binaries o Download the archive Proj4 here ftp ftp remotesensing org proj proj446_win32_bin zip o Uncompress it in C If you want to install it elsewhere look at point 2 of Using Prebuilt Binaries o Point 3 in the README is irrelevant in our case e CartoWeb setup script cw3setup php requires an unzip program to uncompress libraries and demo data archives If you don t have one installed download one on the Web type unzip exe in your favorite search engine and put it for instance in your C Windows directory Note The exe in the Mapserver archive are not needed Note If you are using Windows XP it may be necessary to modify the extension_dir value in php ini by using instead of 197 DocBook Documentation Generation Appendix C DocBook Documentation Generation CartoWeb documentati
153. ng the instructions of the two last sections Say you would like to customize the images coreplugin mainmap size and formats management to e update the layout new pictos new texts new CSS e add some JS processing e adda new form field in a separated area of the CartoWeb interface First point is achieved by creating a images directory in projects yourProject coreplugins and filling it with an overriden template mapsizes tpl anew images css and some pictos projects yourProject coreplugins images projects yourProject coreplugins images templates mapsizes tpl projects yourProject coreplugins images htdocs css images css projects yourProject coreplugins images htdocs gfx button png lt J MEjISL7Ss iol gt lt p gt t Mapsize t lt select name mapsize id mapsize onchange javascript checkMapsize gt html_options options Smapsizes_options selected Smapsize_selected lt select gt lt input type image src r type gfx plugin images button png r alt t Ok button t id imagesButton gt lt p gt For details about template r resource and t translation tags see Section 16 2 TInternationalization and Section 16 3 Resources checkMapsize JavaScript function is not defined in the upstream coreplugin So we have to add a JS file in our overriden plugin projects yourProject coreplugins images htdocs js projects yourProject coreplugins images htdocs js images js 14
154. ns id Name 1045 AIGLE 996 BULLE Download CS 2 6 Annotation and Redlining It is possible to freely draw points lines rectangles and polygons on the map ant to attach labels to them These features are persistent they survive panning or zooming A mask mode in which everything but the outlined polygon is masked is provided too Cartographic Functionalities ANAS WS f WAER Yi AVL ELMS Dif Ne oy VI RS S A J N a Myo PX Y 4 j A 4 5 iSi Ss We A Me my A ES OES AARS A a p 2 7 Measuring Tools Distances and surfaces can be measured on the main map with the following tools 2 8 Internationalization Translation handling in CartoWeb now uses gettext http www gnu org software gettext manual However internationalization architecture is ready for other About Outline Apropos Dessin translation systems Ta make life easier for translators scripts that gather the strings to be translated in the templates and in the configuration files are available 2 9 Access Rights Cartographic Functionalities Access to different elements of CartoWeb can be allowed or denied according to who is currently using the application Both functionalities and data may have access restrictions For instance PDF printing may be totally unavailable for anonymous access limited low resolution for normal user and totally granted high resolution for superusers Similarly hi
155. ns that compute a shortest path from a set of edges and vertices Some functions are provided for importing data from geometric tables and for generating results as geometries Note For more information on these functions you can have a look to the routing module README file http www cartoweb org downloads pgdijkstra README txt This section explains the main steps to integrate the routing fonctionnalities in a 27 Installation custom application We describe the steps followed to install the routing demo To make short we used an Europe roads shapefile imported it in PostGIS generated the graph tables and configured files to suggest a search of the shortest path between two European towns 1 2 4 2 1 Europe Road Geodata Importation in PostGIS shp2pgsql roadl shp roads_europe_tmp gt tmp roadl sql psql d demo_plugins f tmp roadl sql 1 2 4 2 2 Graph Importation The first step is to delete unneeded columns of the table roads_europe_tmp To do so you can type S CREATE TABLE roads_europe gid int UNIQUE source_id int target_id int SELECT AddGeometryColumn roads_europe the_geom 1 MULTILINESTRING 2 INSERT INTO roads_europe gid the_geom SELECT gid the_geom FROM roads_europe The resulting table is so roads_europe You can then fill the columns source_id and target_id with the assign_vertex_id function SELECT assign_vertex_id roads_europe 1 Here is the content of t
156. nt4 SELECT FROM roads_europe_edges LIMIT 3 id source target cost reverse_cost 4 4 4 4 i 2m 2 SM S 4 Z 2 3 rows We can see that it contains NULL values for the cost column The function update_cost_from_distance can update the cost column with the distance of the lines contained in the geometry table attached to each edge SELECT update_cost_from_distance roads_europe The costs are now id source target cost reverse_cost 4 4 4 i ij 2 6657 4656 5793103 2 Ba wA STES ISSA S SSA on It Sl 6 14040 5673116933 3 lignes Now all is set up correctly for using the shortest path function on these data But to include the routing fonctionnalities in a custom project we must respect some rules dictated by the routing plugin 1 2 4 2 3 Routing Plugin Database Configuration The two things to do are to e create the routing results table In this example the table is routing_results S CREATE TABLE routing_results results_id integer timestamp bigint gid integer i S SELECT AddGeometryColumn routing_results the_geom 1 MULTILINESTRING 2 e create the routing_results_seq sequence S CREATE SEQUENCE routing_results_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 29 Installation 1 2 4 2 4 Mapfile Configuration
157. nts lt complexType name Shape gt lt eidL iS lt element name className type xsd string gt lt element name x type xsd double minOccurs 0 gt lt element name y type xsd double minOccurs 0 gt lt element name minx type xsd double minOccurs 0 gt lt element name miny type xsd double minOccurs 0 gt lt element name maxx type xsd double minOccurs 0 gt lt element name maxy type xsd double minOccurs 0 gt lt element name points type types ArrayOfPoint minOccurs 0 gt lt all gt lt complexType gt e className shape class name Point Bbox Rectangle Line or Polygon e x x coordinate Point e y y coordinate Point e minx minimum x coordinate Bbox or Rectangle e miny minimum y coordinate Bbox or Rectangle e maxx maximum x coordinate Bbox or Rectangle e maxy maximum y coordinate Bbox or Rectangle e points list of points Line or Polygon lt complexType name ArrayOfShape gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types Shape gt lt restriction gt lt complexContent gt lt complexType gt e array list of shapes 1 1 3 Tables These types define a table structure used in particular in Query plugin see Section 1 3 6 Query lt complexType name TableRow gt salla lt element name rowId type xsd string gt lt element name
158. o be translated can be found in e Smarty templates using SmartyGettext http sourceforge net projects smarty gettext see Section 16 2 Internationalization e Client plugins ini files for instance map sizes e Server plugins ini files for instance scales labels e Mapfile s ini and map layers labels e Client and server PHP code see Section 4 1 Translations To generate PO templates you will need to launch scripts on server and on client Templates are generated in directory lt cartoweb_home gt projects lt project_name gt po If translation files see Section 15 1 3 Translating already exist a merge is done using msgmerge http www gnu org software gettext manual html_chapter gettext_6 html SEC37 command Follow these steps e generate project and mapfile templates on server cd lt cartoweb_home gt scripts php server2pot php For each mapfile two templates will be generated server po and server lt mapfile_name gt po e generate project template on client cd lt cartoweb_home gt scripts php client2pot php For each project one template will be generated client po 100 Internationalization It is possible to specify for which project you want to generate the po file Simply add the project name as a parameter when launching the scripts client2pot and server2pot php server2pot php myprojectname If you do not specify a project name the po files will be
159. obody e importRemotePng false 12 2 2 Formats Configuration Formats are described as a set of formats sub objects For instance formats A4 bigDimension 297 formats A4 smallDimension 210 formats A3 label A3 formats A3 bigDimension 420 Format ids A3 A4 etc must match those listed in general formats e formats lt format_name gt label string user friendly name Is translated using Cw3118n device Chapter 15 Internationalization e formats lt format_name gt bigDimension float largest sheet side in distUnit e formats lt format_name gt smal1Dimension float smallest sheet side in distUnit 74 PDF Export e formats lt format_name gt horizontalMargin float optional if set overrides general horizontalMargin for the given format e formats lt format_name gt verticalMargin float optional if set overrides general verticalMargin for the given format e formats lt format_name gt maxResolution integer optional maximum allowed resolution for the given format If selected resolution is above maxResolution it will be set to maxResolution value e formats lt format_name gt allowedRoles comma separated list of strings list of roles allowed to use the format PHP built in default values all format parameters have NULL default values except allowedRoles all 12 2 3 Blocks Configuration All blocks parameters are optional since default values are hard coded in the PD
160. odedText Encoder encode SreadText config Function Encoder decode must be used in the following situations e on client when outputing a text without calling 118n gt StextToDisplay Encoder decode encodedText e on client or server when calling an external module eg Mapserver for a query StextToUseInMapserver Encoder decode SencodedText config 165 Internationalization Note that function I118n gt takes an encoded text as argument and already prepares texts for output It means you don t need to call Encoder decode after a call to 118n gt 166 Code Convention 5 Code Convention 5 1 Introduction As an Open Source software CartoWeb needs to be written following some coding guidelines and or rules It is the required condition unless the developpers community isn t able to share new features and enhancements Some of those advises may seem obvious others less For all it is principaly a good way to produce more readable maintainable and portable code 5 2 General Coding Rules 5 2 1 Paths It is highly recommended to be avoid absolute paths as much as possible CartoClient and CartoServer may be relocated with very minimal even none reconfiguration 5 2 2 Extract and Run Deployement It should be possible to extract the archive launch a script edit few options and be ready to use the application with the built in data set see test mapfile 5 2 3
161. oduction one e run different projects on the same CartoWeb instance For more information about projects see Chapter 3 Projects Handling 3 5 Templates CartoWeb layout customization is achieved using the well known and powerful Smarty http smarty php net template engine For more information about templating see Chapter 16 Templating 3 6 Users and Roles CartoWeb enables to define and manage different levels of permissions Thus it is possible to restrict some or all functionalities to some users or categories of users For more information about users and roles see Chapter 14 Security Configuration 3 7 Performance Enhancement CartoWeb takes benefits of several caching systems to speed up its execution All the possibilities are detailed in Chapter 5 Caches Configuration 14 User Manual Part Il User Manual This user manual second part of the CartoWeb documentation is aimed at administrators who have to setup configure and maintain a CartoWeb environment It is not an end user documentation so you won t find here instructions on how to navigate select layers or do whatever operations the distant users are allowed to do through their browser On the other side if you want to go beyond the standard out of the box possibilities of CartoWeb you ll definitely have to look at the third part of this documentation intended for developers 15 Installation 1 Installation 1 1 CartoWeb Insta
162. oject swiss Method only needs map ID as argument ETE result Sclient gt getMapInfo swiss_project swiss prink r Sresult jy Catches SOapramlitmes isc ts ma print Sfault gt faultstring 2 Result is shown below It includes server configuration for the corresponding project and mapfile stdClass Object timeStamp gt 1107043488 mapLabel gt Switzerland keymapGeoDimension gt stdClass Object dimension gt stdClass Object width gt 100 height gt 100 bbox gt stdClass Object minx gt 485000 miny gt 65000 maxx gt 835000 maxy gt 298000 initialMapStates gt Array 0 gt stdClass Object id gt default location gt stdClass Object bbox gt stdClass Object minx gt 470000 132 Calling Plugins miny gt 50000 maxx gt 860000 maxy gt 320000 layers gt Array 0 gt stdClass Object id gt swiss_layer_1 hidden gt frozen gt selected gt 1 unfolded gt 1 gt stdClass Object id gt swiss_layer_2 hidden gt 1 frozen gt selected gt 1 unfolded gt layersInit gt stdClass Object notAvailableIcon gt gfx icons swiss_project swiss na png notAvailablePlusIcon gt gfx icons swiss_project swiss nap png notAvailableMinusIcon gt gfx icons swiss_project swiss nam png layers gt Array 0 gt stdCla
163. ojects This approach is recommended when you want to use your own versions of the plugin templates or resources Moreover you can add any new resources files that will be called in your customized templates However you will not be able to replace or add PHP files except PHP pages in the plugin htdocs To adapt a plugin server side behavior PHP classes you have to extend the plugin which is explained in Section 2 3 3 Extending a Plugin Say for instance you want customize the layers coreplugin by modifying its template layers tp1 and rewriting some of its JS tools stored in layers js Than your project adapted coreplugin will look like projects lt yourProjectName gt coreplugins layers projects lt yourProjectName gt coreplugins layers templates projects lt yourProjectName gt coreplugins layers templates layers tpl projects lt yourProjectName gt coreplugins layers htdocs projects lt yourProjectName gt coreplugins layers htdocs js projects lt yourProjectName gt coreplugins layers htdocs js layers js If you don t need to override the CSS file it is no use to create a css directory containing a copy of the upstream layers css If you want to neutralize a file you can simply override it with a blank version For instance to have a void output create a template file with no content It is also possible to override the plugin configuration files by adding lt pluginName gt ini files in the project conf
164. omplexType gt e array list of shapes with style lt complexType name OutlineRequest gt lt all gt lt element name className type xsd string gt lt element name shapes type types ArrayOfStyledShape gt lt element name maskMode type xsd boolean gt lt all gt lt complexType gt e className OutlineRequest or extended class name if project implements an extension e shapes list of styled shapes e maskMode if true will draw the complement of all shapes merged together 1 3 7 2 Outline Result lt complexType name OutlineResult gt lt all gt lt element name className type xsd string gt lt element name area type xsd double gt lt all gt lt complexType gt e className OutlineResult or extended class name if project implements an extension e area total area for all shapes 1 4 Examples The following examples show simple SOAP calls using PHP 131 Calling Plugins To use these examples with your CartoWeb server you ll have to modify the map ID and the layer names Please note that in these examples access to resources uses symbolic links see Chapter 4 Configuration Files 1 4 1 Retrieving Server Configuration First thing to do is to declare the SOAP client Class SoapClient will need the WSDL code dynamically generated by script cartoserver wsdl php lt php Sclient new SoapClient http url to server cartoserver wsdl php mapld swiss_pr
165. on 1 1 3 2 6 Install or Reinstall CartoWeb from CVS and Set Up It at Once for more details Once you have CartoWeb point your web browser to the file located in htdocs info php and check that the PHP information page displays correctly meaning PHP is correctly setup and that you have do not have a WARNING message at the top of the page about MapScript failing to load If it is not the case CartoWeb will not run correctly You should install and set up PHP and PHP MapScript correctly See Section 1 1 1 Prerequisite for Installing CartoWeb Having Gettext installed is recommended if you wish to use the multilingual features of CartoWeb 7 1 3 UNIX like Installation CartoWeb installer is cw3setup php located in the root directory of the application You can run this file with the help parameter to see the available options For instance lt PHP INTERPRETER gt cw3setup php help where lt PHP INTERPRETER gt is the location of your php interpreter On Windows it can be c wamp php php exe or on Unix usr lib cgi bin php 1 1 3 1 List of Available Options Usage cw3setup php ACTION OPTION Possible actions Shel or Si Display this help and exit SUSE LOM Or iy Output version information and exit Sistas Install CartoWeb fetch demo Fetch the demo data from cartoweb org and extract it in the demo project if not already there clean Clean generated files and caches IbplLSie Cie
166. on source are in DocBook XML format and located in documentation user_manual source in CartoWeb archive You may want to generate it by yourself in order to produce XHTML or PDF output C 1 Documentation Generation on UNIX like System C 1 1 Tiny DocBook Install Uncompress the tiny docbook 1 6 16 tar bz2 http www cartoweb org downloads docbook tiny docbook 1 6 16 tar bz2 archive somewhere in your filesystem Execute S configure enable install make install to install and configure Tiny DocBook environment C 1 2 JAI Install For PNG support with PDF generation you will also need to install JAI If you don t plan to produce PDF you could jump to next step otherwise process as following 1 Retrieve JAI archive from Sun site http java sun com products java media jai downloads download 1_1_2 _01 html took the classpath one for your platform 2 Uncompress it in your Tiny DocBook install dir S wean syari Jei I 2 Oil Iavo aia 586 Tare 3 Move jai 1_1_2_01 lib jai_codec jar and jai 1_1_2_01 lib jai_core jar to fop lib Saw Jai ii 2017 iby jai codec jar Eoy L S mr ai ei jae Core arian lay 4 Remove the becoming useless JAI archive like that S mm ee Tar ale oo 198 DocBook Documentation Generation C 1 3 Create a Symbolic Link to Documentation Source Create a symbolic link in the Tiny DocBook install directory pointing to the CartoWeb documentation sources lt cartoweb_
167. on within a layer as well as comparison between layers A way to organize the layers is thus mandatory if an user friendly application is to be developed In CartoWeb the files that contain the configuration instructions for the layers are on the server side in the directory server_conf lt myMap gt Usually this directory is part of a project CartoWeb is based on the geographical engine Mapserver The Mapserver documentation http mapserver gis umn edu doc html http mapserver gis umn edu doc html is an integral part of the CartoWeb doc To be concise you have to know how to write a mapfile if you want to use CartoWeb So it doesn t come as a surprise that a mapfile myMap map is included in the lt myMap gt directory together with its annexes typically a symbol file myMap sym a directory etc for the required fonts the graphic file used as keymap background maybe also data files We ll see that some functionalities of CartoWeb require small changes of the mapfile content But most of the configuration is done in the file layers ini The file myMap ini sets the required plugins and the initial state of the map Its content is described in Chapter 4 Configuration Files 6 2 Hierarchy of Layers and Rendering Contrary to Mapserver itself CartoWeb supports an arbitrarily complex hierarchy of layers and different rendering options The notion of LayerGroup makes it possible 6 2 1 Layers and LayerGroups There are two types of
168. onfiguration options are described below 42 Configuration Files Warning These parameters will be overrided by the profile parameter See Section 4 1 Common client ini and server ini Options These parameters are available in client_conf client ini for client and server_conf server ini for server e showDevelMessages truelfalse Shows developer messages e developerIniConfig truelfalse Sets ini parameters useful during development e allowTests truelfalse allows tests running through Web interface 43 Caches Configuration 5 Caches Configuration Several different caching mechanisms are available in CartoWeb for maximum performances The different types of caches are described in the next chapters 5 1 Smarty Cache The templating system used in CartoWeb is Smarty which offers two level of caching for templates One is compilation of templates into the templates_c directory and the other is static caching of templates In CartoWeb because pages are very dynamic only the first level of caching is used The caching feature of Smarty is totally transparent to the user However an option can be set in the client_conf client ini configuration file to enhance performances e smartyCompileCheck truelfalse Set this to false in production to improve performance Warning This parameter will be overrided by the profile parameter See Section 4 1 Common client ini and server ini Options
169. operties 25 Installation Note Routing fonctionnalities are also integrated in this demo But they need a more advanced configuration and the Pgdijkstra module installed in the database so they aren t integrated in the basic installation The steps to integrate routing fonctionnalities and create database tables are described in next section 1 2 3 Routing specific installation Install the Pgdijkstra PostgreSQL module Note To do so o if you are on Debian you can directly install the Pgdijkstra PostgreSQL extension module To do so you can have a look at Appendix A Mapserver Debian Installation o instead you can download the Pgdijkstra Routing Module file and follow the instructions given in the routing module README file at http www cartoweb org contribs html e Execute the dijkstra sq file to install the functions in your database by typing pecil a demo plugins E Gigkst ra sql If you have PostGIS installed you should launch dijkstra_postgis sql psql d demo_plugins f dijkstra_postgis sql e Import Europe road geodata in PostGIS create its graph structure and configure plugin routing database To do so simply execute the demo_routing sql file located in the lt cARTOWEB_HOME gt projects demoP lugins server_conf sql directory Note These steps are detailed in the next section Edit the cartoweb3 projects demoPlugins demo properties file and unco
170. or layout only pictos it is no use to display a replacement message For instance lt img src mainmap gif width 400 height 200 alt Main map gt lt img src pixel gif width 50px height 1px alt gt 174 Unit Tests 6 Unit Tests 6 1 Introduction Unit tests are an important componant in the CartoWeb development environment The framework used for unit testing is based on PHPUnit2 http www phpunit de en index php a PEAR package For more informations abouth PHPUnit2 see http pear php net reference PHPUnit2 2 0 3 PHPUnit2 is included in the libraries shipped with CartoWeb Thus no installation is needed to run and write new tests 6 2 Writing Tests Information about writing tests for CartoWeb can be separated into two parts First part about writing Unit tests in general useful for people new to PhpUnit Then a part more specific about the infrastructure which is available in CartoWeb for writing tests 6 2 1 General Information About Writing Tests Test cases are located in directory tests for testing the core of CartoWeb and in the directoies lt project gt tests for for tests specific to project lt project gt Inside these tests directories path hierarchy mirrors the existing hierarchy they are testing For instance the tests hierarchy for the core CartoWeb testing is the following client CartoclientTest php CartoserverServiceTest php AllTests php common BasicTypesTest php All
171. order to easily apply the application upgrades Projects are in fact a mirrored collection of directories and files from the original architecture Files placed in a project are in most cases used preferentially to the original files There is an exception with plugins PHP classes the latter must be extended and not simply overridden In projects you can also add brand new files for instance new plugins that have no original version in the upstream structure Fore more details about how to write or customize plugins in projects see Chapter 2 New Plugins in Part III Developer Manual Note that you don t need to duplicate the whole CartoWeb structure in your projects Only directories that contain overriding files have to be created In ini files only variables set in projects are overridden Other variables keep the values set in upstream ini files Following files can be overridden e client_conf ini client ini and plugins configuration files core plugins client php core plugins common php core plugins server php core plugins htdocs php core plugins templates tpl htdocs css css htdocs js js e htdocs gfx layout gif e server_conf server ini e server_conf lt mapId gt ini lt maplId gt ini and plugins configuration files e templates tpl 34 Projects Handling You can add project specific mapfiles in directory projects my_project server_con
172. osition e The arrows surrounding the main map e The dynamic i e clickable keymap e The navigation tools zoom and pan e The drop down menu Scale e The various options in the Search tab The menu Mapsize is self explanatory 2 4 Arbitrarily Complex Hierarchy of Layers Contrary to Mapserver itself CartoWeb supports an arbitrarily complex hierarchy of layers with infinite depth The elements of the layers tree have different rendering options e normal checkboxes Cartographic Functionalities e blocks e radio button exclusive options e drop down menu exclusive options Examples of these rendering options are presented in the following figure Background Human activities El O T owns O T owun Agglomeration El E Transports E iV Roads Oa Category Relief El M hiountains A gt 3500m 2500m M O loelands The icons for the classes are automatically drawn and the out of scale layers are grayed out 2 5 Map Queries Using the query tool you can geographically search for objects Found objects are hilighted and their attributes are displayed CartoWeb adds many functionalities to the raw queries supported by Mapserver In particular the queries may be persistent i e you can add new objects to already selected objects and the hilighting can be defined on a layer by layer basis Cartographic Functionalities Px Ay USSANE Query Results Tow
173. ove are not present run Cygwin setup again and add the missing packages Note To enable you to execute PHP scripts easily set the path to the PHP binary in your bashrc in C cygwin home Administrator by default export PATH SPATH cygdrive c wamp php The example above is true if the PHP binary are installed in c wamp php If you do not want to install the cvs and gettext Cygwin package you need to add also the path to the external CVS and gettext binaries export PATH SPATH cygdrive c program Files GnuWin32 bin export PATH PATH cygdrive c program Files TortoiseCVvs 23 Installation See the note in Section 1 1 4 3 1 CartoWeb Setup with DOS 1 2 Demos Installation 1 2 1 Introduction A few demos are embedded in CartoWeb to demonstrate the range of functionalities that CartoWeb offers and give users examples on how to implement them e demoCWs3 this is an overview of the standard functionalities that are somehow visible for an end user in CartoWeb e demoPlugins it shows the new functionalities that are available in CartoWeb since the latest version Demo data are freely downloadable Next section explains how to install them Configuration and programming details are then described 1 2 2 Installation Before installing these demos you need to have a working CartoWeb installation You can refer to the previous chapters how to install it To install the demoCW3 project you need to ga
174. panning e zoomPointLocationRequest recenters on a point includes relative zoom and fixed scale e recenterLocationRequest recenters on mapfile IDs lt complexType name LocationConstraint gt lt ALL gt lt element name maxBbox type types Bbox gt lt all gt lt complexType gt e maxBbox maximum bounding box If given parameters lead to a larger bounding box it will be cropped see Section 1 1 2 Shapes for a description of type Bbox lt complexType name LocationRequest gt lt all gt lt element name className type xsd string gt lt element name locationType type types LocationType gt lt element name bboxLocationRequest type types BboxLocationRequest minOccurs 0 gt lt element name panLocationRequest type types PanLocationRequest minOccurs 0 gt lt element name zZoomPointLocationRequest type types ZoomPointLocationRequest minOccurs 0 gt lt element name recenterLocationRequest type types RecenterLocationRequest minOccurs 0 gt lt element name locationConstraint type types LocationConstraint minOccurs 0 gt lt all gt lt complexType gt e className LocationRequest or extended class name if project implements an extension 123 Calling Plugins e locationType type of location e bboxLocationRequest bounding box request parameters see Section 1 3 5 1 1 BBox Request e panLocationRequest panning request parame
175. pe xsd string gt lt element name bbox type types Bbox gt lt element name scale type xsd double gt lt all gt lt complexType gt e className LocationResult or extended class name if project implements an extension e bbox new bounding box see Section 1 1 2 Shapes for a description of type Bbox e scale new scale 1 3 6 Query The Query plugin allows to search objects hilight them on map and return text results Search can be executed from a rectangle selection and or using a list of object IDs Query request object is not mandatory For more information about Query plugin see Chapter 9 Queries 1 3 6 1 Query Request lt simpleType name QuerySelectionPolicy gt lt restriction base xsd string gt lt enumeration value POLICY_XOR gt lt enumeration value POLICY_UNION gt lt enumeration value POLICY_INTERSECTION gt lt restriction gt lt simpleType gt e POLICY_XOR XOR selection when selecting a group of objects already selected ones are unselected and not yet selected ones are selected default type e POLICY_UNION union selection when selecting a group of objects already selected ones are kept selected and not yet selected ones are selected e POLICY_INTERSECTION intersection selection when selecting a group of objects only already selected ones are kept selected lt complexType name QuerySelection gt salba lt element name layerId type xsd string
176. perty gt convention These parameters are grouped within dedicated objects that deal with separated aspects of the export For instance general horizontalMargin 10 general verticalMargin 10 formats A4 label A4 formats A4 bigDimension 297 Some objects handle the general description of the PDF document as well as user form generation general and formats Other objects are blocks typed They deal with block presentation color size content etc and positioning Blocks are basic entities of the PDF document text images For instance overview mainmap scalebar title are described with block objects To factorize blocks description it is possible to describe a template block object that defines the default configuration of blocks Those default settings are then overriden by each block specific description e general formats comma separated list of strings ids of available sheet sizes Must match format objects names see Formats configuration below e general defaultFormat string default selected used format Must be one of the above list items e general resolutions comma separated list of integers list of available 72 PDF Export resolutions in dot per inch dpi general defaultResolution integer default selected used resolution Must be one of the above list items general defaultOrientation portraitllandscape sheet orientation The same orientation is used for every pages of the
177. pes for a description of type ArrayOfString e noRowld if true table rows contain no row IDs e rows list of rows lt complexType name ArrayOfTable gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types Table gt lt restriction gt lt complexContent gt 111 Calling Plugins lt complexType gt e array list of tables lt complexType name TableGroup gt lt all gt lt element name groupId type xsd string gt lt element name groupTitle type xsd string gt lt element name tables type types ArrayOfTable gt lt all gt lt complexType gt e groupld ID of table group e groupTitle title of table group e tables list of tables lt complexType name ArrayOfTableGroup gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types TableGroup gt lt restriction gt lt complexContent gt lt complexType gt e array list of table groups lt complexType name TableFlags gt lt all gt lt element name returnAttributes type xsd boolean gt lt element name returnTable type xsd boolean gt lt all gt lt complexType gt e returnAttributes if true will return attributes row cells in addition to row IDs e returnTable if false won t return any table information This can be useful for instance when hilighting an objec
178. plugins lt all gt lt complexType gt e mapld map ID ie project name and mapfile name separated by a point 1 3 1 2 Global Result lt complexType name Message gt lt all gt lt element name Channel type xsd integer gt lt element name message type xsd string gt lt ul gt lt complexType gt e channel type of message 1 end user 2 developer e message text of the message lt complexType name ArrayOfMessage gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types Message gt lt restriction gt lt complexContent gt lt complexType gt 119 Calling Plugins e array list of messages lt complexType name MapResult gt lt all gt lt element name timestamp type xsd integer gt lt element name serverMessages type types ArrayOfMessage minOccurs 0 gt elements specific to plugins sraa lt complexType gt e timestamp timestamp which identifies the server configuration If this timestamp changes it means server configuration changed and a call to method getMapInfo is required to get latest version see Section 1 2 Call to getMapInfo e serverMessages list of messages returned by server 1 3 2 Images The Images plugin generates MapServer images The three types of images are main map key map and scale bar Basic parameters such as image size are defined in this request
179. pter describes the structure of SOAP calls to CartoWeb server methods in order to obtain cartographic data Global WSDL code can be found in file CARTOWEB_HOME server cartoserver wsdl WSDL code specific to plugins are located in PLUGIN_HOME common plugin_name wsdl inc Interesting parts from these files are copied in the following sections Complete WSDL code dynamically generated for a map ID is accessible at the URL CARTOWEB_URL cartoserver wsdl php mapId project_name mapfile_name SOAP method getMapInfo is used to retrieve server configuration information such as available layers initial state etc It shouldn t be called each time a map is requested A mechanism based on a timestamp is available to be sure configuration is up to date see Section 1 2 Call to getMapInfo SOAP method getMap is used each time a new map or related information are needed 1 1 Standard Structures 1 1 1 Simple Types These types are used in different other structures lt complexType name ArrayOfString gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType xsd string gt S Teserict von lt complexContent gt lt complexType gt e array list of character strings lt complexType name Dimension gt lt all gt lt element name width type xsd int gt lt element name height type xsd int gt lt a gt lt complexType gt
180. put readonly readonly gt lt input disabled disabled gt lt option selected selected gt lt frame noresize noresize gt Here is a list of the minimized attributes in HTML and how they should be written in XHTML lt dl compact compact gt lt input checked checked gt lt input readonly readonly gt lt input disabled disabled gt lt option selected selected gt lt frame noresize noresize gt 5 4 5 Id vs Name HTML 4 01 defines a name attribute for the elements a applet frame iframe img and map In XHTML the name attribute is deprecated Use id instead This is wrong lt img src picture gif name picturel gt This is correct lt img src picture gif id picturel gt Note To interoperate with older browsers for a while you should use both name and id with identical attribute values like this lt img src picture gif id picturel name picturel gt IMPORTANT Compatibility Note To make your XHTML compatible with today s browsers you should add an extra space before the symbol 5 4 6 Image alt 173 Code Convention alt attribute is mandatory for lt img gt tag in XHTML But it can and sometimes should have a void value alt is used to specify a replacement text when image is not loaded image unavailable not yet loaded or user deactivated images For data images a convenient alternative text should be specified but f
181. r Windows Manual Installation This page describes the step by step procedure to install Cartoweb3 on Windows using WAMP Mapscript and Cartoweb The following configuration was tested e Windows 2000 e WAMP 1 4 4 Apache 1 3 33 PHP 5 0 4 e Mapserver 4 5 e Cartoweb 3 0 0 and Cartoweb3 CVS version B 1 Apache PHP5 Install Cartoweb requires php5 MS4W only supports php4 3 so we will need WAMP 1 4 4 or greater You can get the installation package here http www wampserver com download php Launch the setup by clicking on the executable file you just downloaded here wamp5_1 4 4 exe Keep default install options e Install WAMP in c wamp e Set www root folder as c wamp www Once installation is completed e If WAMP didn t loaded automatically icon in the system tray in the lower right of the screen load it Stat menu Programs WampServer Start Wampserver e Type http localhost in a browser e Once the page has loaded click on Tools gt phpinfo http ocalhost exemples phpinfo php to display the complete PHPINFO information e Take note of the path to the php ini file Configuration File php ini Path It should look like c wamp apache php ini e Open the file php ini in any text editor and go to the Dynamic Extensions section Activate the SOAP Curl and Gettext extensions Simply remove the at the beginning of the lines 195 Apache amp Mapserver Windows Manual Installation If yo
182. r ini Options Common options for both client and server These parameters are available in client_conf client ini for client and server _conf server ini for server e profile developmentlproductionlcustom Current profile the developer profile has no cache activated and uses WSDL Development profile has all caches activated for best performances Setting this parameter to development or production will override some parameters in the configuration The custom profile means the parameters about caching and other are not overrided e useWsdl truelfalse if true WSDL will be used for sending SOAP requests This will add some processing time but ensures that SOAP requests are well structured Cache options See Section 5 6 Caches Configuration Developer options See Section 4 5 Developer Specific Configuration 4 2 client ini CartoServer access configuration e cartoserverDirectAccess truelfalse toggles between SOAP and direct modes Direct access gives enhanced performances but is only available if CartoServer runs on the same server as CartoClient e cartoclientUrl url base URL of the cartoclient e cartoserverUrl url base URL of the cartoserver i e path containing the cartoserver wsdl php file Mapfile configuration 37 Configuration Files e mapld string e initialMapStateld string Tells what initialMapState to use when creating a new CartoWeb session see also Section 4 3
183. r use a path relative to the target cartoweb3 directory or an absolute path config from project PROJECT Read the configuration file containing variables to replace in in files from the specified project fetch project cvs PROJECT Fetch the given project from CVS see cvs root option etch project dir DIRECTORY Fetch the given project from a directory default project PROJECT Default project to use this is set automatically Li Ueing contig rrom prejec base url BASEURL URL where you can find client php profile PROFILENAME The profile to use development production custom clean views Clean views must be used with clean 1 1 3 2 Examples of Use 1 1 3 2 1 Basic Setup To perform a basic setup of CartoWeb such as if you want to run the demo project type lt PHP INTERPRETER gt cw3setup php install pase url http www example com cartoweb In this example http www example com cartoweb is the address which corresponds to the cartoweb3 htdocs directory You should find client php if you type this URL 1 1 3 2 2 Installing a Project from a Directory 19 Installation lt PHP INTERPRETER gt cw3setup php install fetch project dir home foo my_project base url http www example com cartoweb 1 1 3 2 3 Updating CartoWeb after Modifications When you modify or add new content features to CartoWeb you need to update it This will set relative links or copy new modified re
184. rClass 181 Code Documentation a Gyeln int E public simpleVariable var MyVarClass Cur public SsimpleObjectVariable This variable needs a description 2 yar eee yf public S notSoSimpleVariable param int yf function __construct SinitialValue DAG ts CON Sie al Ciel ey Sthis gt simpleVariable SinitialValue Sthis gt simpleObjectVariable NULL Sthis gt notSoSimpleVariable param int ay function setSimpleVariable SnewValue Sthis gt simpleVariable SnewValue w aenda aie wif function getSimpleVariable return Sthis gt simpleVariable This is a short description for method This is a longer description Don t forget to have a look here link MyLinkClass myLinkMethod blah blah param string description of first parameter param MyParamClass description of second parameter return boolean true if everything s fine see MyInterestingClass wf function myMethod SmyFirstParameter SmySecondParameter blah blah return true see MyInterface myImplementingMethod 2 function myImplementingMethod myParameter blah blah return true function myOverridingMethod SmyParameter blah blah 182 Code Documentation return true 183 Logging and Debugging 8 Logging and Debugging 8 1 Introduction This chapter is about the logging framework used in CartoWe
185. race apd in directories lt cartoweb_home gt cli nt and lt cartow b_home gt server touch trace apd When using Cartoweb in direct mode only one trace file will be generated When using Cartoweb in SOAP mode two trace files will be generated one for client and one for server These files can be found in directory set in apd dumpdir variable php ini see above 9 2 2 Simple Execution Times To get global execution times use script cwprof php e First usage execute script on each trace file This could be useful to re parse an old trace file If you have separated trace files for client and server you will need to execute the script twice cd lt cartoweb_home gt scripts php cwprof php lt trace_file gt e Second usage execute script on a directory The script will parse the most recent trace file The 1oca1 option is used when client and server trace files are located in same directory In this case the two most recent trace files are parsed and results for client and server are merged cd lt cartoweb_home gt scripts php cwprof php local lt trace_directory gt Script output will look like this times in milliseconds Exec client 451 Exec server total 707 Exec MS obj 472 Exec MS other 85 Exec total 1524 e Exec client time elapsed on client Will be empty if script is executed on a server only trace file e Exec server total time elapsed on server It includes Exec MS obj and Exec MS
186. rated list of layerlds when using switching see Section 6 2 4 Children Switching This option cannot be used together with simple children option e layers layerld aggregate truelfalse if true the children objects are not listed in the tree and not individually selectable Default is false e layers layerld label string caption of the layer in the layer tree on the client this is a raw label before any internationalization The i18n scripts automatically include this label in the strings that can be translated e layers layerld icon filename filename of the static picto that illustrates this Layer in the layer tree The path is relative to myMap ini See also Section 6 4 Layers Legends for a description of the automatic legending process e layers layerld link url provides a link for the layer e g to some metadata makes the caption in the tree clickable e layers layerld rendering treelblocklradioldropdown indicates how to display the LayerGroup children o tree default value children layers are rendered below the LayerGroup with an indentation If children are not declared as frozen or hidden they will be preceded by a checkbox input A node folding unfolding link is displayed before the LayerGroup o radio quite similar to the tree rendering with radio buttons replacing checkboxes Only one child layer can be selected at a time o block children layers are separated as blocks separatio
187. ration e viewSavedRequest comma separated list of strings list of REQUEST variables GET POST COOKIE that must be preserved when loading a view Some are already built in listed such as tool js_folder_idx project collapse_keymap and views related parameters Adding other CartoWeb reserved REQUEST variables names to the list may prevent the view system from working correctly e viewLogErrors boolean if true outdated views loadings will be logged in 10g viewErrors log e viewUpgradeOut dated boolean if true CartoWeb will try to upgrade outdated views on the fly Else view outdated parts will be discarded and current plugin session data will be used instead For instance Views management viewOn true viewStorage db viewablePlugins location layers query outline viewMetas author viewDsn pgsql www data localhost cw3 viewAuth admin viewSavedRequest personalVarl personalVar2 viewLogErrors true viewUpgradeOutdated true Should you decide to use a database storage you would need first to create an appropriate table called views Here is an example of SQL statements for PostgreSQL 91 Views CREATE TABLE views views_id serial NOT NULL PRIMARY KEY views_ts timestamp without time zone viewtitle character varying 50 author character varying 50 sessiondata text viewshow boolean weight integer Tip Field views_ts is just present in table views but not visibl
188. rent map state as a view simply fill in the form fields with matching metadata To make the view visible check the Show view option Finally push the save button You may also save a new view using an existing view To do so load the desired view as described in Section 13 3 1 Loading Views modify it as explained in Section 13 3 2 3 Updating a View and push the Save as new view button 13 3 2 2 Deleting a View Load the view you want to delete as shown above and push the Delete button A JavaScript confirmation pops before irreversible deletion 13 3 2 3 Updating a View To modify a view map properties selected layers annotations map extent etc as well as its metadata title visibility etc load it as seen above If your changes only concern metadata simply update the dedicated form fields and push the Update button To update the view map properties check the Memorize form option Metadata and selected view ID are then memorized while you perform your changes pans zooms annotations layers selections etc Eventually push the Update button 93 Security Configuration 14 Security Configuration 14 1 Introduction Access to different parts of the CartoWeb can be allowed or denied according to who is currently using the application The following concepts are used in this chapter Security Mechanisms Concepts User Representation of a user accessing CartoWeb If the user
189. rojects 34 Q queryLayers 61 query_returned_attributes 63 R recenterActive 57 recenterDefaultScale 58 recenterMargin 58 Resources 105 returnAttributesActive 61 Roles management PDF 89 roles USERNAME 95 root layergroup 49 roRowld 62 S scaleModeDiscrete 58 scales label 58 scales value 58 scales visible 58 scalesActive 57 scaleUnitLimit 57 separator CSV 71 shortcuts bbox 58 shortcuts label 58 shortcutsActive 57 Smarty Templates 105 Special plugins 151 T Table blocks PDF 86 Tables 155 template object PDF 82 Templates 105 Text blocks PDF 83 textDelimiter CSV 71 topLayers 56 transparencyLevels 56 U users USERNAME 95 V View deletion 93 View loading 92 View recording 93 View update 93 Views 90 Views configuration 90 W weightOutlineLine 67 weightOutlinePoint 67 201 Index weightOutlinePoly 67 weightOutlineRectangle 67 weightPan 57 weightQuery 61 weightZoomIn 57 weightZoomOut 57 Z zoomFactor 58 202
190. ryResult verticalMargin 10 blocks queryResult hCentered true blocks tableCaption backgroundColor f f 0000 blocks tableCaption color white blocks tableCaption content Table test blocks tableCaption height 15 blocks tableHeaders backgroundColor ffaaaa blocks tableHeaders fontBold true blocks tableHeaders color eeeeff Tip A special table block exists to specify which TableGroup see Section 2 4 3 1 Tables Structures you want to display in the PDF blocks queryResult content query In that case only the TableGroup query is visible but you can specify more than one 87 PDF Export separate by comma If this block is not defined in the configuration file all TableGroup are visible in the PDF file backward compatibility The query results data come from the plugin Table which offers the mechanism of table rules see Section 2 4 3 2 Setting Rules which describes how tables must be displayed You can also add table rules specificaly for the PDF output like this example SoutputType S this gt cartoclient gt getOutputType if SoutputType Cartoclient OUTPUT_HTML_VIEWER rules for HTML output if SoutputType pdf cules for PDF output output Type is generally the export plugin name without the export prefix 12 3 3 6 Legend Block There is usually only one instance of legend block in a CartoWeb PDF document It gi
191. s gt httpRequestHandler gt handleHttpRequest Sthis gt clientSession Sthis gt cartoForm Srequest new FilterRequestModifier _REQUEST Sthis gt callPluginsImplementing FilterProvider filterPostRequest Srequest Sthis gt callPluginsImplementing GuiProvider handleHttpPostRequest Srequest gt getRequest else Srequest new FilterRequestModifier _REQUEST Sthis gt callPluginsImplementing FilterProvider filterGetRequest Srequest Sthis gt callPluginsImplementing GuiProvider handleHttpGetRequest Srequest gt getRequest SmapRequest Sthis gt getMapRequest t SmapRequest t his gt mapResult t his gt call t his gt call Sthis gt formRenderer gt showForm Sthis t t his gt call his gt saveSession S this gt clientSession his gt callPluginsImplementing ServerCaller PluginsImplementing ServerCaller Sthis gt mapResult PluginsImplementing ServerCalle Sthis gt mapRe PluginsImplementing Sessionable buildRequest this gt getMapResultFromRequest SmapRequest initializeResult r handleResult SUELEN saveSession callPluginsImplementing SinterfaceName methodName Sargument is run at various points of the program and make plu gins implementing given lt interfaceName gt interface execute given lt methodName gt
192. s that if a parent LayerGroup is not allowed to be viewed then all the children won t be visible The permissions for layer must be activated in the layers ini CartoClient configuration file and are set in the metadata of the mapfile or the lt layers gt ini configuration file The concept of metadata in mapfiles and ini file is described in Section 6 3 Metadata in Mapfile and layers ini The metadata key name which can be used is called security_view and contains a coma separated list of roles which are allowed to view this layer If no such metadata key is associated to a layer or layerGroup anyone can see the layer Heres the description of the layers ini configuration file e applySecurity True if the security check of layer access is activated It might have a minor impact on performances if a large number of layer is used Here s an example of a security metadata key used in layer of the mapfile METADATA exported_values security_view security_edit security_view admin Wel aeee e EE GA Hen saa mask_transparency 50 Task ole Y255 255 Ol area_fixed_value 10 END In this example the layer containing this metadata description will only be visible for users having the admin role Note Notice the usage of the exported_values metadata key which lists the security related metadata key It is explained in Section 6 3 Metadata in Mapfile and layers ini Now let s look the cas
193. seenn 165 5 COGS CONMVEMIOM seitse er ae e EEEE AE E 167 3 lo ATER OCMC OM sie seran a E r a ER 167 5 2 General Coding Rules icsisccageceissassaaacaesdcatinassan edegeaatesoptacevatins 167 Dede E PAWS EAA AT EEA ETE 167 5 2 2 Extract and Run Deployement 1 0 0 0 eeeeeeeeeeeeeteeeees 167 5 2 3 Development Configuration 0 0 0 eeececeereeeeteeeeeteeeees 167 5 24 Unit Tests eenei Hansastinn a lesesatasenuanesieens saunas lanes 167 534PHP oen aiea aa ae eosa aaa es anaiena 168 5 3 1 Coding Style ukna a a a EE R 168 5 3 27 COMMENS erii s e tec cic atannes 170 5 4 HTML Coding Standards 0 c15ccccscceessscisactssessedessecesatesusbaceosnece 170 SA l NESNE oieta eo e eee a S a a a i 171 5 4 2 Lower Case red renna E R EE ER 171 DA Ss COSINE inre a E wire teadater 172 5 4 4 Minimization sesesssessseessessseseseresssetssresseesseeeseressseessrese 172 DA Se ld ys NaMe neresti ao r a t aosi 173 DAG Tage Alt ssesses vases carvcasaseiudoee sta thavaasasporaetensncedetieeesteaasase 173 6 Unit orc rer ae ee Ise te Vere er kes te ae aE aa he Sentero ees 175 6 1 IMOCUCHON ennnen nnan a aed a 175 6 2 WTitna Testset e eo ei sewed gate e e e tes taess 175 6 2 1 General Information About Writing Tests 175 6 2 2 Specific Information for Tests 20 0 0 eeeeeeeeeceeeeeeeeeeeee 177 6 32 R nning Tests icc ticcgaciserialevesocets aessadeadessaecsspeed ensedantesumuna deeds 179 T Code DOCUMENLALION 52 4 c2csisteraraceqtuavs
194. solute or relative with a positive or negative offset Sposition new ColumnPosition ColumnPosition TYPE_ABSOLUTE 1 The new columns will be added after the first column Sposition new ColumnPosition ColumnPosition TYPE_ABSOLUTE 2 The new columns will be added just before the last column Sposition new ColumnPosition ColumnPosition TYPE_RELATIVE 158 New Plugins O orlwima iL 3 The new columns will be added just before column column_1 Sposition new ColumnPosition ColumnPosition TYPE_RELATIVE iL Y o wii iL 2 The new columns will be added just after column column_1 2 4 3 2 10 Column Adder Batch public function addColumnAdderBatch S groupiId Stableld ScolumnPosition newColumnIds SinputColumniIds callback Column adder rules used in batch mode allow to add one or more columns to the table while calculating values for all newly added cells Parameter newColumnIds should contain the list of new column IDs Values of columns given in parameter SinputColumnids will be transfered to the callback method for cells content calculation Values for all rows are transfered at the same time Parameter callback should contain a pointer to a callback method with the following signature static function myCallbackMethod table_id array OY abea ya Foolumi iY gt Tva lue Il row Ecolumm 2 Ss tyalue 2 row i 5 WILY SSS Array Veoilivinidt iY Ss Vyenline al eon 21 teplumnn
195. sources files templates images new plugins lt PHP INTERPRETER gt cw3setup php install base url http www example com cartoweb Same as Section 1 1 3 2 1 Basic Setup Existing files are not overwritten 1 1 3 2 4 Cleaning Generated Files Map PDF Temporary Files and Smarty Cache lt PHP INTERPRETER gt cw3setup php clean 1 1 3 2 5 Fetching the Demo Data lt PHP INTERPRETER gt cw3setup php fetch demo 1 1 3 2 6 Install or Reinstall CartoWeb from CVS and Set Up It at Once 1 1 3 2 6 1 Install lt PHP INTERPRETER gt cw3setup php install cvs root pserver anonymous dev camptocamp com var lib cvs public fetch from cvs base url http www example com cartoweb Note Do no execute this command from the cart oweb3 folder Because this will fetch the whole cartoweb3 hierarchy from cvs including the cart oweb3 folder If you executed this from the cartoweb3 folder you would end up with something like cartoweb3 cartoweb3 Instead copy the cw3setup php in the parent directory delete or backup the cartoweb3 folder and execute the command 1 1 3 2 6 2 Reinstall lt PHP INTERPRETER gt cw3setup php install cvs root pserver anonymous dev camptocamp com var lib cvs public fetch from cvs delete existing base url http www example com cartoweb 20 Installation Warning This command will automatically delete the existing cart oweb3 folder Be sure to backup the
196. specific configurations are stored in individual folders Each configuration contains 39 Configuration Files e a Mapserver mapfile myMap map e its annexes symbols fonts images data e amain configuration file myMap ini that must have the same name as the map e smaller configuration files for the plugins By default CartoWeb comes with a fully functional test folder that includes the necessary geometrical datas and allows one to run an out of the box demo 4 3 2 Main Server Configuration File server ini e imageUrl string Path where cartoserver generated images can be accessed e reverseProxyUrl string The url of the reverse proxy if used 4 3 3 Map Configuration Files 4 3 3 1 Introduction The CartoServer has the ability to contains several different maps These maps are represented by the mapserver mapfile the CartoWeb configuration file for the map and each plugins configuration The file that contain the configuration information related to a map is located in the same directory as the mapfile but has a ini extension These files are in the directory server_conf lt myMap gt 4 3 3 2 lt myMap gt ini e mapInfo loadPlugins list list of server plugins to load in addition to the core plugins Note that most server plugins also have a corresponding client plugin that must be loaded on the client side See Section 4 2 client ini e mapInfo initialMapStates See Sec
197. ss Object className gt LayerGroup id gt root label gt root children gt Array 0 gt swiss_layer_1 1 gt swiss_layer_2 minScale gt 0 maxScale gt 0 icon gt link gt aggregate gt rendering gt metadata gt Array 0 gt foo bar 1 gt stdClass Object className gt Layer id gt swiss_layer_1l label gt Swiss Layer 1 children gt Array minScale gt 0 maxScale gt 0 icon gt gfx icons swiss_project swiss icon_l png link gt metadata gt Array 133 Calling Plugins 2 gt stdClass Object className gt Layer id gt swiss_layer_2 label gt Swiss Layer 2 children gt Array minScale gt 1 maxScale gt 20 TOONI gt link gt metadata gt Array locationInit gt stdClass Object className gt LocationInit scales gt Array 0 gt stdClass Object label gt 1 50000 value gt 50000 1 gt stdClass Object label gt 1 100000 value gt 100000 2 gt stdClass Object label gt 1 500000 value gt 500000 minScale gt 25000 maxScale gt 1000000 shortcuts gt Array 0 gt stdClass Object label gt Romandie bbox gt stdClass Object minx gt 475000 miny gt 65750 maxx gt 670000 maxy gt 212000 1 4 2 Getting a Map Using a Point and
198. st List of the project to show in the drop down list If not set all projects found will be used Plugins configuration e loadPlugins list list of client plugins to load in addition to the core plugins Note that most client plugins also have a corresponding server plugin that must be loaded on the server side See Section 4 3 3 2 lt myMap gt ini Internationalization e 18nClass is now deprecated See Chapter 15 nternationalization for a description of the internationalization options and the corresponding configurations e defaultLang string default language possible values are the usual ISO locale codes en fr de e langList list list of usable languages Used to order and restrict the available languages In case you have many languages in directory lt cartoweb_home gt locale and do not want to use them all in your project you may use this parameter to specify a list of languages to use The order in which you input the languages codes will be used to display the languages links in the interface Example 4 1 langList usage langList it de fr The exemple above restricts the availablelanguages to it de and fr They will be displayed in that order in the interface languages list 4 3 Server Configuration Files 4 3 1 Introduction This page describes the configuration options of the CartoServer There is a global configuration file server ini directly in the server_conf folder Then all
199. switching is used see Section 6 2 4 Children Switching one mapfile is generated per switch One more is generated for special switch default This way only auto layers used with the current switch are actually loaded at runtime Mapfile auto mapId all map is still generated In the following example 4 mapfiles are generated autoLayersIndexes indexl index2 index3 index4 Switch 1 Switch 2 switches switchl label switches switch2 label layers layerl className LayerGroup layers layerl children switchl layer2 myAutoLayer_indexl layers layerl children default layer2 myAutoLayer_index2 layers layer2 className LayerGroup layers layer2 children myAutoLayer_index4 e auto mapId all map contains all layers used in layers ini ie layers myAutoLayer_index1 myAutoLayer_index2 and myAutoLayer_index4 e auto mapId switchl map contains layers used when Switch 1 is selected ie layers myAutoLayer_index1 and myAutoLayer_index4 e auto mapId switch2 map contains layers used when Switch 2 is selected ie layers myAutoLayer_index2 and myAutoLayer_index4 e auto mapId default map contains layers used when no switch is selected ie layers myAutoLayer_index2 and myAutoLayer_index4 6 6 Layer Reorder Plugin Ability to reorder displayed layers could be appreciated by end user And so even if your map is well designed with largest features layers on bottom and smallest on top and or even with
200. t imagesRequest gt scalebar gt height 100 Srequest gt imagesRequest gt scalebar gt format Two layers are displayed Resolution attribute is set to null to keep standard Mapserver resolution Srequest gt layersRequest gt className LayersRequest Srequest gt layersRequest gt layerIds array swiss_layer_l Vsnalsce llenyere 2 x Srequest gt layersRequest gt resolution null In this case the location request object is of type zoom point and zoom type is set to ZOOM_SCALE Bbox is unused but is required Srequest gt locationRequest gt className LocationRequest Srequest gt locationRequest gt locationType zoomPointLocationRequest Srequest gt locationRequest gt zoomPointLocationRequest gt bbox gt minx 500000 Srequest gt locationRequest gt zoomPointLocationRequest gt bbox gt miny 100000 Srequest gt locationRequest 135 Calling Plugins gt zoomPointLocationRequest gt bbox gt maxx 600000 Srequest gt locationRequest gt zoomPointLocationRequest gt bbox gt maxy 200000 Srequest gt locationRequest gt zoomPointLocationRequest gt point gt x 550000 Srequest gt locationRequest gt zoomPointLocationRequest gt point gt y 150000 Srequest gt locationRequest gt zoomPointLocationRequest gt zoomType ZOOM_SCALE Srequest gt locationRequest
201. t on which no information is needed 1 2 Call to getMapInfo This method returns server configuration which includes layers initial states and other plugin specific configuration Variables returned by this method are set in server configuration files described in Part II User Manual 1 2 1 Global Server Configuration 112 Calling Plugins This includes layers configuration and initial states lt complexType name LayerState gt lt all gt lt element name id type xsd string gt lt element name hidden type xsd boolean gt lt element name frozen type xsd boolean gt lt element name selected type xsd boolean gt lt element name unfolded type xsd boolean gt lt all gt lt complexType gt e id layer state ID e hidden if true layer isn t displayed in tree and attribute selected cannot be modified e frozen if true layer is displayed in tree but attribute selected cannot be modified e selected if true layer is displayed as selected in tree e unfolded if true layer tree is displayed unfolded layer groups lt complexType name ArrayOfLayerState gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types LayerState gt lt restriction gt lt complexContent gt lt complexType gt e array list of layer states lt complexType name InitialLocation gt lt all gt lt element name bbox type
202. tadacuatas 44 5 2 WSDL Cahe sisena snien n ann a a edie 44 3 3 M pinfo CANE sc cocssctoraytuaytuarsasatesaahaucenne e a t a SE ne 44 5 4 MapResult Cache secricsinsiisidingai siinsesse 45 5 3 XML SOAP CAG Aennean an eai iiia 45 5 6 Caches Configuration ssssssesssesessseessresseesseesseresssessseessresseessee 45 5 6 1 Rationale eia t a Tel Sate See Rah pate i i 45 5 6 2 Client and Server Cache Options ssesssesssssessseesssesseessee 45 5 6 3 Server Cache Options ssesssessssssesssessessseeesseesssressresseessee 45 6 Layf Sie a A n a A E ase eae 47 GL Introduction Sesrnse ceistean esse i a eneses 47 6 2 Hierarchy of Layers and Rendering 00 eee eeeceeceeeeeeeteeeeeeeees 47 6 2 1 Layers and LayerGroups sciss cjonecd eSaveracadetedeiartecsanvenesoune 47 6 2 2 Layers Opuons j cuaushiGunnnddniediaadies ninia 47 6 2 3 LayerGroups Options yicsksde4esdaensiaesledaies eavenacaeenghcdseeesocsaes 48 6 2 4 Children Switching esssessseesessesseessesssessseessseessresseessee 50 6 3 Metadata in Mapfile and layers ini 0 0 eee eeeeeeeeeeeeeeeeeeeeeeees 50 6 3 1 Metadata in Mapfiles 5 siicssessasesticesasasusesd vestccees seaeaastdapsace 50 CartoWeb Documentation 6 3 2 Metadata in layers ini so cis ace siayauciyads iseasacaseansdadsccdedendacvaets 51 6 3 3 Using the metadata fields in templates layers tpl 51 GA Layers Legends sietst laveyieveatenessseadquas a oe ESE OE 52 6 3 A to Layers d
203. ters see Section 1 3 5 1 2 Pan Request e zoomPointLocationRequest zoom recenter on point parameters see Section 1 3 5 1 3 Zoom Point Request e recenterLocationRequest recenter on IDs parameters see Section 1 3 5 1 4 Recenter Request e locationConstraint constraint to be respected when location request is executed 1 3 5 1 1 BBox Request lt complexType name BboxLocationRequest gt lt all gt lt element name bbox type types Bbox gt lt all gt lt complexType gt e bbox bounding box to be recentered on see Section 1 1 2 Shapes for a description of type Bbox 1 3 5 1 2 Pan Request lt simpleType name PanDirectionType gt lt restriction base xsd string gt lt enumeration value VERTICAL_PAN_NORTH gt lt enumeration value VERTICAL_PAN_NONE gt lt enumeration value VERTICAL_PAN_SOUTH gt lt enumeration value HORIZONTAL_PAN_WEST gt lt enumeration value HORIZONTAL_PAN_NONE gt lt enumeration value HORIZONTAL_PAN_EAST gt lt restriction gt lt simpleType gt VERTICAL_PAN_NORTH panning north VERTICAL_PAN_NONE no vertical panning VERTICAL_PAN_SOUTH panning south HORIZONTAL_PAN_WEST panning west HORIZONTAL_PAN_NONE no horizontal panning HORIZONTAL_PAN_EAST panning east lt complexType name PanDirection gt 124 Calling Plugins lt all gt lt element name verticalPan type types PanDirectionType gt lt element name
204. the default behavior After initial CartoWeb installation client_conf exportCsv ini is set as follows Separator between each value default is en separator delimiter before and after each value default is double quote special characters 5 double quote textDelimiter double quote file name format for exported CSV file default is table date dMY csv fileName date Ymd Hi _ table csv if true exported CSV file will be UTF 8 encoded if false it will be ISO 8859 1 encoded default charsetUtf8 false 11 4 Image Output CartoWeb enables to return a raw image map with no HTML It is not an export plugin and thus has not to be activated anywhere CartoWeb simply needs to receive a mode image REQUEST parameter GET or POST For instance http your cartoweb3 recenter_x 123456 amp recenter_y 654321 show_crosshair 1 amp mode image 71 PDF Export 12 PDF Export 12 1 Introduction This chapter describes how to configure PDF export using client_conf exportPdf ini parameters First part Section 12 2 Configuration Reference is a comprehensive reference of user available configuration parameters Second part Section 12 3 Tutorial is intended to be a small tutorial giving explanations and examples about how to configure the PDF exportation tool 12 2 Configuration Reference 12 2 1 General Configuration Parameters are named using a lt object gt lt pro
205. ther the data by launching the cw3setup php with the fetch demo option On the other hand the demoPlugins project uses plugins that work with databases Consequently some databases settings and configuration are required We describe here how to install these databases and how to use cw3setup php Step by step guide 1 Install PostgreSQL with PostGIS support Prerequisite Postgresql gt 8 0 Note If you are on Debian you can have a look at Appendix A Mapserver Debian Installation 2 Create a PostgreSQL database using the following command createdb demo_plugins 3 Integrate PostGIS functionalities in this database Typically you can type createlang plpgsql demo_plugins 24 Installation psql d demo_plugins f lwpostgis sql psql d demo_plugins f spatial_ref_sys sql Note psql is a terminal based front end for PostgreSQL It enables you to type in queries interactively issue them to PostgreSQL and see the query results Don t forget to specify its location on your system to use it If the wpostgis sql and spatial_ref_sys sql files aren t in the current directory you have to specify their path Create tables used by the DemoLocation extension to allow you to do a search by name To do so you should export the free downloadable layers airport agglo district and town in PostgreSQL PostGIS tables by typing the following command S shp2pgsql aerofacp shp airport gt tmp aiport sql
206. thod with the following signature static function myCallbackMethod table_id table_title return table_new_title 2 4 3 2 5 Column Filter public function addColumnFilter groupId tableId ScolumniId callback Column filter rules allow to modify column title Parameter caliback should contain a pointer to a callback method with the following signature static function myCallbackMethod table_id column_id column_title return column_new_title 2 4 3 2 6 Cell Filter public function addCellFilter groupiId StableId columnId SinputcColummids Scallback Cell filter rules allow to modify content of a cell Values of columns given in parameter inputColumnIds will be transfered to the callback method for cell content calculation Parameter caliback should contain a pointer to a callback method with the following signature static function myCallbackMethod table_id column_id array Veoikbtiag a Ss Vyenhoe iy column_2 gt value_2 return cell_value 2 4 3 2 7 Cell Filter Batch public function addCellFilterBatch groupId tableId columniId SinpulColumnids Scallback Cell filter rules used in batch mode allow to modify content of all cells of a given column Values of columns given in parameter inputColumnIds will be transfered to the callback method for cells content calculation Values for all rows are transfered at the same time Parameter caillback should contain a pointer to a
207. tion 10 1 1 outline ini Here are the options that can be set on the client e multipleShapes boolean if true the user is allowed to draw multiple shapes That means that drawn features remain until browser session is closed If false will outline only one shape at a time new feature simply erases overrides currently drawn one When he wants the user can erase all the drawn feature by clicking on the outline_clear form button default true e labelMode boolean if true user is asked to input a label text that is drawn to annotate drawn shape e weightOutlinePoint integer defining display order of the outline_point tool icon in toolbar if not specified default to 70 A negative weight disables the tool e weightOutlineLine see weightOutlinePoint default to 71 e weightOutlineRectangle see weightOutlinePoint default to 72 e weightOutlinePoly see weightOutlinePoint default to 73 10 2 Server side Configuration 10 2 1 outline ini Here are the options that can be set on the server 67 Annotation and Redlining e pointLayer defines the name of the mapserver LAYER set in the mapfile to display points If not set the polygon layer is automatically used instead e lineLayer defines the name of the mapserver LAYER set in the mapfile to display lines e polyLayer defines the name of the mapserver LAYER set in the mapfile to display polygons Note that rectangles are displayed as polygons e maskColor d
208. tion 4 3 3 3 Initial Mapstates 4 3 3 3 Initial Mapstates Initial map states set the initial aspects of the layers selection interface when starting using CartoClient un folded nodes selected layers Some of these properties are not modifiable in the layers selection interface hidden layers for instance and thus stay unchanged throughout the session Several initial map states can be created in myMap ini but at least one must be present Each one is identified by a unique initialMapStateld The choice to activate one or another is done client side in client_conf client ini 40 Configuration Files Available properties and syntax for layers in initial map states are e mapInfo initialMapStates initialMapStateld layers layerld selected truelfalse if true layer is initially selected e mapInfo initialMapStates initialMapStateld layers layerld unfolded truelfalse if true the layerGroup is represented as an unfolded node children layers are visible e mapInfo initialMapStates initialMapStateld layers layerld hidden truelfalse if true this layer and its children are not shown in the layers list but are still displayed on the map if they re activated e mapInfo initialMapStates initialMapStateld layers layerld frozen truelfalse if true this layer and its children as well is listed in tree but without checkbox Its selection status defined by selected property thus cannot be changed Examp
209. to a special export request For instance plugin Image uses ExportConfiguration object to know if maps are needed by export plugin If not image request is modified 2 4 1 5 Example Plugin exportCsv is a good simple example of export plugin Configuration is filled in method get Configuration No images are required to output a CSV file protected function getConfiguration Sconfig new ExportConfiguration Sconfig gt setRenderMap false Sconfig gt setRenderKeymap false Sconfig gt setRenderScalebar false Result rendering is done in method getExport Note that no calls to methods get LastMapRequest Or adjustExportMapRequest are needed as those calls are handled by method getExportResult protected function getExport Sthis gt getExportResult this gt getConfiguration Vi asa Soutput new ExportOutput Soutput gt setContents contents 152 New Plugins return output Final output headers content is done in method output For instance publie function sutpurd header Content Type text html print Sthis sgetBxport SgetContents rECUrM ie 2 4 2 Filters Filter plugins can be used to modify parameters transfered from browser to CartoWeb client These parameters can be part of a POST request HTML forms or a GET request URL query string Once a new filter plugin has been developed it can be activated by adding it to the loadPlugins var
210. types Bbox gt lt all gt lt complexType gt e bbox initial bounding box see Section 1 1 2 Shapes for a description of type Bbox lt complexType name InitialMapState gt lt all gt lt element name id type xsd string gt lt element name location type types InitialLocation gt lt element name layers type types ArrayOfLayerState gt lt all gt lt complexType gt 113 Calling Plugins e id initial state ID e location initial location e layers list of layer states lt complexType name ArrayOfInitialMapState gt lt complexContent gt lt restriction base encll Array gt lt attribute ref encll arrayType wsdl arrayType types InitialMapState gt lt restriction gt lt complexContent gt lt complexType gt e array list of initial states lt complexType name MapInfo gt lt all gt lt element name timestamp type xsd integer gt lt element name mapLabel type xsd string gt lt element name keymapGeoDimension type types GeoDimension gt lt element name initialMapStates type types ArrayOfInitialMapState gt elements specific to plugins lt all gt lt complexType gt e timestamp timestamp of last update This timestamp is transferred each time method getMap is called so client knows when configuration was modified see also Section 1 3 1 1 Global Request e mapLabel name of map as defined in mapfile e keymapGeoD
211. u can not see the extension in the list you will need to add it manually extension php_soap dll extension php_curl dll extension php_gettext dll The corresponding DLL files must be present in the extensions folder of PHP It should be c wamp php ext by default If you can not find it look in the PHPINFO local value for parameter extension_dir visible in php ini as well you will notice something like C wamp php ext e Restart Apache left click on the WAMP icon in the systray gt Apache gt Restart Service e Check in the PHPINFO if the new extensions loaded correctly look for a section with their name B 2 Mapserver Mapscript Install You need a Mapscript version compiled for PHP5 Win32 You can get one here http www maptools org dl mapserver 4 5 win32 php5 0 3 zip If the link doesn t work go to http dl maptools org dl and look for mapserver 4 5 win32 php5 0 3 zip or newer Note MapServer for Windows PHP3S archives are also available on CartoWeb website at http cartoweb org downloads html msw Additional instructions for installing DLL s are given in the matching README txt files e Once you have downloaded the archive uncompress it in any directory e The README txt included in the archive tells you where you must place the various files o Unzip gdal 1 2 5 zip libcurl 7 10 7_dll zip xerces_dll zip ECW_DLL zip pdfdll zip libpq zip in C WINNT System32 if you are using Windows 2000 NT c Wi
212. uery server ServerMapquery php call Common cartowebErrorHandler file 222 var www cartoweb3 coreplugins mapquery server ServerMapquery php call ServerMapquery queryByBbox file 248 var www cartoweb3 coreplugins query server ServerQuery php call ServerMapquery gt queryByBbox 8 Undefined property ServerMapquery ScurrentQeury var www cartoweb3 coreplugins mapquery server 222 Array 2 file 369 var www cartoweb3 coreplugins query server ServerQuery php call ServerQuery gt queryLayer polygon Object Bbox file 58 var www cartoweb3 server ServerPluginHelper php call ServerQuery gt handlePreDrawing Object Bbox Object QuerySelection file 96 var www cartoweb3 server ServerPluginHelper php call ClientResponderHelper gt callHandleFunction Object QueryRequest 8 3 2 Using Direct for More Verbosity In some situations a fatal error on the server will display a message with not much verbosity Failure class SoapFault message parse error unexpected T_VARIABLE The fact no line number and Php file is displayed is a limitation of the Php SOAP implementation workarounds are welcomed In such a situation a solution for this problem is to enable the CartoWeb direct access 186 Logging and Debugging mode of operation Direct access mode is set with the cartoserverDirectAccess parameter of the client_conf client ini configuration file For more detai
213. ugins implementing Sessionable interface may be saved in views Because CartoWeb and its plugins evolve views might become outdated after some time Plugin session containers may change properties may be added removed renamed etc and thus shifts between old views and new plugin session formats appear Those shifts then prevent some views from correctly displaying or even make CartoWeb crash However CartoWeb offers upgrade tools to read outdated views 10 2 Upgrade Tools 10 2 1 Views Versions Plugins session data are saved in views in separated XML elements Each element records the plugin session container version Plugin session container version must be incremented whenever a change is applied on the container format new property name change etc Container version if not specified defaults to 1 To explicitely update it add following constant definition before container declaration define PLUGINNAME_SESSION_VERSION 3 where PLUGINNAME is the uppercased plugin name Container versions are always integers 10 2 2 Upgrade Filters Upgrading a view is done by sequentially applying filters each one updating it to the following version from version N to version N 1 If matching sequence cannot be detected missing filters upgrade is aborted and outdated data is discarded Current plugin data is then used instead Upgrade filters are PHP classes extending ViewUpgrader the latter class being defined at the end of
214. upper limit materialized by the page or the parent block available extent If the max extent is reached line feeds will be added automatically to the cells contents The height parameter gives the height of a single lined row and not the total table height Note that if a table is too high to fit a page page breaks will automatically be added Caption and headers are described using separated blocks They are specified by filling the table block caption and headers fields with the matching blocks ids Since they are not standalone there is no need to activate the blocks in the general activatedBlocks list That way it is possible to set the caption and headers layouts separately from the general table one which is their default layout Note that these subblocks are optional and will not be displayed if no content can be determined for them The same headers and caption subblocks can be shared amongst several table blocks CartoWeb output table content and its caption and headers subblocks is automatically determined But it is also possible to user define independent tables by filling the table and its caption headers content cells content are represented as comma separated string lists only one row available for table data For instance blocks queryResult type table blocks queryResult inNewPage true blocks queryResult caption tableCaption blocks queryResult headers tableHeaders blocks queryResult height 10 blocks que
215. validator w3 org http validator w3 org 170 Code Convention XHTML standing for eXtensible Hypertext Markup Language was chosen vs simple HTML for following reasons e XHTML is aimed to replace HTML e XHTML is a stricter and cleaner version of HTML e XHTML is HTML defined as an XML application For more information on XHTML reference and tutorial are available here http www w3schools com xhtml Specially useful pages are e Differences between HTML and XHTML http www w3schools com xhtml xhtml_html asp e XHTML syntax http www w3schools com xhtml xhtml_syntax asp But here are some things people must know to get XHTML valid generated pages 5 4 1 Nesting In HTML some elements can be improperly nested within each other like this lt b gt lt i gt This text is bold and italic lt b gt lt i gt In XHTML all elements must be properly nested within each other like this lt b gt lt i gt This text is bold and italic lt i gt lt b gt All XHTML elements must be nested within the lt html gt root element All other elements can have sub children elements Sub elements must be in pairs and correctly nested within their parent element The basic document structure is lt html gt lt head gt lt head gt lt 0 CVE ana SIOR lt html gt 5 4 2 Lower Case This is because XHTML documents are XML applications XML is case sensitive Tags like lt br gt and lt BR gt are interpreted as different ta
216. ves the list of the selected layer class icon couples Content is automatically retrieved according to selected layers You only need to set the text formatting and row height as for a table block Legend blocks does not provide any table like headers or caption You can avoid that a given set of layers be displayed in the legend blocks no change on the maps by listing the forbidden layers ids in the legend block content men parameter prefixing each layer id with an exclamation point For instance blocks legend content background layer3 Note the double quotes around the content value that contains special characters such as 1 Two behavior are offered to the visitor embedding the legend block in the map or printing it in a separated page First case is OK when there is little legend items to print block is limited to one column whereas the second possibility enables to display lots of legend items using several columns if needed In the map embedded case if the overview map is printed the legend block width will be automatically set to the overview width value For instance blocks legend type legendp blocks legend zIndex 1 blocks legend weight 40 blocks legend fontSize 8 88 PDF Export blocks legend height 5 blocks legend width 50 blocks legend padding 1 5 blocks legend verticalMargin 10 blocks legend horizontalMargin 10 blocks legend content nix 12 3 4 Roles Man
217. well used transparent properties The plugin layerReorder is designed to do so Layers could be reorder on the displayed stack to improve visibility of one layer Each layer defined in the mapfile and currently selected in legend menu and only them will be displayed in the reorder menu list 6 6 1 Plugin activation To activate the plugin add it to loadPlugins from Both CartoClient and CartoServer configuration files client_conf client ini and server_conf lt mapId gt lt mapid gt ini For instance 55 Layers loadPlugins layerReorder 6 6 2 Layer exclusion If you want to exclude some layers and then not allow them to be reordered have a look on client_conf layerReorder ini You will be able to exclude some layers and to choose to keep them on bottom or on top To do so use the following configuration parameters e topLayers list of all layerlds to keep on top of the genererated map Layerlds must be comma separated e bottomLayers same as previous one but obviously keep these layerlds on bottom Useful for example with a raster background layer 6 6 3 Transparency selector You could also add a transparency selector on each layer displayed with this plugin End user will so be able to choose a different transparency level for each displayed layer To activate it set enableTransparency tO true in client_conf client ini Default transparency selector values are 10 20 50 75 and 100 You could
218. xport maps and data from the viewer ie the CartoWeb user interface in order to print them or to save them on the user s computer Four formats are available PDF CSV HTML and raw image The PDF export plugin is precisely described usage configuration in next chapter Chapter 12 PDF Export 11 2 HTML Export The exportHtm1 plugin outputs an HTML simplified version of the viewer main map keymap and layers list It is often launched by clicking on a HTML print link or button and opens a new browser window It is specially useful to quickly basic HTML layout same maps used than in viewer display raw maps in order to print them No configuration is required To enable or deactivate this plugin simply add or remove exportHtm1 from the loadPlugins parameter in client_conf client ini For instance ove exportHtml is listed as activated loadPlugins auth outline exportHtml ancl To customized the exported page layout simply edit the plugin template file exportHtml templates export tpl It is recommended not to modify the regular template file but to override it in a project version of the exportHtm1 plugin For more info about projects see Section 2 4 Projects To get advanced printing capabilities rather use the CartoWeb PDF export plugin export Pdf described in next chapter 11 3 CSV Export The exportcsv plugin enables to export tabular data from various queries results in a comma separated CSV or
219. xt2 content myText2 block nis multilined Text blocks content may also be retrieved from external data source such as text files or databases using following syntaxes Connection parts are separated by a First part indicates what medium filelab is used e file file source blocks myText content file my source file path The source file path can either be a absolute URL or a filesystem path Relative filesystem paths are allowed and are based on the CartoWeb root path For instance 84 PDF Export blocks myText content file http myserver mysourcefile txt blocks myText content file cC mydir mysourcefile txt blocks myText content file home johndoe mysourcefile txt blocks myText content file www data mysourcefile txt If your source file contains several lines or n strings the generated block will also be multilined e db database source blocks myText content db DSN SQL query The DSN Data Source Name gives the database connection parameters Any DSN format supported by PEAR DB can be used See PEAR DB manual for more info about DSNs at http pear php net manual en package database db intro dsn php Note that you can call any database server type as long as it is supported by PEAR DB and that your PHP distribution has the matching extension enabled For security reasons only SELECT SQL queries are allowed but there is no other limitation On the other hand the query results are basic
220. y php net docs php 16 2 Internationalization It is possible and recommended to use the SmartyGettext http smarty incutio com page SmartyGettext tool in order to translate template embedded textual strings Texts to be translated are identified using the t tag lt p gt t Default text please translate me t lt p gt lt p gt t name John Doe Hello my name is 1 t lt p gt lt p gt t l one 2 two 3 three The lst parameter is 1 the 2nd is 2 and the 3nd 3 t lt p gt It is also possible to use the Itr smarty modifier if you want to apply some Smarty transformations on a translated string assign var label value Themes lt div if label tr count_characters true lt 10 style width 72px if gt Slabel tr lt div gt See also Chapter 15 Internationalization 16 3 Resources Resources are identified using the r tag r tags have a mandatory type attribute and an optional plugin one First attribute is used to indicate the relative file location files are grouped by types in the file system whereas the second one tells what plugin uses the resource Filename is placed between opening and closing tags For instance to get the logo png file located in htdocs gfx layout type in your template lt img srce r type gfx layout logo png r alt gt 105 Templating To get the zoom in icons from the location plugin type lt img src r type gfx plugin location zoom_in gif
221. y the maps main overview the scalebar and other user defined pictures such as logos or diagrams Except for system image blocks maps scalebar the image file location must be specified in content using either an absolute URL or an absolute path within the server file system It is also possible to use a relative file path based on the CartoClient root directory eg ht docs gfx layout c2c png width and height have to be set by the user For instance blocks logo type image blocks logo content http server gfx layout c2c png blocks logo width 40 blocks logo height 7 blocks logo padding 2 blocks logo parent mainmap blocks logo horizontalBasis right blocks logo inFlow false blocks logo horizontalMargin 5 blocks logo verticalMargin 5 Tip If you want to switch the image file depending on the used language set the block i18n parameter to true and add languages matching URLs filepathes to your PO files 12 3 3 5 Table Blocks Tables blocks are used to represent tabular data such as query results A table is composed of a caption row title a headers row columns fields titles and one or more data rows All cells can only contain textual content 86 PDF Export The table block describes how data cells will be rendered font text color background color using the same parameters than for text blocks The table width will be computed according to the cells content with a
Download Pdf Manuals
Related Search
Related Contents
Guide to Health & Safety Risk Assessment プロフェッショナル監視カメラシステム 多様化する監視ニーズにお応えする Haier 0010515690 Air Conditioner User Manual Asrock Z77 Extreme11 Philips Brilliance LCD widescreen monitor 240S1SB 閲覧する(PDF 8.75MB) - 桧家オーナーズクラブ Hammerhead Manual.qxd Copyright © All rights reserved.
Failed to retrieve file