Monday, November 5, 2007

Safe Oral Gel In Pregnant

dynamic PHP-mapscript for mapserver. Part 1: Concepts Web

Creative Commons License

This work is licensed under a Creative Commons .

© 2007 Jaime M. As Nozawa. You are free to copy, distribute and transmit the work and make derivative works under the following conditions: a) You must give the original author. b) can not use this work for commercial purposes (including publication by any means, for-profit entities). c) If you alter, transform this work or creates a derivative work, distribute the work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the owner of the copyright. The rights under fair use and other constraints are not affected by the above. Complete license in Castilian . The information contained in this document and the derivatives thereof are provided as they are, the authors assume no liability if the user or reader of these misuses.


What is MapServer?
MapServer is a development environment open source (Open Source Initiative ) for creating GIS applications in Internet / Intranet to view, query and analyze geographic information through the network using Internet technology Map Server (IMS).

Its main features are:

Source: wikipedia

What is PHP / mapscript?
PHP / mapscript is a PHP module that allows access to the MapServer API. These functions and classes would be available within our development environment. The module was developed and is currently maintained by the company
DM Solutions Group.

mapscript Family is refresentada as the next tree (source of data here ):
 
  MapServer  
/ \\
/ \\
/ \\
PHPMapScript \\ SWIGMapScript
PHP4 + - ---+-----+----+----+----+
is closer to MapServer and therefore more native in the implementation of our applications.
the mapfile
The MapServer is characterized by a configuration file named mapfile that has the extension point map (. Map). Here you define the data to be used by our application as mentioned below: layers, types and their configuration data source origin and method of serving data, legend and projections, and many other settings that you want

loaded at startup.
For this reason, we could say that the heart of MapServer is configured through a text file that is used in time implementation. Under the developer's perspective can be presented as a hierarchy of objects with a primary parent and many child objects that derive from it.
MapServer CGI Notes: Although this is not the aim of our paper, how to use CGI mapserver as the more traditional and usually used in the tutorials found on the Internet. MapServer CGI works through HTML templates (templates) and low basic reference rigid structures. That the. Map is of vital importance for the initialization of the layers.


The PHP mapscript breaks it rigidity. Map (for loading the layers configured in him the initialize) and can modify, change or even add more layers as we wish. This means that if you have a layer of green inactive, we can modify it to red and active. Do approach or consult relevant data.



Requirements to develop


Web Server: Apache or IIS with PHP and PHP module of mapserver-mapscript

Bookstores: Proj4, OGR, GDAL and utilities that we will require
  1. Data Source: shape files, PostGIS or other source OGR

  2. A Mapfile (. map)
  3. An editor ID text or PHP preferred.
  4. Basic knowledge of Geodesy and GIS, and most importantly, eager to learn

  5. We are lucky because the requirements 1,2,3 and Windows are included in a package called ms4w and you can get
  6. here.
  7. For those who are into Linux, you will find plenty of packages for both compiler and Ubuntu, Debian or Fedora. Intalarían only for the debs or rpms. On the other hand, Linux could also use a package called FGS and is
  8. here.
If installing on Linux becomes somewhat difficult, may request to review an article on creating only the installation.


A basic example:


ejemplo01.php

1 \u0026lt;? Php

2 / / ejemplo01.php
3 / / Jaime M. As Nozawa
4 5
/ / Load MapScript extension. Check if the extension is already loaded by default. 6
if (!
extension_loaded
( "MapScript"
)) dl ( 'php_mapscript. " . PHP_SHLIB_SUFFIX ) 7 8 / / instantiate a new object: map object. The constructor must receive at least the parameter file location.
map 9
$ JMap
=
ms_newMapObj (
"ejemplo01.map" ) 10 11 / / Rendering
12
$ jImagen
= $ JMap
->
draw (); 13 14 / / create and capture the rendered image path. 15

$ url_imagen
=
$ jImagen ->
saveWebImage (); 16 ?> 17
\u0026lt;HTML>
18 \u0026lt;HEAD>
19 \u0026lt;TITLE> Example 1 \u0026lt;/ TITLE>
20
\u0026lt;/ HEAD> 21
\u0026lt;BODY> 22
\u0026lt;IMG SRC = \u0026lt;? Php echo
$ url_imagen
; ?> > 23 \u0026lt;/ BODY> 24 \u0026lt;/ HTML>

ejemplo01.map




MAP NAME SIZE Pruebas
extents 600 400 -63 114 -87.9964 -19.0216 1.19528 WEB ImagePath " C: / ms4w-php5/tmp/ms_tmp / " ImageUrl" / ms_tmp / "END


LAYER NAME "Departments"

STATUS ON DATA "Lim_dep.shp" TYPE POLYGON


CLASS STYLE COLOR 200 150 2

OutlineColor 0 0 0 END


END END END



In the. Map any entry is similar to HTML tags because they have a beginning and an end. The Mapfile estonces consists of objects and others which it contains.


structure mapfile objects would be as follows (Source: Tutorial MapServer 4.x): MAP











 
+----+-----+----+----+----+
ImageURL "/ ms_tmp /"
END This specifies the routes where they are creating the rendered images. Here are settings that are saved in: C: / ms4w-php5/tmp/ms_tmp / (Change this one in your conviencia). Remember that this folder should be able to be accessed publicly through / ms_tmp /. (The ms4w and automatically configures an Alias \u200b\u200bin Apache - httpd.conf: Alias \u200b\u200b / ms_tmp / / ms4w-php5/tmp/ms_tmp /
 -) 

That means if we create a file:
C: / ms4w-php5/tmp/ms_tmp/prueba.gif be accessed as http://localhost/
 
ms_tmp /
 
prueba.gif


IMPORTANT: Each time you access our PHP script: Ejemplo01.php, will realize that it automatically creates a GIF or JPG image with a random name . That is the image that is displayed to the navigator and is captured in the variable $ url_imagen.

The MAP has the following attributes
EXTENT SIZE 600 400 63 114 -19.0216 1.19528 -87.9964

Specifies the size of the image (gif or jpg self-generated) and its Extent.
The Extent specifies the limit of coordinates which will display the map. In the case of Peru, as we are in the WEST - SOUTH ... corresponding points: lower-left (
-87.9964 -19.0216



) and upper-right (
1.19528 63 114 ). My analogy with trigonometry in mathematics, like we're in the third quadrant
.
The Layer object is contained within the MAP order. And in the Layer CLASS
LAYER NAME "Departments" STATUS ON DATA "Lim_dep.shp" TYPE POLYGON CLASS




STYLE




COLOR 200 150 2 OutlineColor 0 0 0

END







END END
     see that our layer called "Departments" shape file charges   polygon type ... and colors RGB (200 150 2) through the style object that is within the Class object. 
STATUS ON: that the layer is active and is displayed by default.
Result:
Annex link Shape File:
Lim_dep.shp

0 comments:

Post a Comment