Documentos de Académico
Documentos de Profesional
Documentos de Cultura
TallerdeSistemasdeInformacinGeogrfica MapServer
Objetivos
RasteryVector
Ambostrminosserefierenatiposespecficos dedatos.
RasteryVector
LosVectoressonrepresentadoscomo coordenadas
OpenEV
EsunpotentevisordeEscritorio.Permite explorarlosdatosdecualquiertipode imgenes(rasterovector)soportadasporla librera(GDAL/OGR). OpenEVprovieneconelpaqueteFWTools: http://fwtools.maptools.org http://openev.sourceforge.net/ Esunbuenejemplodecmopueden accedersealasfuncionesdeGDAL/OGR empleandootroslenguajesyaqueestescrito sobrePhyton
OpenEV
MapServer
MapServerVentajas
AccesoadatosyPerformance
Portabilidad $0.00
GDAL
GDAL
Tienecuatrocaractersticasprincipales:
Variedad:Soportamasde40formatosraster Abstraccin:Cualquieraplicacinqueemplee GDALaccedeautomticamenteaesos40formatos Herramientas:Lasherramientasqueemplean GDALposiblementeahorrenesfuerzosde programacin. Funciones:Susfuncionespuedenserempleadas porprogramadoresdedistintoslenguajes:C,C++, Phyton.Paraotroslenguajes,puedeemplearse SWIG(Perl,Java,PHP,Ruby,etc.)
GDAL
GDALUtilidades
GDALUtilidades
gdalinfo:Nosbrindainformacinacercadel archivodelaimagenraster
#gdalinfovancouver.tif Driver:GTiff/GeoTIFF Sizeis1236,1028 CoordinateSystemis: PROJCS["NAD83/UTMzone10N", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS1980",6378137,298.2572221010042, AUTHORITY["EPSG","7019"]], AUTHORITY["EPSG","6269"]], PRIMEM["Greenwich",0], UNIT["degree(suppliertodefinerepresentation)",0.01745329251994328],
OGR
OGRUtilidades
ogrinfo ogr2ogr
PostGIS
PostGIS
SeleccionarlospaseslimtrofesaArgentina SQL:
SELECTnombre_de_pais frompaisa,paisb whereb.nombre='Argentina' anda.wkb_geometry&&b.wkb_geometry
MapServerFuncionamiento
Porlogeneral,MapServertrabajadetrsdeun WebServer.
MapServer
MapServer
MapServer
Enlafiguraanteriorsemuestraunejemplode superposicindecapas. Cadaunodeloscheckboxseleccionados representaunacapaqueessolicitadaa MapServerparaqueseapresentadaenla imagendelaizquierda. Cadacapaestomadadesdeunorigen independiente(tambinpuedeserelmismo). Elprocesoderenderingserealizacadavez quesesolicitaunnuevomapaaMapServer.
MapServer
MapServer
MapServer
MapServerMapfile
Bsicamenteesunarchivodeconfiguracinde textoqueenumeralaformadedibujare interactuarconelmapa. Incluyequecapasdebendibujarse,elsistema deproyeccin,elformatodeimagendesalida, siseempleanleyendas,barrasdeescala,etc. Cuandoserealizaunasolicitudauna aplicacinMapServer,debeespecificarseque archivodemappingdebeemplearseparaque aspuedaconstruirelmapa.
MapServerMapfile
MAP SIZE600300 EXTENT1809018090 LAYER NAMEcountries TYPEPOLYGON STATUSDEFAULT DATAcountries.shp CLASS OUTLINECOLOR100100100 END END END
MapServerDatasource
MapServerInstalacin
Windows Linux
Repositorios Compilado
LinuxCompilado
Compilamostodaslalibreriasrequeridas.
Generalmente(dependedecadalibreria)
Unavezcompiladaslaslibrerias:
Segenerarelarchivoejecutablemapserv
LinuxCompilado
Algunasopcionesdecompilacin:
./configure \ --with-proj=/usr/local/proj-4.6.0 \ --with-geos=/usr/local/bin/geos-config \ --with-ogr=/usr/local/bin/gdal-config \ --with-gdal=/usr/local/bin/gdal-config \ --with-postgis=/usr/local/pgsql/bin/pg_config \ --with-curl-config=/usr/bin/curl-config \ --with-httpd=/usr/sbin/httpd \ --with-php=/usr/include/php \ --with-wfs \ --with-wfsclient \ --with-wmsclient \ --enable-debug \ --with-threads \ --with-wcs \ --with-wcsclient \ --with-sos \ --with-gd \ --with-freetype \ --with-jpeg \ --with-agg=/usr/local/
LinuxUbuntuRepositorio
Actualizamoslasfuentes
Esposiblequetengamosqueeditar/etc/apt/sources.list aptgetupdate
Buscamoslospaquetesdemapserver
InstalamoslospaquetesdeMapServer
aptgetinstallcgimapservermapserverbinphp5 mapscript
Pordefectoseinstalaen/usr/lib/cgibin
LinuxCompilacinvs Repositorio
Repositorios
Compilacin
MS4WWindows
PaqueteMS4W,disponibleen:
http://www.maptools.org MapServerFor(4)Windows
ApacheHTTPServerversion2.2.10 PHPversion5.2.6 MapServerCGI5.2.1 MapScript5.2.1(CSharp,Java,PHP,Python) GDAL/OGR1.6.0RC2andUtilities MapServerUtilities PROJUtilities OGR/PHPExtension1.0.0
Contiene
MS4W
UnavezdescargadoelarchivodeMS4W
MS4W
http://localhost/
MS4W
http://localhost/cgibin/mapserv.exe
MS4WHerramientas
Ejecutardesdelneadecomando
c:\ms4w\setenv.bat
MS4WAplicaciones
OGR
ogrinfo ogr2ogr
MS4WAplicaciones
c:\ms4w\apps\lapampa
mapas\*.shp ogrinfosomapaspob0003a_Project
MS4WAplicaciones
INFO:Openof`mapas'usingdriver`ESRIShapefile'successful. Layername:pob0003a_Project Geometry:Point FeatureCount:7155 Extent:(3232375.578346,5570103.035091)(3772862.020105, 6127358.845214) LayerSRSWKT: PROJCS["Argentina_Zone_3", GEOGCS["GCS_Campo_Inchauspe", DATUM["Campo_Inchauspe", SPHEROID["International_1924",6378388.0,297.0]], PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]], PROJECTION["Transverse_Mercator"], PARAMETER["False_Easting",3500000.0], UNIT["Meter",1.0]] UNION:Real(11.0) NOMBRE:String(45.0) TIPO:String(50.0) PROVINCIA:String(60.0) DEPARTAMEN:String(40.0) HABITANTES:Real(11.0) PAIS:String(15.0) OBSERVACIO:String(50.0) HOJA:String(10.0)
MS4WAplicaciones
ogr2ogr:Lasprimerasconversiones
ogr2ogr
ogr2ogr
MapServerPrimeraAplicacin
HolaMundo!!!!!
Si,noeslaexcepcin Pasosaseguir:
MapServerMapfile
NAMEHelloWorld SIZE400300 IMAGECOLOR249245186 IMAGETYPEPNG EXTENT1.001.001.001.00 WEB
TEMPLATE/var/www/htdocs/hello.html IMAGEPATH/var/www/htdocs/tmp/
IMAGEURL/tmp/
END
MapServerMapfile
LAYER STATUSdefault TYPEpoint FEATURE POINTS0,00,0END TEXTHelloWorld END CLASS STYLE COLOR25500 END LABEL TYPE bitmap END END END END
MapServerhello.html
<html> <head><title>HelloWorlddesdeMapServer</title></head> <body> <formmethod=POSTaction=/cgibin/mapserv.exe> <inputtype=submitvalue=Click/> <inputtype=hiddenname=map value=/var/www/htdocs/hello.map/> </form> <imgsrc=[img]width=400height=300border=0/> </body> </html>
MapServer
MapServer
ArchivosCreados(similares):
MapServerPrimerMapa
MapServerPrimerMapa
ArchivosSHPdeESRI
HTML
Mapfile
Template
MapServerPrimerMapa
lapampa.html
<formname="formulario_mapa"method="get"action="mapa.html"> <inputtype="submit"value="Okparacomenzar"> <inputtype="hidden"name="program"value="/cgibin/mapserv.exe"> <inputtype="hidden"name="map" value="/ms4w/Apache/htdocs/mapdata/lapampa.map"> <inputtype="hidden"name="zoomsize"value="2"> <inputtype="hidden"name="layers"value="caminos"> <inputtype="hidden"name="layers"value="contorno"> <inputtype="hidden"name="layers"value="canales"> <inputtype="hidden"name="layers"value="alternativos"> <inputtype="hidden"name="root"value="/"> </form>
MapServerMapfile
NAME"lapampa" SIZE550413 TRANSPARENTon IMAGETYPEGIF SHAPEPATH"/ms4w/Apache/htdocs/mapdata/mapas" EXTENT3294313.8407065644021.9955383738758.5157166127290.490093
MapServerMapfile
SCALEBAR IMAGECOLOR255255255 LABEL COLOR000 SIZEsmall END POSITIONlr INTERVALS4 STATUSembed SIZE1504 STYLE0 UNITSkilometers TRANSPARENTon END LEGEND STATUSon IMAGECOLOR255255255 TRANSPARENTTRUE END
MapServerMapfile
REFERENCE IMAGE"../referencia.gif" SIZE200150 EXTENT3294313.8407065644021.9955383738758.5157166127290.490093 STATUSON COLOR111 OUTLINECOLOR25500 MINBOXSIZE5 MAXBOXSIZE100 MARKERSIZE8 MARKER'star' END
MapServerMapfile
LAYER NAME"contorno" DATA"lim0003a_Project" # CONNECTIONTYPEPOSTGIS # CONNECTION"dbname=pampauser=postgreshost=127.0.0.1port=5432" # DATA"the_geomfromcontorno" STATUSon TYPEline CLASS NAME"Contorno" STYLE COLOR1205020 END END END
MapServerInteraccin
ImagendeReferenciacon muestradeubicacin
CapasSeleccionables concheckbox
MapServerScripting
CGIesunaalternativa
ExistenAlternativas
MapServerMapScript
Phyton
#custommapfile.py importmapscript map=mapscript.mapObj() map.name="CustomMap" map.setSize(600,300) map.setExtent(180.0,90.0,180.0,90.0) map.imagecolor.setRGB(180,180,250) map.units=mapscript.MS_DD #Setthewebobjectimageproperties map.web.imagepath="/srv/www/htdocs/tmp/" map.web.imageurl="/tmp/"
MapServerMapScript
Php
<?php $image_name="phpmshello",rand(0,999999)).".png"; $map=ms_newMapObj("/ms4w/Apache/htdocs/mapdata/hello.map"); $image=$map>draw(); $image>saveImage(""/ms4w/Apache/htdocs/tmp/".$image_name); ?>
FIN
ConceptosdeMapServer