https://wiki.osgeo.org/w/api.php?action=feedcontributions&user=Wiki-Allensmith&feedformat=atomOSGeo - User contributions [en]2024-03-29T15:06:14ZUser contributionsMediaWiki 1.35.9https://wiki.osgeo.org/w/index.php?title=Openlayers:_configuraci%C3%B3n_con_biblioteca_en_el_servidor_local&diff=54120Openlayers: configuración con biblioteca en el servidor local2011-03-29T10:30:38Z<p>Wiki-Allensmith: /* Autores */</p>
<hr />
<div><br />
=OpenLayers: configuración de la biblioteca en el servidor local=<br />
==Descarga del fichero==<br />
Desde la página oficial de OpenLayers<ref>Pagina oficial de OpenLayers: http://www.openlayers.org/</ref> se encuentra el link a la versión estable ("stable").<br />
Actualmente la versión estable es la 2.7:<br />
* http://www.openlayers.org/download/OpenLayers-2.7.zip<br />
<br />
[[Image:Openlayers home page.png|thumb|none|400px|La pagina web de Openlayers]]<br />
<br />
Una vez bajado el fichero lo podemos descomprimir y copiar en la carpeta web de nuestro entorno<ref>Curso: Instalación y manejo de servicios OWS con UMN Mapserver y OpenLayers, Lorenzo Becchi y Jorge Sanz, http://wiki.osgeo.org/wiki/Instalaci%C3%B3n_y_manejo_de_servicios_OWS_con_UMN_Mapserver_y_Openlayers</ref>:<br />
<br />
*<tt>C:\ms4w\apps\mapserv-demo\</tt><br />
<br />
A continuación renombramos la carpeta:<br />
<br />
*<tt>C:\ms4w\apps\mapserv-demo\OpenLayers-2.7</tt><br />
<br />
por<br />
<br />
*<tt>C:\ms4w\apps\mapserv-demo\openlayers</tt><br />
<br />
[[Image:Openlayers zip file.png|thumb|none|400px|El fichero comprimirdo de OpenLayers]]<br />
[[Image:Openlayers copy on working dir.png|thumb|none|400px|copiando la carpeta en el servidor web]]<br />
<br />
==Crear la página de prueba==<br />
Con un editor vamos creando el fichero:<br />
<br />
*<tt>C:\ms4w\apps\mapserv-demo\ol-local.html</tt><br />
<br />
El código que le vamos a poner será el siguiente:<br />
<br />
<pre><br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title> OpenLayers con biblioteca en local</title><br />
<style type="text/css"><br />
#map {<br />
width: 512px;<br />
height: 512px;<br />
border: 1px solid black;<br />
}<br />
</style><br />
<script src="openlayers/OpenLayers.js"></script><br />
<script type="text/javascript"><br />
<br />
var map, layer;<br />
<br />
function init(){<br />
map = new OpenLayers.Map( 'map',{<br />
maxExtent: new OpenLayers.Bounds(378107,5193120,510896,5320243),<br />
maxResolution: 'auto',<br />
units: "m",<br />
projection: "EPSG:26915"} <br />
);<br />
<br />
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br />
"http://localhost:9000/cgi-bin/mapserv.exe?map=/ms4w/apps/mapserv-demo/itasca.map", {layers: 'drgs'} );<br />
<br />
map.addLayers([layer]);<br />
<br />
map.zoomToMaxExtent();<br />
}<br />
</script><br />
</head><br />
<body onload="init()"><br />
<br />
<b>Ejemplo de WMS</b><br />
<br />
<div><br />
Uso básico de OpenLayers con una capa WMS y la librería en local<br />
</div><br />
<br />
<div id="map"></div><br />
<br />
<div id="docs"><br />
más texto aquí<br />
</div><br />
</body><br />
</html><br />
</pre><br />
<br />
==Comprobar la página de prueba==<br />
<br />
El enlace web local será:<br />
<br />
* http://localhost:9000/mapserv-demo/ol-local.html<br />
<br />
[[Image:Openlayers map with local library.png|thumb|none|400px|Crear un mapa utilizando la biblioteca en local de OpenLayers]]<br />
<br />
== Todo lo que hay que notar en nuestro código==<br />
La verdad es que desde el [[Openlayers:_configuración_mínima_con_biblioteca_en_remoto|ejemplo con biblioteca en remoto]] no ha cambiado mucho salvo la llamada a la biblioteca.<br />
<br />
En lugar de que:<br />
<code><br />
<script src="<span style='background-color:yellow'>http://www.openlayers.org/api/OpenLayers.js</span>"></script><br />
</code><br />
hemos puesto:<br />
<code><br />
<script src="<span style='background-color:yellow'>openlayers/OpenLayers.js</span>"></script><br />
</code><br />
<br />
Este cambio puede parecer banal pero nos permite controlar todo el código que ofrecemos en nuestra aplicación web. Es decir, todas las imágenes, los textos y el código JavaScript que un usuario baja desde nuestra página web está totalmente bajo nuestro control.<br />
<br />
Una de las consecuencias negativas de utilizar la biblioteca en remoto es, por ejemplo, si los programadores de OpenLayers actualizan la biblioteca y cambian una de las funciones que estamos utilizando, puede que nuestra aplicación no funcione o simplemente funcione diferente de los que esperamos.<br />
<br />
Otra consecuencia desagradable se deriva de un posible mal funcionamientos del servidor de OpenLayers.org, en cuyo caso no ofrecería la biblioteca y por lo tanto nuestra aplicación también dejaría de funcionar.<br />
<br />
Otra importante nota es relativa a la accesibilidad de nuestra página web.<br><br />
Una de las características más importantes de una página web de éxito es que se pueda bajar rápidamente. La biblioteca de OpenLayers por completo, tal y como la hemos descargado, ocupa 560KB en su versión más compacta (trataremos este tema más adelante). A este valor hay que añadirle el peso de las imágenes del mapa y de las imágenes del diseño gráfico del sitio web. Todo esto va a producir una página web muy pesada si lo que queremos es simplemente mostrar un mapa sencillo que se pueda navegar. A continuación explicaremos cómo reducir el peso de la biblioteca manteniendo las funciones que nos interesan.<br />
<br />
[[Image:Openlayers firebug showing js weigth.png|thumb|none|400px|Firebug mostrando el peso de la biblioteca de OpenLayers]]<br />
<br />
==Crear el fichero comprimido==<br />
En la distribución de OpenLayers existe un carpeta que se llama '''build'''.<br />
Adentro se encuentran unos ficheros escritos en el lenguaje de programación ''python'' que nos permiten crear la biblioteca como mejor nos convenga.<br />
<br />
Antes que nada hay que instalar el entorno de ejecución '''Python for Windows''' que se puede descargar desde el sitio web de Python<ref>http://www.python.org/</ref><br />
<br />
Una vez nos desplazamos a la carpeta '''build''' vamos a encontrar unos ficheros que nos van a ser muy útiles para crear la biblioteca personalizada.<br />
En esta encontramos:<br />
* el fichero <tt>build.py</tt> que lee los ficheros de configuración, limpia el código de todos los comentarios y los espacios blancos inútiles y pone todo en un único fichero (<tt>OpenLayers.js</tt>).<br />
* los ficheros <tt>.cfg</tt> de configuración donde está escritos qué librerías hay que poner en la biblioteca.<br />
<br />
Editamos <tt>lite.cfg</tt> y le cambiamos el nombre en <tt>custom.cfg</tt> y guardamos el fichero.<br />
Ahora vamos a abrir IDLE (la GUI de Python, disponible en ''Inicio->Todos los programas->Python->IDLE'') y, con él, abrimos el fichero <tt>build.py</tt>. <br />
En la linea 20, cambiamos:<br />
*<tt>configFilename = "full.cfg"</tt><br />
por<br />
*<tt>configFilename = "custom.cfg"</tt><br />
<br />
Desde el menú ''Run'' escogemos el comando ''Run Module''.<br />
Este comando ejecuta el ''script'' y al final vamos a encontrar en la misma carpeta '''build''' un fichero <tt>OpenLayers.js</tt> que respeta el contenido de nuestro fichero de configuración '''custom.cfg'''. <br />
Este fichero pesa ahora '''111KB''', una buena mejoría para las prestaciones de nuestra página web. <br />
Para probarlo sólo hay que copiar este <tt>OpenLayers.js</tt> en la carpeta:<br />
<br />
*<tt>C:\ms4w\apps\mapserv-demo\openlayers</tt><br />
<br />
Ahora podemos comprobar su funcionamiento recargando nuestra página web:<br />
<br />
* http://localhost:9000/mapserv-demo/ol-local.html<br />
<br />
===Añadir librerías a nuestra biblioteca===<br />
<br />
Nuestra página web ''ol-local.html'' ofrece un mapa muy sencillo, faltan, por ejemplo, las herramientas de navegación.<br />
¿Qué pasa si añadimos el control '''PanZoomBar''' a nuestro mapa?<br />
<br />
para añadir el control hay que insertar este codigo antes que llamar la función ''zoomToMaxExtent()'':<br />
<br />
map.addControl(new OpenLayers.Control.PanZoomBar());<br />
<br />
Este es el codigo de nuestra pagina:<br />
<pre><br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title> OpenLayers con biblioteca en local</title><br />
<style type="text/css"><br />
#map {<br />
width: 512px;<br />
height: 512px;<br />
border: 1px solid black;<br />
}<br />
</style><br />
<script src="openlayers/OpenLayers.js"></script><br />
<script type="text/javascript"><br />
<br />
var map, layer;<br />
<br />
function init(){<br />
map = new OpenLayers.Map( 'map',{<br />
maxExtent: new OpenLayers.Bounds(378107,5193120,510896,5320243),<br />
maxResolution: 'auto',<br />
units: "m",<br />
projection: "EPSG:26915",<br />
controls:[]<br />
} <br />
);<br />
<br />
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",<br />
"http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/mapserv-demo/itasca.map", {layers: 'drgs'} );<br />
<br />
map.addLayers([layer]);<br />
<br />
map. addControl(new OpenLayers.Control.PanZoomBar());<br />
map.zoomToMaxExtent();<br />
}<br />
</script><br />
</head><br />
<body onload="init()"><br />
<br />
<b>Ejemplo de WMS</b><br />
<br />
<div><br />
Uso básico de OpenLayers con una capa WMS y la librería en local<br />
</div><br />
<br />
<div id="map"></div><br />
<br />
<div id="docs"><br />
más texto aquí<br />
</div><br />
</body><br />
</html><br />
</pre><br />
<br />
Lo que resulta es un error. Si podéis ver la ventana de ''debug'' os dirá:<br />
<br />
<tt>OpenLayers.Control is undefined</tt><br />
<br />
Lo que tenemos que hacer es añadir a nuestra biblioteca las librerías justas para que '''PanZoomBar''' se encuentre entre los comandos disponibles.<br />
<br />
Editamos <tt>custom.cfg</tt> y lo vamos a poner con este texto:<br />
<br />
<code><br />
[first]<br />
OpenLayers/SingleFile.js<br />
OpenLayers.js<br />
OpenLayers/BaseTypes.js<br />
OpenLayers/BaseTypes/Class.js<br />
OpenLayers/Util.js<br />
Rico/Corner.js <br />
<br />
[last]<br />
<br />
[include]<br />
OpenLayers/Events.js<br />
OpenLayers/Map.js<br />
OpenLayers/Layer.js<br />
OpenLayers/Layer/Grid.js<br />
OpenLayers/Layer/HTTPRequest.js<br />
OpenLayers/Layer/WMS.js<br />
OpenLayers/Layer/WMS/Untiled.js<br />
OpenLayers/Tile.js<br />
OpenLayers/Tile/Image.js <br />
<br />
OpenLayers/Console.js<br />
OpenLayers/Control.js<br />
OpenLayers/Control/Navigation.js<br />
OpenLayers/Control/ArgParser.js<br />
OpenLayers/Control/Attribution.js<br />
OpenLayers/Control/PanZoomBar.js<br />
[exclude]<br />
</code><br />
<br />
Las últimas tres líneas del ''include'' ponen los ficheros que OpenLayers necesita para visualizar el '''PanZoomBar'''.<br />
<br />
Nos queda lanzar otra vez el comando ''run module'' del '''build.py''' y esperar que complete su trabajo.<br />
Ahora podemos copiar otra vez el fichero <tt>OpenLayers.js</tt> adentro de la carpeta:<br />
<br />
*<tt>C:\ms4w\apps\mapserv-demo\openlayers</tt><br />
<br />
Ahora si volvemos a nuestra página web debería aparecer el control '''PanZoomBar''' correctamente.<br />
<br />
Cualquier librería que queramos añadir a nuestra biblioteca tiene que pasar por el <tt>custom.cfg</tt>, en la sección ''[include]'', y luego por la ejecución del <tt>build.py</tt>.<br />
<br />
[[Image:Openlayers Control PanZoomBar firebug.png|thumb|none|400px|La página presenta el control '''PanZoomBar''' y Firebug nos muestra que la biblioteca ocupa sólo 129KB]]<br />
<br />
==referencias==<br />
<references/><br />
<br />
<br />
=Autores=<br />
* [[User:ominiverdi| Lorenzo Becchi]]<br />
* [[User:jsanz| Jorge Gaspar Sanz Salinas]]<br />
* [http://www.buybamboosheets.com Bamboo sheets]<br />
<br />
=Licencia=<br />
*la licencia por este articulo es: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/deed.es).<br />
* esta licencia permite:<br />
** copiar, distribuir y comunicar públicamente la obra<br />
** hacer obras derivadas<br />
*bajo estas condiciones:<br />
** '''Reconocimiento'''. Debe reconocer los créditos de la obra de la manera especificada por el autor o el licenciador (pero no de una manera que sugiera que tiene su apoyo o apoyan el uso que hace de su obra).<br />
** Al reutilizar o distribuir la obra, tiene que dejar bien claro los términos de la licencia de esta obra.<br />
** Alguna de estas condiciones puede no aplicarse si se obtiene el permiso del titular de los derechos de autor<br />
** Nada en esta licencia menoscaba o restringe los derechos morales del autor.<br />
<br />
=Duración=<br />
Por esta clase se evalúa una duración de X oras<br />
<br />
<br />
[[Category:Education]]<br />
[[Category:Cursos]]</div>Wiki-Allensmithhttps://wiki.osgeo.org/w/index.php?title=India&diff=54119India2011-03-29T10:27:06Z<p>Wiki-Allensmith: </p>
<hr />
<div>Find more information on the '''[http://osgeo.in India Chapter of OSGeo]''' web site. <br />
<br />
== '''About India OSGeo Chapter''' ==<br />
<br />
Geographical Information Systems were seen as very special and very complex domain in India. There is a lot of hype attached with it and with that obviously high cost. So far such systems were seen as something to be used for high level planning and complex scientific operations by large corporates and Govt research agencies or departments only. Also the older mapping policy of India prevented virtually anybody except governments to possess any map data. The picture is however changing fast.<br />
<br />
With recent developments in the areas of right-to-information and National Map Policy (http://dst.gov.in/whats_new/press_releases05/cabinet-approves.htm), there is a sudden increased awareness towards GIS based information systems. National Urban Renewal Mission (http://pmindia.nic.in/lspeech.asp?id=235), a well funded initiative has made use of GIS in urban local bodies mandatory. A large portion of geodata will now be freely available.All goverement departments are now trying to find easier ways to manage, update and publish information for the public. There are also large number of NGOs and citizen organisation which are working in areas like ubran poverty, town planning, solid waste management,rural development, school education,environmental issues etc. and they have started understanding and appreciating the importance of community GIS systems.<br />
<br />
However growth of GIS is hindered by highly priced proprietory softwares and unavailability of public geodata. Many of such licenced softwares remain unutilized in various government offices because they require either extensive training or easy availability on multiple locations. All this can be changed by the use of Free/Opensource software tools. There is hardly any proprietory GIS software that can show text in Unicode standard in maps . This is significant since all governmet data and most educational institutions work in local language media . FOSS GIS has already shown this solution. Thus, Free/Opensource Geospatial softwares which are much more powerful and usable can be used for developing systems where more and more public participation is sought. <br />
<br />
The India OSGeo Chapter is formed to fulfill the mission<br />
and objectives described in this document. India OSGeo Chapter will earnestly follow the Local Chapter Guidelines stipulated by OSGeo and cooperate closely with OSGeo Board in promoting the use and development of OSGeo projects in India. The India OSGeo Chapter will strive to serve anyone interested in Open Source Geospatial Solutions and related issues, and to cover all the activities associated with the application, development and promotion of Open Source Geospatial solutions in India.<br />
<br />
=== Mission ===<br />
<br />
* Promoting Free/Opensource GIS tools and publicly available Geodata<br />
* Advocacy of and promoting Localized GIS<br />
* Act as a bridge between various groups like Developers, Application Users, NGOs, Government departments<br />
* mentor various FOSS GIS miniprojects by providing resources such as technical guidence, webspace etc.<br />
=== Objectives ===<br />
<br />
Development:<br />
* follow up on indian language support in various free/opensource GIS tools like GRASS, MapServer etc.<br />
* initiative for standardisation of publicly available geodata <br />
* setting up WMS/WFS based geodata servers using publicly available geodata<br />
* toolkit for localised GIS including with special focus on schools, governments , public causes such as child malnutririon, mass education. <br />
<br />
<br />
POCs ('''P'''roof '''O'''f '''C'''oncept demos):<br />
* free/opensource based GIS demos<br />
* localized GIS (interface and maps)<br />
* Collaborative platforms for participatory governance <br />
<br />
Regional Events: <br />
* Workshops and Training sessions for<br />
** comp science students/teachers<br />
** geo-informatics/geology/geography/civil engineering students and teachers<br />
** others<br />
* Special Lectures<br />
* Demonstrations<br />
<br />
Communication:<br />
* Networking Local Communities related to geo-issues<br />
* Mailing Lists<br />
* Wiki<br />
<br />
=== Legal status ===<br />
<br />
OSGeo India Chapter is, presently, a voluntary organization, and has not been registered as a legal body. At present, OSGeo legal status is similar to other Open Source related organizations in India such as "Linux India" (http://www.linux-india.org/), "gnomebangalore"(http://www.gnomebangalore.org/) or "KDE India" (http://in.kde.org/). Recently, "Free Software Foundation India" (FSF India) was registered as company and been granted the 80G status under Income Tax Act. India OSGeo Chapter is still a <br />
nascent voluntary organization and will consider the modalities to<br />
register as a legal body at some stage in the future. The India OSGeo Chapter will consult a certified tax cosultant when necessary to ensure compliance with the Indian tax laws.<br />
<br />
The activities are managed by the '''Office''' located at <br><br />
International Institute of Information Technology<br><br />
Gachibowli, Hyderabad 500032, Andhra Pradesh, India<br><br />
Contact E-mail: rajan at iiit dot ac dot in<br />
<br />
== '''India OSGeo Chapter Officers''' ==<br />
<br />
<b>India OSGeo Representative</b><br><br />
Dr P.S.Roy<br><br />
Deputy Director (RS&GIS-AA)<br><br />
National Remote Sensing Agency<br><br />
(Deptartment of Space, Government of India)<br><br />
Balanagar, Hyderabad-500 037<br><br />
Telephone :+91-40-23884255<br />
Fax: +91-40-23875932<br><br />
E-Mail: psr at nrsa dot gov dot in<br />
<br />
<b>India OSGeo Chapter Coordinator</b><br><br />
Dr. Yashodhan Joshi<br><br />
CEO Relatioware<br><br />
Pune, India<br><br />
yyj at relationware dot in<br><br />
<br />
<b>India OSGeo Treasurer</b><br><br />
Dr K.S.Rajan<br><br />
Associate Professor<br><br />
International Institute of Information Technology<br><br />
Gachibowli, Hyderabad-500 032, India<br><br />
E-Mail: rajan at iiit dot ac dot in<br />
<br />
<b>OSGeo Software Development Committee</b><br><br />
Chairpersons<br> <br />
(Prototyping, Localization, Proof of Concepts etc.)<br><br />
Prof. Jitendra Shah<br><br />
VJTI Mumbai, India<br><br />
jituviju at gmail dot com<br><br />
<br />
Dr. T.V. Ramachandra<br><br />
Indian Institute of Science<br><br />
Bangalore, India<br><br />
cestvr at ces dot iisc dot ernet dot in<br><br />
<br />
<b>Regional Events Committee</b><br><br />
Chairpersons<br><br />
Mr. V. Ravi Kumar*<br><br />
Joint Secretory of the OSGeo India registered body and <br><br />
Director (Retired*) <br><br />
Centre for Geoinformation Management and Training<br> <br />
Training Inistitute<br> <br />
Geological Survey of India<br><br />
Bandalaguda, <br />
Hyderabad 500068<br><br />
India<br><br />
ravivundavalli at yahoo dot com<br><br />
<br />
Mr. Neeraj Dixit<br><br />
Product Manager<br />
Autodesk India Pvt. Ltd.<br><br />
Infrastructure Solutions Division (ISD)<br><br />
Neeraj dot Dixit at autodesk dot com<br> <br />
<br />
<b>Education and Training Committee</b><br><br />
Chairpersons<br><br />
Dr. N.J. Pawar<br><br />
Department of Geology,<br />
Pune University<br><br />
Ganeshkhind Road<br><br />
Pune 411007, India<br><br />
njpawar at unipune dot ernet dot in<br />
<br />
Dr. S.N. Prasad<br><br />
Sàlim Ali Centre for Ornithology and Natural History (SACON)<br><br />
Deccan Regional Station,<br />
Secunderabad - 500 017, India<br><br />
Email: narendra_prasad at yahoo dot com<br><br />
<br />
Dr. H.S.Rai<br><br />
Professor of Civil Engineering<br><br />
Guru Nanak Dev Engineering College<br><br />
Ludhiana - 141006<br><br />
India <br><br />
Email: hardeep.rai at gmail dot com<br><br />
Web: [http://hs.raiandrai.com HS.RaiAndRai.com]<br><br />
<br />
<b>Advisors</b><br><br />
<br />
Dr. S.S. Thigale (spathigale at rediffmail dot com)<br><br />
Dr. Rajendra Jagdale (rajendra dot jagdale at gmail dot com)<br><br />
Dr. Vishwas S.Kale (vskale at unipune dot ernet dot in)<br><br />
Mr. Ashok Saraf (saraf dot ashok at gmail dot com)<br><br />
Dr. Venkatesh Raghavan (venkat at osgeo dot org)<br><br />
Mr. Kiran Chandra (kiranfsf at gmail dot com)<br><br />
Mr. Achuthan Mohan (achuthanmohan at gmail dot com)<br><br />
..Add more Advisors here<br />
<br />
== '''Initial Membership''' ==<br />
* Dr. Gautam Talukdar<br />
* Dr. Tarun P. Singh<br />
* Amol A. Sale<br />
* Anand Akmanchi<br />
* Aneel Kumar.V<br />
* Anil Kumar.K.V<br />
* Anivar Aravind<br />
* Ankur Mehrotra<br />
* Gangavane<br />
* Indrajit Patil<br />
* Jayant Kirtane<br />
* Kanhaiya K. Kale<br />
* Mahalakshmi Narayanan<br />
* Mahesh Jeevane<br />
* Maneesh Prasad<br />
* Mohan Patil<br />
* N.R. Karmarkar<br />
* Rahul Kaura<br />
* Sajith<br />
* Saroj Akiojam<br />
* Shekhar Krishnan<br />
* Swapnil K. Hajare<br />
* Uttam Kumar<br />
* B.N. Umrikar<br />
* Vrishali Deosthali<br />
* A.V.Satya Kumar<br />
* Praveen Kumar Sinha<br />
* [http://www.wetlandsofindia.org/santosh/index.html Santosh Gaikwad]<br />
* C. Pattanaik<br />
* [http://www.gndec.ac.in/~hsrai/ Hardeep Singh Rai]<br />
* [http://www.hayda.net/ chat]<br />
* M.Surendranath<br />
* Ditty Mathew<br />
* N.Rajendran<br />
* Srinivasan K<br />
* Nageswaran B<br />
* N.R.S.Reddy<br />
* L.P.Singh<br />
* [http://www.geocities.com/ajpnaveen/index.htm A.J.Prakash Naveen]<br />
* S.Ramamurthy<br />
* B.K. Sahu<br />
* J.Simhachalam<br />
* V.Hanumantha Rao<br />
* S.Ananda Murty<br />
* K.Seshayya<br />
* N.Padmayya<br />
* N.R.Ramesh<br />
* U.S.N.Reddy<br />
* R.M.Sundaram<br />
* [http://5map.in Vimal Kumar]<br />
* Narayana Aroori<br />
* P M Bala Manikavelu<br />
* RVN Srinivas<br />
* M Arulraj<br />
* Satya Prasad Sarilla<br />
* Suresh Verma<br />
* Kumar Parakram<br />
* Pranav Kumar<br />
* Harish Kumar Solanki<br />
<br />
Temporary mailing list - http://wgrass.media.osaka-cu.ac.jp/mailman/listinfo/osgeo_discuss<br />
<br />
== '''Meetings of India OSGeo Chapter ''' ==<br />
<br />
* <u>4th Oct 2006, Hyderabad</u> [http://wiki.osgeo.org/index.php/Talk:India Meeting Minutes]<br />
<br />
* <u>24th Jan 2006, Hyderabad</u> <br><br />
We are Happy to ANNOUNCE that we had a very successful OSGeo Workshop at Map World Forum 2007 today, and thank all the participants for the same. We are also very grateful to our Sponsors OSGeo.org and our Donors thru GNOME Foundation for the financial support in hosting this event.<br><br />
Later in the day, the first meeting of the newly constituted Executive Council (Board) of OSGeo-India was held. <br><br />
Details will be posted soon.<br />
<br />
== '''Links''' ==<br />
* India OSGeo Chapter - http://osgeo.in/<br />
* National Remote Sensing Agency - http://www.nrsa.gov.in/<br />
* GIS based Village Information System - Maharashtra (Hosting Courtsey : Media Center, Osaka City) - http://gisws.media.osaka-cu.ac.jp/maha_map.dev/<br />
* GIS based Village Information System - Maharashtra - http://indictrans.in/demos/maha_map.dev/<br />
* Human Development Index (Jalna, Maharashtra)- http://www.indictrans.in/?q=projects/gis/ghdi<br />
* Maharashtra Coverage - Neighbourhood Village - http://indictrans.in/demos/maha_map.coverage/village_search_k.php<br />
* GIS based Slum Information System (Korba Slum, Mumbai) - http://indictrans.in/demos/chameleon/samples/htdocs/korba.phtml<br />
* Mumbai Free Map - http://mumbai.freemap.in/ | http://www.crit.org.in/projects/gis<br />
* Bangalore Free Map - http://bangalore.freemap.in/<br />
* Vasai Virar Subregion Freemap - http://vvsr.freemap.in/<br />
jaisuvyas<br />
* Tamil Nadu Maps Online - http://tnmaps.tn.nic.in/?info1.htm<br />
* Tamil Nadu Census 2001 - http://www.census.tn.nic.in/<br />
* Tamil Nadu Animal Disease Infformation - http://www.animaldiseaseinfo.tn.nic.in<br />
* GRASS GIS mirror India - http://wgbis.ces.iisc.ernet.in/grass/index.php<br />
* GRDSS (GRASS GUI) - http://wgbis.ces.iisc.ernet.in/foss<br />
* FOSS at IISc - http://wgbis.ces.iisc.ernet.in/foss http://www.hayda.net/<br />
* Visualisation of resource maps of Cheruvannur Grama Panchayat. Panchayats are 3rd stratum of administration in India. [Bilingual: English and Malayalam] - http://cheruvannur.web4all.in/resources/<br />
* Free GIS India - http://freegis.gnu.org.in/<br />
* ENVIS Wetland Ecosystems India - http://www.wetlandsofindia.org:8080/sacon/aboutus.jsp/<br />
* GIS & Language Technology related Applications - http://indictrans.in/demos/GIS_Presentation_20061004.pdf</div>Wiki-Allensmithhttps://wiki.osgeo.org/w/index.php?title=Tile_Map_Service_Specification&diff=53235Tile Map Service Specification2011-02-11T07:54:50Z<p>Wiki-Allensmith: </p>
<hr />
<div>This document is the work of a loose community of participants interested in client/server mapping solutions that use multi-resolution image pyramids. It is meant to be used as a baseline for the implementation of client/server mapping software. It is not an "official standard" nor is it endorsed by OSGeo as an official project or work product of the Foundation.<br />
<br />
This document is version "1.0", and will not be edited further. Changes will be discussed on the [[Tile Map Service Specification Change Requests]] page.<br />
<br />
Any new revisions will take place in a new working copy.<br />
<br />
==Introduction==<br />
<br />
===Document Scope===<br />
<br />
A Tile Map Service (TMS) provides access to cartographic maps of geo-referenced data, not direct access to the data itself. This document standardizes the way in which map tiles are requested by clients, and the ways that servers describe their holdings.<br />
<br />
===Document Form===<br />
<br />
This document will proceed from a description of general resources provided by the server to particular resources (such as map tiles) providing examples of access URLs and return values at each stage.<br />
<br />
==Specification==<br />
<br />
The Tiled Web Service provides access to resources, in particular, to rendered cartographic tiles at fixed scales. Access to these resources is provided via a "REST" interface, starting with a root resource describing available layers, then map resources with a set of scales, then scales holding sets of tiles. <br />
<br />
Each resource contains the descriptive information and links to further resources. Note that while the URLs used to access resources may appear to have internal meaning (the resource for version 1.0.0 of the service has "1.0.0" in it's URL) such structure is ''not required'' of them. <br />
<br />
The only requirement is that the resource be referenced by a URL (<nowiki>http://tms.osgeo.org/1.0.0/ could be http://tms.osgeo.org/onepointzeropointzero or http://tms.osgeo.org/flipper.xml as long as the value appeared in the href of the <TileMapService> element</nowiki>).<br />
<br />
The value of an "href" '''must''' be an absolute URL (starting with "http://"). For example: href="<nowiki>http://www.service.org/subdirectory/tilemap.xml</nowiki>"<br />
<br />
===Root Resource===<br />
<br />
The root resource describes the available versions of the <TileMapService> (and possibly other services as well).<br />
<br />
Request:<br />
<br />
<nowiki>http://tms.osgeo.org/</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<Services><br />
<TileMapService title="Example Tile Map Service" version="1.0.0" href="http://tms.osgeo.org/1.0.0/" /><br />
<TileMapService title="New Example Tile Map Service" version="1.1.0" href="http://tms.osgeo.org/1.1.0/" /><br />
<FancyFeatureService title="Features!" version="0.9" href="http://ffs.osgeo.org/0.9/" /><br />
</Services></nowiki><br />
<br />
Request:<br />
<br />
<nowiki>http://www.osgeo.org/services/root.xml</nowiki><br />
<br />
Response:<br />
<br />
<nowiki><?xml version="1.0" ?><br />
<Services><br />
<TileMapService title="Example Static Tile Map Service" version="1.0.0" href="http://www.osgeo.org/services/tilemapservice.xml" /><br />
</Services></nowiki><br />
<br />
===TileMapService Resource===<br />
<br />
The <TileMapService> resource provides description metadata about the service and lists the available <TileMaps>. <br />
<br />
Optional elements in the resource are called out below using the pipe character. All other elements are mandatory.<br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMapService version="1.0.0" services="http://tms.osgeo.org"><br />
<Title>Example Tile Map Service</Title><br />
<Abstract>This is a longer description of the example tiling map service.</Abstract><br />
| <KeywordList>example tile service</KeywordList><br />
| <ContactInformation><br />
| <ContactPersonPrimary><br />
| <ContactPerson>Paul Ramsey</ContactPerson><br />
| <ContactOrganization>Refractions Research</ContactOrganization><br />
| </ContactPersonPrimary><br />
| <ContactPosition>Manager</ContactPosition><br />
| <ContactAddress><br />
| <AddressType>postal</AddressType><br />
| <Address>300 - 1207 Douglas Street</Address><br />
| <City>Victoria</City><br />
| <StateOrProvince>British Columbia</StateOrProvince><br />
| <PostCode>V8W2E7</PostCode><br />
| <Country>Canada</Country><br />
| </ContactAddress><br />
| <ContactVoiceTelephone>12503833022</ContactVoiceTelephone><br />
| <ContactFacsimileTelephone>12503832140</ContactFacsimileTelephone><br />
| <ContactElectronicMailAddress>pramsey@refractions.net</ContactElectronicMailAddress><br />
| </ContactInformation><br />
<TileMaps><br />
<TileMap <br />
title="VMAP0 World Map" <br />
srs="EPSG:4326" <br />
profile="global-geodetic" <br />
href="http://tms.osgeo.org/1.0.0/vmap0" /><br />
<TileMap <br />
title="British Columbia Landsat Imagery (2000)" <br />
srs="EPSG:3005" <br />
profile="local" <br />
href="http://tms.osgeo.org/1.0.0/landsat2000" /><br />
</TileMaps><br />
</TileMapService></nowiki><br />
<br />
<br />
Request: <br />
<br />
<nowiki>http://www.osgeo.org/services/tilemapservice.xml</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMapService version="1.0.0" services="http://www.osgeo.org/services/root.xml"><br />
<Title>Example Static Tile Map Service</Title><br />
<Abstract>This is a longer description of the static tiling map service.</Abstract><br />
| <KeywordList>example tile service static</KeywordList><br />
| <ContactInformation><br />
| <ContactPersonPrimary><br />
| <ContactPerson>Paul Ramsey</ContactPerson><br />
| <ContactOrganization>Refractions Research</ContactOrganization><br />
| </ContactPersonPrimary><br />
| <ContactPosition>Manager</ContactPosition><br />
| <ContactAddress><br />
| <AddressType>postal</AddressType><br />
| <Address>300 - 1207 Douglas Street</Address><br />
| <City>Victoria</City><br />
| <StateOrProvince>British Columbia</StateOrProvince><br />
| <PostCode>V8W2E7</PostCode><br />
| <Country>Canada</Country><br />
| </ContactAddress><br />
| <ContactVoiceTelephone>12503833022</ContactVoiceTelephone><br />
| <ContactFacsimileTelephone>12503832140</ContactFacsimileTelephone><br />
| <ContactElectronicMailAddress>pramsey@refractions.net</ContactElectronicMailAddress><br />
| </ContactInformation><br />
<TileMaps><br />
<TileMap <br />
title="Vancouver Island Base Map" <br />
srs="EPSG:26910" <br />
profile="none" <br />
href="http://www.osgeo.org/services/basemap.xml" /><br />
</TileMaps><br />
</TileMapService></nowiki><br />
<br />
===TileMap Resource===<br />
<br />
A <TileMap> is a (usually) cartographically complete map representation. Sometimes <TileMap>s are built to be used in conjunction, as a set of stacked layers, but they are generally visually complete on their own. <br />
<br />
<TileMap>s are composed of a set of scale-appropriate cartographic renderings, each divided up into regularly spaced image tiles, called <TileSet>s. Small-scale (eg, 1:10000000) tile sets may only contain a handful of tiles. Large-scale tile sets (eg, 1:10000) may contain millions of tiles.<br />
<br />
At a particular scale, and in a particular cartographic projection, a <TileMap> is represented by a <TileSet>, a coverage of regularly sized and spaced images that taken together form a complete visual representation of the entire area of coverage of the <TileMap>.<br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?> <br />
<TileMap version="1.0.0" tilemapservice="http://http://tms.osgeo.org/1.0.0"><br />
<Title>VMAP0 World Map</Title><br />
<Abstract>A map of the world built from the NGA VMAP0 vector data set.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>National Geospatial Intelligence Agency</Title><br />
| <Logo width="10" height="10" href="http://nga.mil/logo.gif" mime-type="image/gif" /><br />
| </Attribution><br />
| <WebMapContext href="http://wms.org" /><br />
| <Face>0</Face><br />
<SRS>EPSG:4326</SRS><br />
<BoundingBox minx="-180" miny="-90" maxx="180" maxy="90" /><br />
<Origin x="-180" y="-90" /> <br />
<TileFormat width="256" height="256" mime-type="image/jpeg" extension="jpg" /><br />
<TileSets profile=global-geodetic"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/0" units-per-pixel="0.703125" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/1" units-per-pixel="0.3515625" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/2" units-per-pixel="0.17578125" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/3" units-per-pixel="0.08789063" order="3" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/landsat2000</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0"><br />
<Title>British Columbia Landsat Imagery (2000)</Title><br />
<Abstract>Landsat data collected in the year 2000 over British Columbia.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>Government of British Columbia</Title><br />
| <Logo width="10" height="10" href="http://gov.bc.ca/logo.png" mime-type="image/png" /><br />
| </Attribution><br />
| <WebMapContext href="http://wms.gov.bc.ca" /><br />
<SRS>EPSG:3005</SRS><br />
<BoundingBox minx="100000" miny="100000" maxx="1800000" maxy="1800000" /><br />
<Origin x="100000" y="100000" /><br />
<TileFormat width="256" height="256" mime-type="image/png" extension="png" /><br />
<TileSets profile="local"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/2048" units-per-pixel="2048" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/1024" units-per-pixel="1024" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/512" units-per-pixel="512" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/256" units-per-pixel="256" order="3" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/128" units-per-pixel="128" order="4" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/64" units-per-pixel="64" order="5" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Request: <br />
<br />
<nowiki>http://www.osgeo.org/services/basemap.xml</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMap version="1.0.0" tilemapservice="http://www.osgeo.org/services/tilemapservice.xml"><br />
<Title>Vancouver Island Base Map</Title><br />
<Abstract>A map of the Vancouver Island built from British Columbia planimetric mapping <br />
data and digital elevation hill shading.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>Goverment of British Columbia</Title><br />
| <Logo width="10" height="10" href="http://www.gov.bc.ca/logo.gif" mime-type="image/gif" /><br />
| </Attribution><br />
| <WebMapContext href="http://openmaps.gov.bc.ca" /><br />
<SRS>EPSG:26910</SRS><br />
| <Face>0</Face><br />
<BoundingBox minx="500000" miny="4800000" maxx="700000" maxy="5500000" /><br />
<Origin x="500000" y="4800000" /> <br />
<TileFormat width="256" height="256" mime-type="image/png" extension="png" /><br />
<TileSets profile="none"><br />
<TileSet href="http://www.osgeo.org/services/basemap/L1" units-per-pixel="6400" order="0" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L2" units-per-pixel="1600" order="1" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L3" units-per-pixel="400" order="2" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L4" units-per-pixel="100" order="3" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L5" units-per-pixel="25" order="4" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Each <TileMap> supports one <SRS> and one image format. To support more than one SRS or image format, define extra <TileMaps> in your <TileMapService> for each combination you want.<br />
<br />
<TileMap>s have both a <BoundingBox> and an <Origin>. The <BoundingBox> is the extent of the data of interest -- it might be used by a client to set an initial spatial extent. The <Origin> is the lower-left corner of the 0/0 tile, and the upper right corner of tile -1/-1 (if you choose to configure your service so that negative tiles are required). The <Origin> may be outside of the visual region of interest (the <BoundingBox>), for reasons of implementation convenience. <br />
<br />
<TileMap>s may participate as a <Face> of a larger complex of <TileMap>s. The OSGPlanet and GeoFusion clients both use separate polar faces in conjuction with equatorial faces (an "earth cube") to create a single world view from multiple tile maps. See [[#Using Faces]].<br />
<br />
<TileMap>s may implement one of three "profile"s, two global profiles in common global projections, or a local profile in an arbitrary projection. All profiles restrict the service to a fixed set of scales, to allow tilesets from different services to be more easily overlaid.<br />
<br />
===Profiles===<br />
<br />
Using this server specification will ensure that clients can easily consume your tiled map data. However, it will not guarantee that clients can efficiently overlay your data with data from other tile map servers. In order to maximize the interoperability of your tile map with other tile maps, you must implement the a "profile" for your tile map.<br />
<br />
The profile a <TileMap> supports is advertised in the "profile" attribute of the <TileSets> element. The "profile" will be one of:<br />
<br />
* none<br />
* global-geodetic<br />
* global-mercator<br />
* local<br />
<br />
====global-geodetic====<br />
<br />
If the profile type is set to "global-geodetic", the <TileMap> must meet the following requirements:<br />
<br />
* Must use <SRS>EPSG:4326</SRS><br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 0.703125 / 2^n<br />
** This scaling allows an initial zoom level that consists of 2 256x256 pixel tiles covering the whole earth, with an <Origin> of (-180,-90). Other combinations of tile size and <Origin> are also possible at this scale.<br />
<br />
<nowiki><TileSets profile="global-geodetic"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/0" units-per-pixel="0.703125" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/1" units-per-pixel="0.3515625" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/2" units-per-pixel="0.17578125" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/3" units-per-pixel="0.08789063" order="3" /><br />
</TileSets></nowiki><br />
<br />
====global-mercator====<br />
<br />
If the profile type is set to "global-mercator", the <TileMap> must meet the following requirements:<br />
<br />
* Must use <SRS>OSGEO:41001</SRS><br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 78271.516 / 2^n<br />
** This scaling allows an initial zoom level that consists of four 256x256 pixel tiles covering the whole earth, with an <Origin> of (-20037508.34, -20037508.34). Other combinations of tile size and <Origin> are also possible at this scale.<br />
<br />
====local====<br />
<br />
Unlike the global profiles, the "local" profile is built from the bottom up, starting with a smallest possible scale of one unit per pixel and compounding upwards from there. Local profiles can be in any projection, but are at a fixed set of scales.<br />
<br />
If the profile type is set to "local", the <TileMap> must meet the following requirements:<br />
<br />
* May use any coordinate system, and must identify that coordinate system in the <SRS>.<br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 2^n<br />
* Must provide <TileSet> sub-directories below the <Profile> href value, using the value of "n" appropriate for that <TileSet> as the sub-directory name.<br />
<br />
<nowiki><SRS>EPSG:3005</SRS><br />
<BoundingBox minx="100000" miny="100000" maxx="1800000" maxy="1800000" /><br />
<Origin x="100000" y="100000" /><br />
<TileSets profile="local"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/6" units-per-pixel="2048" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/5" units-per-pixel="1024" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/4" units-per-pixel="512" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/3" units-per-pixel="256" order="3" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/2" units-per-pixel="128" order="4" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/1" units-per-pixel="64" order="5" /><br />
</TileSets></nowiki><br />
<br />
===Tile Resources===<br />
<br />
The origin of a <TileMap> is defined in the coordinates of the spatial reference system of the <TileMap>. The x-coordinate of the tile numbers increases with the x-coordinate of the spatial reference system, and the y-coordinate of the tile numbers also increases with the y-coordinate of the spatial reference system.<br />
<br />
Tiles are addressed under the "href" specified in the <TileSet> appending the "x" tile coordinate as a directory name and using the "y" tile coordinate as the file name, with the file "extension" from the <TileFormat>.<br />
<br />
Example:<br />
<br />
The tile at the origin of the tile set in the first zoom level of vmap0.<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0/levelzero/0/0.jpg</nowiki><br />
<br />
The tile near the middle of the tile set in the third zoom level of vmap0.<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0/leveltwo/3/4.jpg</nowiki><br />
<br />
The tile near the middle of the tile set in the fifth zoom level of landsat2000.<br />
<nowiki>http://tms.osgeo.org/1.0.0/landsat2000/1/8500/8500.png</nowiki><br />
<br />
The tile at the origin of the tile set in the first zoom level of basemap.<br />
<nowiki>http://www.osgeo.org/services/basemap/L1/0/0.png</nowiki><br />
<br />
===TileMap Diagram===<br />
<br />
[[Image:Tms.png]]<br />
<br />
===Error Handling===<br />
<br />
When an error occurs in the server, it is important that the client be able easily notice that an error has occurred, and ascertain ''why'' the error occured so the user can be notified if necessary.<br />
<br />
The tile map server uses HTTP error codes to relay the general reason for an error condition, and an XML payload to communicate the specific reason for the failure in human readable language.<br />
<br />
Only HTTP error codes given in this specification should be used to return errors to the client.<br />
<br />
* The client requests a nonexistent resource URL. Return HTTP error code 404 (Not Found)<br />
* The server fails in processing a response for a valid resource URL. Return HTTP error code 500 (Internal Server Error)<br />
<br />
Servers are optionally allowed to return content, even when throwning an error code. The following is the XML format for a tile map server error message. If the Content-type of the return on an error is set to text/xml, this format is the required form of the response.<br />
<br />
<nowiki><?xml version="1.0" ?><br />
<TileMapServerError><br />
<Message>The requested tile is outside the bounding box of the tile map.</Message><br />
</TileMapServerError></nowiki><br />
<br />
==Implementation Advice==<br />
<br />
===Spatial Referencing Systems===<br />
<br />
Spatial referencing systems for the tile map service will be defined using the EPSG database as a reference for "well-known" projections, subject to interpretations, given below. <br />
<br />
There are two substantial implementation issues with using the EPSG database as a source of truth for spatial reference systems:<br />
<br />
* Firstly, the EPSG database has some specific definitions for commonly used geodetic coordinate systems, in particular EPSG:4326 -- geodetic coordinates relative to the WGS84 spheroid. The EPSG definition for 4326 says that the coordinate order is latitude, longitude and that the units are degrees, minutes, seconds. However, common usage of EPSG:4326 in web mapping says that the coordinate order is longitude, latitude and the units are decimal degrees.<br />
* Secondly, the EPSG database does not include every commonly used spatial reference system. There are still many local systems which are not included in the database, though the EPSG does make an effort to include new systems as they are brought to their attention. However, the EPSG does not catalogue commonly used global and large area systems, presumably as a matter of policy. For example, no EPSG identifier is provided for a Mercator projection of the world, or an Albers projection of North America.<br />
<br />
The issues will be dealt with by fiat in this specification, matching implementation practice rather than following the database definition:<br />
<br />
* For all geodetic coordinate systems in the EPSG database, the tile map service specification will treat the coordinate order as longitude, latitude and the units as decimal degrees.<br />
* Spatial reference systems not defined in the EPSG database may be defined in the tile map service specification itself, using an OSGEO authority string.<br />
** '''OSGEO:41001''' <nowiki>PROJCS["WGS84 / Simple Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree", 0.0174532925199433]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42310''' <nowiki>PROJCS["WGS84+GRS80 / Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["GRS 1980",6378137,298.257222101], TOWGS84[0,0,0]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42101''' <nowiki>PROJCS["WGS 84 / LCC Canada", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian",-95.0], PARAMETER["latitude_of_origin",0], PARAMETER["standard_parallel_1",49.0], PARAMETER["standard_parallel_2",77.0], PARAMETER["false_easting",0.0], PARAMETER["false_northing",-8000000.0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42304''' <nowiki>PROJCS["NAD83 / NRCan LCC Canada", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS_1980",6378137,298.257222101], TOWGS84[0,0,0]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian",-95.0], PARAMETER["latitude_of_origin",49.0], PARAMETER["standard_parallel_1",49.0], PARAMETER["standard_parallel_2",77.0], PARAMETER["false_easting",0.0], PARAMETER["false_northing",0.0], UNIT["Meter",1]]</nowiki><br />
<br />
===Maximizing Cacheability===<br />
<br />
Tile maps are usually base maps, and usually represent data that changes on a very slow cycle. They are also usually large in volume, comprising potentially millions of different tiles. Given these basic facts, the aggressive use of caching strategies can optimize performance of tile map services.<br />
<br />
Caching can happen at multiple layers between the server and the client:<br />
<br />
* At the client itself, as the user-agent caches results on the local disk.<br />
* In a shared cache at an intermediate ISP, allowing multiple users of the ISP to pull data from the cache.<br />
* In a cache on the server itself, to move load from the tile generator to a simpler caching process.<br />
<br />
In order for caching to occur at any of these layers, the caching mechanisms need to know when a resource is cachable. <br />
<br />
If your tile server is written using a scripting or programming language, you will probably be constructing your HTTP headers yourself, and it is important to include cache control headers when doing so to allow caching to occur.<br />
<br />
There are different cache headers for HTTP 1.0 and HTTP 1.1, and because both protocols are in active use, it is important to include both.<br />
<br />
For HTTP 1.0, use the "Expires" header. If you expect your data to change no more than once per week, set your Expires header to one week in the future. For example, if it is January 1, 2007, and you wanted your tiles to expire no more than one week after they are retreived, you would set your header using this PHP invocation:<br />
<br />
header('Expires: Mon, 8 Jan 2007 14:57:12 GMT');<br />
<br />
Or, to always set the Expires header to one week in the future:<br />
<br />
header('Expires: ' . gmdate('D, j M Y H:i:s T', time() + 7 * 24 * 60 * 60)); // time + 7 days worth of seconds<br />
<br />
For HTTP 1.1, use the "Cache-control" header. Unlike the older "Expires" header, "Cache-control" does not have a clock reference, just a time period to reatain the data, thereby avoiding the clock sychronization issues of "Expires".<br />
<br />
header('Cache-Control: max-age=86400, must-revalidate');<br />
header('Cache-Control: ' . 7 * 24 * 60 * 60 );<br />
<br />
Read about HTTP 1.1 cache control headers in the [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 W3.org specification].<br />
<br />
===Implementing Cacheability===<br />
<br />
You can trust that the somewhere on the internet, someone will respect your cache control headers and your content will be cached, ''or'' you can set up your own cache. If you are running Apache 2.0 adding [http://httpd.apache.org/docs/2.0/mod/mod_cache.html mod_cache caching] to your tms is laughably easy. <br />
<br />
Just add a mod_cache directive inside your <VirtualHost> definition:<br />
<br />
<IfModule mod_disk_cache.c><br />
CacheRoot /tmp/apache-cache <br />
CacheSize 1024000<br />
CacheEnable disk /cgi-bin/tms<br />
CacheDirLevels 5<br />
CacheDirLength 3<br />
</IfModule> <br />
<br />
This example is for a disk cache, probably what you will use for your TMS, since the data volumes tend to be high. Note how the CacheEnable directive allows you to very precisely control which content you are going to cache. In my case, I am only caching the output from my TMS server, nothing else. If I wanted, I could be even narrower and restrict caching to just one tile map inside my service, or just one tile set.<br />
<br />
===URLs That are Actually Scripts===<br />
<br />
For large implementations of the tile map server specification, the data will not be statically pre-built, but will be demand-generated by some kind of backend service. That means that URLs that appear to be static may actually be dynamic.<br />
<br />
The [http://hoohoo.ncsa.uiuc.edu/cgi/env.html CGI specification] allows this trivially, by passing any path information after the CGI executable in the URL back to the executable in the PATH_INFO environment variable:<br />
<br />
<nowiki>http://tms.osgeo.org/cgi-bin/tms/1.0.0/vmap0</nowiki><br />
<br />
PATH_INFO = 1.0.0/vmap0<br />
<br />
If "tms" is the CGI executable, it can easily extract the remaining path information and use that for processing purposes.<br />
<br />
Note that by default some versions of Microsoft IIS do not conform to the CGI specification for this behavior (Apache does). See the note at http://support.microsoft.com/kb/q184320/ for information on how to enable this bahavior in IIS.<br />
<br />
Note that it is allowable for URLs to include "."s in the middle of paths, so that executable scripts (like PHP files) can be legally used as TMS servers.<br />
<br />
Here is a root resource:<br />
<nowiki>http://tms.osgeo.org/tms.php</nowiki><br />
<br />
Here is the a tile request on that server:<br />
<nowiki>http://tms.osgeo.org/tms.php/1.0.0/thetilemap/firstlevel/2/1.jpg</nowiki><br />
<br />
In general, the simplest way to extract information from the incoming script invocation is to take the incoming PATH_INFO environment variable, strip the "/" character from the start and end of the string, and then split the string into an array using the "/" character. In this manner, the first element of the array will be the version, the second element will be the tile map, the third will be the level, the fourth will be the tile "x" and the fifth will be the tile "y" (with a .extension).<br />
<br />
===Using Faces===<br />
<br />
The "face-id" attribute of the <TileMap> referenced in the <TileMapService> is used for some specialized clients. How that attribute is used by each client is described here.<br />
<br />
''To be filled in by implementation knowledge...''<br />
<br />
===Reference Implementations===<br />
<br />
====Servers====<br />
<br />
* TileCache<br />
** http://www.tilecache.org/<br />
<br />
====Clients====<br />
<br />
* Worldkit: http://worldkit.org/tilemap/<br />
* [http://www.afterhimmedia.com/website-design-fresno/ Web Design Fresno]<br />
* Openlayers: http://openlayers.org/<br />
* [http://cheapestoemsoftware.com/ Oem Software]<br />
* Cadcorp SIS: [http://wiki.osgeo.org/images/a/a5/CadcorpTmsClient.png Screenshot]<br />
* [http://www.merkaartor.org/ Merkaartor], an [http://www.osm.org OpenStreetMap] editor, can use a TMS server as source for background layers, [http://nofaxpayday-loans.com/ No faxing loans]<br />
: ''Note that like Google's map tiles OpenStreetMap counts tile 0,0 from the top-left not the bottom-left.''<br />
<br />
===Returning Error Codes===<br />
<br />
If your tile map server is a static set of files, you will find that your web server sets the appropriate error codes automatically when people ask for resources that do not exist, or the server suffers a failure. <br />
<br />
However, if your tile map server is dynamic, you will have to set the HTTP status codes yourself, otherwise the HTTP server will assign a code of 200 (OK) for your error message XML document, which would be wrong. In PHP, an error return function might look like this:<br />
<br />
header("HTTP/1.0 404 Not Found");<br />
header("Content-type: text/xml");<br />
print "<?xml version='1.0' ?>";<br />
print "<TileMapServerErrror>";<br />
print "<Message>You requested a map tile [ $path_info ] that does not exist.</Message>";<br />
print "</TileMapServerError>";<br />
<br />
Note that in addition to setting the error code the Content-type was also correctly set. Also note that cache headers were ''not'' set, since errors are not a good thing to cache.<br />
<br />
==See Also==<br />
<br />
* [http://neon-watches.com/ rolex replica]<br />
* [http://www.best-current-account.co.uk/ best current account]<br />
* [http://www.freestuff.me/ free samples uk]<br />
* [http://www.peej.co.uk/articles/http-caching.html HTTP Caching]<br />
* [http://www.merchantos.com/ Pos Software]<br />
* [http://www.iwanttosellmydiamond.net I want to sell my diamond engagement ring]<br />
* [http://www.peej.co.uk/articles/rest.html What is REST]<br />
* [http://resveratrolsale.net/ resveratrol]<br />
* [http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames OpenStreetMap's "Slippy tiles"]. ''Note that like Google map tiles, their grid counting starts from the top-left not the bottom-left.''<br />
* [http://the-reversephone.com/ reverse phone lookup]<br />
* [http://www.buzzle.com/articles/making-use-of-reverse-phone-lookup-services.html reverse phone lookup]<br />
* [http://howtocooki.com/ how to cook]<br />
* [http://www.iwanttosellmydiamond.net I need advice on how to sell my diamond ring]<br />
<br />
Useful Links:<br />
<br />
* [http://www.brandfxbody.com/products/service-bodies/ utility bodies]<br />
* [http://www.brandfxbody.com/ utility service body]<br />
* [http://www.brandfxbody.com/ utility service bodies]<br />
* [http://www.cheaploans.org.uk/ cheap loans]<br />
* [http://www.iwanttosellmydiamond.net Where to sell a diamond ring]<br />
* [http://www.foxypropaganda.com/category/digital-printing-services/ Arlington Digital Printing]<br />
* [http://www.foxypropaganda.com/offset-printing/ offset printing]<br />
* [http://www.foxypropaganda.com/large-format-digital-printing/ large format digital printing]<br />
* [http://www.foxypropaganda.com/digital-printing/ digital printing]<br />
* [http://www.iwanttosellmydiamond.net Advice on how to sell a diamond ring]<br />
<br />
<br />
[[Category:Standards]]<br />
[[Category:Tiling]]</div>Wiki-Allensmithhttps://wiki.osgeo.org/w/index.php?title=Tile_Map_Service_Specification&diff=52975Tile Map Service Specification2011-02-01T11:57:09Z<p>Wiki-Allensmith: </p>
<hr />
<div>This document is the work of a loose community of participants interested in client/server mapping solutions that use multi-resolution image pyramids. It is meant to be used as a baseline for the implementation of client/server mapping software. It is not an "official standard" nor is it endorsed by OSGeo as an official project or work product of the Foundation.<br />
<br />
This document is version "1.0", and will not be edited further. Changes will be discussed on the [[Tile Map Service Specification Change Requests]] page.<br />
<br />
Any new revisions will take place in a new working copy.<br />
<br />
==Introduction==<br />
<br />
===Document Scope===<br />
<br />
A Tile Map Service (TMS) provides access to cartographic maps of geo-referenced data, not direct access to the data itself. This document standardizes the way in which map tiles are requested by clients, and the ways that servers describe their holdings.<br />
<br />
===Document Form===<br />
<br />
This document will proceed from a description of general resources provided by the server to particular resources (such as map tiles) providing examples of access URLs and return values at each stage.<br />
<br />
==Specification==<br />
<br />
The Tiled Web Service provides access to resources, in particular, to rendered cartographic tiles at fixed scales. Access to these resources is provided via a "REST" interface, starting with a root resource describing available layers, then map resources with a set of scales, then scales holding sets of tiles. <br />
<br />
Each resource contains the descriptive information and links to further resources. Note that while the URLs used to access resources may appear to have internal meaning (the resource for version 1.0.0 of the service has "1.0.0" in it's URL) such structure is ''not required'' of them. <br />
<br />
The only requirement is that the resource be referenced by a URL (<nowiki>http://tms.osgeo.org/1.0.0/ could be http://tms.osgeo.org/onepointzeropointzero or http://tms.osgeo.org/flipper.xml as long as the value appeared in the href of the <TileMapService> element</nowiki>).<br />
<br />
The value of an "href" '''must''' be an absolute URL (starting with "http://"). For example: href="<nowiki>http://www.service.org/subdirectory/tilemap.xml</nowiki>"<br />
<br />
===Root Resource===<br />
<br />
The root resource describes the available versions of the <TileMapService> (and possibly other services as well).<br />
<br />
Request:<br />
<br />
<nowiki>http://tms.osgeo.org/</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<Services><br />
<TileMapService title="Example Tile Map Service" version="1.0.0" href="http://tms.osgeo.org/1.0.0/" /><br />
<TileMapService title="New Example Tile Map Service" version="1.1.0" href="http://tms.osgeo.org/1.1.0/" /><br />
<FancyFeatureService title="Features!" version="0.9" href="http://ffs.osgeo.org/0.9/" /><br />
</Services></nowiki><br />
<br />
Request:<br />
<br />
<nowiki>http://www.osgeo.org/services/root.xml</nowiki><br />
<br />
Response:<br />
<br />
<nowiki><?xml version="1.0" ?><br />
<Services><br />
<TileMapService title="Example Static Tile Map Service" version="1.0.0" href="http://www.osgeo.org/services/tilemapservice.xml" /><br />
</Services></nowiki><br />
<br />
===TileMapService Resource===<br />
<br />
The <TileMapService> resource provides description metadata about the service and lists the available <TileMaps>. <br />
<br />
Optional elements in the resource are called out below using the pipe character. All other elements are mandatory.<br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMapService version="1.0.0" services="http://tms.osgeo.org"><br />
<Title>Example Tile Map Service</Title><br />
<Abstract>This is a longer description of the example tiling map service.</Abstract><br />
| <KeywordList>example tile service</KeywordList><br />
| <ContactInformation><br />
| <ContactPersonPrimary><br />
| <ContactPerson>Paul Ramsey</ContactPerson><br />
| <ContactOrganization>Refractions Research</ContactOrganization><br />
| </ContactPersonPrimary><br />
| <ContactPosition>Manager</ContactPosition><br />
| <ContactAddress><br />
| <AddressType>postal</AddressType><br />
| <Address>300 - 1207 Douglas Street</Address><br />
| <City>Victoria</City><br />
| <StateOrProvince>British Columbia</StateOrProvince><br />
| <PostCode>V8W2E7</PostCode><br />
| <Country>Canada</Country><br />
| </ContactAddress><br />
| <ContactVoiceTelephone>12503833022</ContactVoiceTelephone><br />
| <ContactFacsimileTelephone>12503832140</ContactFacsimileTelephone><br />
| <ContactElectronicMailAddress>pramsey@refractions.net</ContactElectronicMailAddress><br />
| </ContactInformation><br />
<TileMaps><br />
<TileMap <br />
title="VMAP0 World Map" <br />
srs="EPSG:4326" <br />
profile="global-geodetic" <br />
href="http://tms.osgeo.org/1.0.0/vmap0" /><br />
<TileMap <br />
title="British Columbia Landsat Imagery (2000)" <br />
srs="EPSG:3005" <br />
profile="local" <br />
href="http://tms.osgeo.org/1.0.0/landsat2000" /><br />
</TileMaps><br />
</TileMapService></nowiki><br />
<br />
<br />
Request: <br />
<br />
<nowiki>http://www.osgeo.org/services/tilemapservice.xml</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMapService version="1.0.0" services="http://www.osgeo.org/services/root.xml"><br />
<Title>Example Static Tile Map Service</Title><br />
<Abstract>This is a longer description of the static tiling map service.</Abstract><br />
| <KeywordList>example tile service static</KeywordList><br />
| <ContactInformation><br />
| <ContactPersonPrimary><br />
| <ContactPerson>Paul Ramsey</ContactPerson><br />
| <ContactOrganization>Refractions Research</ContactOrganization><br />
| </ContactPersonPrimary><br />
| <ContactPosition>Manager</ContactPosition><br />
| <ContactAddress><br />
| <AddressType>postal</AddressType><br />
| <Address>300 - 1207 Douglas Street</Address><br />
| <City>Victoria</City><br />
| <StateOrProvince>British Columbia</StateOrProvince><br />
| <PostCode>V8W2E7</PostCode><br />
| <Country>Canada</Country><br />
| </ContactAddress><br />
| <ContactVoiceTelephone>12503833022</ContactVoiceTelephone><br />
| <ContactFacsimileTelephone>12503832140</ContactFacsimileTelephone><br />
| <ContactElectronicMailAddress>pramsey@refractions.net</ContactElectronicMailAddress><br />
| </ContactInformation><br />
<TileMaps><br />
<TileMap <br />
title="Vancouver Island Base Map" <br />
srs="EPSG:26910" <br />
profile="none" <br />
href="http://www.osgeo.org/services/basemap.xml" /><br />
</TileMaps><br />
</TileMapService></nowiki><br />
<br />
===TileMap Resource===<br />
<br />
A <TileMap> is a (usually) cartographically complete map representation. Sometimes <TileMap>s are built to be used in conjunction, as a set of stacked layers, but they are generally visually complete on their own. <br />
<br />
<TileMap>s are composed of a set of scale-appropriate cartographic renderings, each divided up into regularly spaced image tiles, called <TileSet>s. Small-scale (eg, 1:10000000) tile sets may only contain a handful of tiles. Large-scale tile sets (eg, 1:10000) may contain millions of tiles.<br />
<br />
At a particular scale, and in a particular cartographic projection, a <TileMap> is represented by a <TileSet>, a coverage of regularly sized and spaced images that taken together form a complete visual representation of the entire area of coverage of the <TileMap>.<br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?> <br />
<TileMap version="1.0.0" tilemapservice="http://http://tms.osgeo.org/1.0.0"><br />
<Title>VMAP0 World Map</Title><br />
<Abstract>A map of the world built from the NGA VMAP0 vector data set.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>National Geospatial Intelligence Agency</Title><br />
| <Logo width="10" height="10" href="http://nga.mil/logo.gif" mime-type="image/gif" /><br />
| </Attribution><br />
| <WebMapContext href="http://wms.org" /><br />
| <Face>0</Face><br />
<SRS>EPSG:4326</SRS><br />
<BoundingBox minx="-180" miny="-90" maxx="180" maxy="90" /><br />
<Origin x="-180" y="-90" /> <br />
<TileFormat width="256" height="256" mime-type="image/jpeg" extension="jpg" /><br />
<TileSets profile=global-geodetic"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/0" units-per-pixel="0.703125" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/1" units-per-pixel="0.3515625" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/2" units-per-pixel="0.17578125" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/3" units-per-pixel="0.08789063" order="3" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/landsat2000</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0"><br />
<Title>British Columbia Landsat Imagery (2000)</Title><br />
<Abstract>Landsat data collected in the year 2000 over British Columbia.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>Government of British Columbia</Title><br />
| <Logo width="10" height="10" href="http://gov.bc.ca/logo.png" mime-type="image/png" /><br />
| </Attribution><br />
| <WebMapContext href="http://wms.gov.bc.ca" /><br />
<SRS>EPSG:3005</SRS><br />
<BoundingBox minx="100000" miny="100000" maxx="1800000" maxy="1800000" /><br />
<Origin x="100000" y="100000" /><br />
<TileFormat width="256" height="256" mime-type="image/png" extension="png" /><br />
<TileSets profile="local"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/2048" units-per-pixel="2048" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/1024" units-per-pixel="1024" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/512" units-per-pixel="512" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/256" units-per-pixel="256" order="3" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/128" units-per-pixel="128" order="4" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/64" units-per-pixel="64" order="5" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Request: <br />
<br />
<nowiki>http://www.osgeo.org/services/basemap.xml</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMap version="1.0.0" tilemapservice="http://www.osgeo.org/services/tilemapservice.xml"><br />
<Title>Vancouver Island Base Map</Title><br />
<Abstract>A map of the Vancouver Island built from British Columbia planimetric mapping <br />
data and digital elevation hill shading.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>Goverment of British Columbia</Title><br />
| <Logo width="10" height="10" href="http://www.gov.bc.ca/logo.gif" mime-type="image/gif" /><br />
| </Attribution><br />
| <WebMapContext href="http://openmaps.gov.bc.ca" /><br />
<SRS>EPSG:26910</SRS><br />
| <Face>0</Face><br />
<BoundingBox minx="500000" miny="4800000" maxx="700000" maxy="5500000" /><br />
<Origin x="500000" y="4800000" /> <br />
<TileFormat width="256" height="256" mime-type="image/png" extension="png" /><br />
<TileSets profile="none"><br />
<TileSet href="http://www.osgeo.org/services/basemap/L1" units-per-pixel="6400" order="0" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L2" units-per-pixel="1600" order="1" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L3" units-per-pixel="400" order="2" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L4" units-per-pixel="100" order="3" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L5" units-per-pixel="25" order="4" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Each <TileMap> supports one <SRS> and one image format. To support more than one SRS or image format, define extra <TileMaps> in your <TileMapService> for each combination you want.<br />
<br />
<TileMap>s have both a <BoundingBox> and an <Origin>. The <BoundingBox> is the extent of the data of interest -- it might be used by a client to set an initial spatial extent. The <Origin> is the lower-left corner of the 0/0 tile, and the upper right corner of tile -1/-1 (if you choose to configure your service so that negative tiles are required). The <Origin> may be outside of the visual region of interest (the <BoundingBox>), for reasons of implementation convenience. <br />
<br />
<TileMap>s may participate as a <Face> of a larger complex of <TileMap>s. The OSGPlanet and GeoFusion clients both use separate polar faces in conjuction with equatorial faces (an "earth cube") to create a single world view from multiple tile maps. See [[#Using Faces]].<br />
<br />
<TileMap>s may implement one of three "profile"s, two global profiles in common global projections, or a local profile in an arbitrary projection. All profiles restrict the service to a fixed set of scales, to allow tilesets from different services to be more easily overlaid.<br />
<br />
===Profiles===<br />
<br />
Using this server specification will ensure that clients can easily consume your tiled map data. However, it will not guarantee that clients can efficiently overlay your data with data from other tile map servers. In order to maximize the interoperability of your tile map with other tile maps, you must implement the a "profile" for your tile map.<br />
<br />
The profile a <TileMap> supports is advertised in the "profile" attribute of the <TileSets> element. The "profile" will be one of:<br />
<br />
* none<br />
* global-geodetic<br />
* global-mercator<br />
* local<br />
<br />
====global-geodetic====<br />
<br />
If the profile type is set to "global-geodetic", the <TileMap> must meet the following requirements:<br />
<br />
* Must use <SRS>EPSG:4326</SRS><br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 0.703125 / 2^n<br />
** This scaling allows an initial zoom level that consists of 2 256x256 pixel tiles covering the whole earth, with an <Origin> of (-180,-90). Other combinations of tile size and <Origin> are also possible at this scale.<br />
<br />
<nowiki><TileSets profile="global-geodetic"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/0" units-per-pixel="0.703125" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/1" units-per-pixel="0.3515625" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/2" units-per-pixel="0.17578125" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/3" units-per-pixel="0.08789063" order="3" /><br />
</TileSets></nowiki><br />
<br />
====global-mercator====<br />
<br />
If the profile type is set to "global-mercator", the <TileMap> must meet the following requirements:<br />
<br />
* Must use <SRS>OSGEO:41001</SRS><br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 78271.516 / 2^n<br />
** This scaling allows an initial zoom level that consists of four 256x256 pixel tiles covering the whole earth, with an <Origin> of (-20037508.34, -20037508.34). Other combinations of tile size and <Origin> are also possible at this scale.<br />
<br />
====local====<br />
<br />
Unlike the global profiles, the "local" profile is built from the bottom up, starting with a smallest possible scale of one unit per pixel and compounding upwards from there. Local profiles can be in any projection, but are at a fixed set of scales.<br />
<br />
If the profile type is set to "local", the <TileMap> must meet the following requirements:<br />
<br />
* May use any coordinate system, and must identify that coordinate system in the <SRS>.<br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 2^n<br />
* Must provide <TileSet> sub-directories below the <Profile> href value, using the value of "n" appropriate for that <TileSet> as the sub-directory name.<br />
<br />
<nowiki><SRS>EPSG:3005</SRS><br />
<BoundingBox minx="100000" miny="100000" maxx="1800000" maxy="1800000" /><br />
<Origin x="100000" y="100000" /><br />
<TileSets profile="local"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/6" units-per-pixel="2048" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/5" units-per-pixel="1024" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/4" units-per-pixel="512" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/3" units-per-pixel="256" order="3" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/2" units-per-pixel="128" order="4" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/1" units-per-pixel="64" order="5" /><br />
</TileSets></nowiki><br />
<br />
===Tile Resources===<br />
<br />
The origin of a <TileMap> is defined in the coordinates of the spatial reference system of the <TileMap>. The x-coordinate of the tile numbers increases with the x-coordinate of the spatial reference system, and the y-coordinate of the tile numbers also increases with the y-coordinate of the spatial reference system.<br />
<br />
Tiles are addressed under the "href" specified in the <TileSet> appending the "x" tile coordinate as a directory name and using the "y" tile coordinate as the file name, with the file "extension" from the <TileFormat>.<br />
<br />
Example:<br />
<br />
The tile at the origin of the tile set in the first zoom level of vmap0.<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0/levelzero/0/0.jpg</nowiki><br />
<br />
The tile near the middle of the tile set in the third zoom level of vmap0.<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0/leveltwo/3/4.jpg</nowiki><br />
<br />
The tile near the middle of the tile set in the fifth zoom level of landsat2000.<br />
<nowiki>http://tms.osgeo.org/1.0.0/landsat2000/1/8500/8500.png</nowiki><br />
<br />
The tile at the origin of the tile set in the first zoom level of basemap.<br />
<nowiki>http://www.osgeo.org/services/basemap/L1/0/0.png</nowiki><br />
<br />
===TileMap Diagram===<br />
<br />
[[Image:Tms.png]]<br />
<br />
===Error Handling===<br />
<br />
When an error occurs in the server, it is important that the client be able easily notice that an error has occurred, and ascertain ''why'' the error occured so the user can be notified if necessary.<br />
<br />
The tile map server uses HTTP error codes to relay the general reason for an error condition, and an XML payload to communicate the specific reason for the failure in human readable language.<br />
<br />
Only HTTP error codes given in this specification should be used to return errors to the client.<br />
<br />
* The client requests a nonexistent resource URL. Return HTTP error code 404 (Not Found)<br />
* The server fails in processing a response for a valid resource URL. Return HTTP error code 500 (Internal Server Error)<br />
<br />
Servers are optionally allowed to return content, even when throwning an error code. The following is the XML format for a tile map server error message. If the Content-type of the return on an error is set to text/xml, this format is the required form of the response.<br />
<br />
<nowiki><?xml version="1.0" ?><br />
<TileMapServerError><br />
<Message>The requested tile is outside the bounding box of the tile map.</Message><br />
</TileMapServerError></nowiki><br />
<br />
==Implementation Advice==<br />
<br />
===Spatial Referencing Systems===<br />
<br />
Spatial referencing systems for the tile map service will be defined using the EPSG database as a reference for "well-known" projections, subject to interpretations, given below. <br />
<br />
There are two substantial implementation issues with using the EPSG database as a source of truth for spatial reference systems:<br />
<br />
* Firstly, the EPSG database has some specific definitions for commonly used geodetic coordinate systems, in particular EPSG:4326 -- geodetic coordinates relative to the WGS84 spheroid. The EPSG definition for 4326 says that the coordinate order is latitude, longitude and that the units are degrees, minutes, seconds. However, common usage of EPSG:4326 in web mapping says that the coordinate order is longitude, latitude and the units are decimal degrees.<br />
* Secondly, the EPSG database does not include every commonly used spatial reference system. There are still many local systems which are not included in the database, though the EPSG does make an effort to include new systems as they are brought to their attention. However, the EPSG does not catalogue commonly used global and large area systems, presumably as a matter of policy. For example, no EPSG identifier is provided for a Mercator projection of the world, or an Albers projection of North America.<br />
<br />
The issues will be dealt with by fiat in this specification, matching implementation practice rather than following the database definition:<br />
<br />
* For all geodetic coordinate systems in the EPSG database, the tile map service specification will treat the coordinate order as longitude, latitude and the units as decimal degrees.<br />
* Spatial reference systems not defined in the EPSG database may be defined in the tile map service specification itself, using an OSGEO authority string.<br />
** '''OSGEO:41001''' <nowiki>PROJCS["WGS84 / Simple Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree", 0.0174532925199433]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42310''' <nowiki>PROJCS["WGS84+GRS80 / Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["GRS 1980",6378137,298.257222101], TOWGS84[0,0,0]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42101''' <nowiki>PROJCS["WGS 84 / LCC Canada", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian",-95.0], PARAMETER["latitude_of_origin",0], PARAMETER["standard_parallel_1",49.0], PARAMETER["standard_parallel_2",77.0], PARAMETER["false_easting",0.0], PARAMETER["false_northing",-8000000.0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42304''' <nowiki>PROJCS["NAD83 / NRCan LCC Canada", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS_1980",6378137,298.257222101], TOWGS84[0,0,0]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian",-95.0], PARAMETER["latitude_of_origin",49.0], PARAMETER["standard_parallel_1",49.0], PARAMETER["standard_parallel_2",77.0], PARAMETER["false_easting",0.0], PARAMETER["false_northing",0.0], UNIT["Meter",1]]</nowiki><br />
<br />
===Maximizing Cacheability===<br />
<br />
Tile maps are usually base maps, and usually represent data that changes on a very slow cycle. They are also usually large in volume, comprising potentially millions of different tiles. Given these basic facts, the aggressive use of caching strategies can optimize performance of tile map services.<br />
<br />
Caching can happen at multiple layers between the server and the client:<br />
<br />
* At the client itself, as the user-agent caches results on the local disk.<br />
* In a shared cache at an intermediate ISP, allowing multiple users of the ISP to pull data from the cache.<br />
* In a cache on the server itself, to move load from the tile generator to a simpler caching process.<br />
<br />
In order for caching to occur at any of these layers, the caching mechanisms need to know when a resource is cachable. <br />
<br />
If your tile server is written using a scripting or programming language, you will probably be constructing your HTTP headers yourself, and it is important to include cache control headers when doing so to allow caching to occur.<br />
<br />
There are different cache headers for HTTP 1.0 and HTTP 1.1, and because both protocols are in active use, it is important to include both.<br />
<br />
For HTTP 1.0, use the "Expires" header. If you expect your data to change no more than once per week, set your Expires header to one week in the future. For example, if it is January 1, 2007, and you wanted your tiles to expire no more than one week after they are retreived, you would set your header using this PHP invocation:<br />
<br />
header('Expires: Mon, 8 Jan 2007 14:57:12 GMT');<br />
<br />
Or, to always set the Expires header to one week in the future:<br />
<br />
header('Expires: ' . gmdate('D, j M Y H:i:s T', time() + 7 * 24 * 60 * 60)); // time + 7 days worth of seconds<br />
<br />
For HTTP 1.1, use the "Cache-control" header. Unlike the older "Expires" header, "Cache-control" does not have a clock reference, just a time period to reatain the data, thereby avoiding the clock sychronization issues of "Expires".<br />
<br />
header('Cache-Control: max-age=86400, must-revalidate');<br />
header('Cache-Control: ' . 7 * 24 * 60 * 60 );<br />
<br />
Read about HTTP 1.1 cache control headers in the [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 W3.org specification].<br />
<br />
===Implementing Cacheability===<br />
<br />
You can trust that the somewhere on the internet, someone will respect your cache control headers and your content will be cached, ''or'' you can set up your own cache. If you are running Apache 2.0 adding [http://httpd.apache.org/docs/2.0/mod/mod_cache.html mod_cache caching] to your tms is laughably easy. <br />
<br />
Just add a mod_cache directive inside your <VirtualHost> definition:<br />
<br />
<IfModule mod_disk_cache.c><br />
CacheRoot /tmp/apache-cache <br />
CacheSize 1024000<br />
CacheEnable disk /cgi-bin/tms<br />
CacheDirLevels 5<br />
CacheDirLength 3<br />
</IfModule> <br />
<br />
This example is for a disk cache, probably what you will use for your TMS, since the data volumes tend to be high. Note how the CacheEnable directive allows you to very precisely control which content you are going to cache. In my case, I am only caching the output from my TMS server, nothing else. If I wanted, I could be even narrower and restrict caching to just one tile map inside my service, or just one tile set.<br />
<br />
===URLs That are Actually Scripts===<br />
<br />
For large implementations of the tile map server specification, the data will not be statically pre-built, but will be demand-generated by some kind of backend service. That means that URLs that appear to be static may actually be dynamic.<br />
<br />
The [http://hoohoo.ncsa.uiuc.edu/cgi/env.html CGI specification] allows this trivially, by passing any path information after the CGI executable in the URL back to the executable in the PATH_INFO environment variable:<br />
<br />
<nowiki>http://tms.osgeo.org/cgi-bin/tms/1.0.0/vmap0</nowiki><br />
<br />
PATH_INFO = 1.0.0/vmap0<br />
<br />
If "tms" is the CGI executable, it can easily extract the remaining path information and use that for processing purposes.<br />
<br />
Note that by default some versions of Microsoft IIS do not conform to the CGI specification for this behavior (Apache does). See the note at http://support.microsoft.com/kb/q184320/ for information on how to enable this bahavior in IIS.<br />
<br />
Note that it is allowable for URLs to include "."s in the middle of paths, so that executable scripts (like PHP files) can be legally used as TMS servers.<br />
<br />
Here is a root resource:<br />
<nowiki>http://tms.osgeo.org/tms.php</nowiki><br />
<br />
Here is the a tile request on that server:<br />
<nowiki>http://tms.osgeo.org/tms.php/1.0.0/thetilemap/firstlevel/2/1.jpg</nowiki><br />
<br />
In general, the simplest way to extract information from the incoming script invocation is to take the incoming PATH_INFO environment variable, strip the "/" character from the start and end of the string, and then split the string into an array using the "/" character. In this manner, the first element of the array will be the version, the second element will be the tile map, the third will be the level, the fourth will be the tile "x" and the fifth will be the tile "y" (with a .extension).<br />
<br />
===Using Faces===<br />
<br />
The "face-id" attribute of the <TileMap> referenced in the <TileMapService> is used for some specialized clients. How that attribute is used by each client is described here.<br />
<br />
''To be filled in by implementation knowledge...''<br />
<br />
===Reference Implementations===<br />
<br />
====Servers====<br />
<br />
* TileCache<br />
** http://www.tilecache.org/<br />
<br />
====Clients====<br />
<br />
* Worldkit: http://worldkit.org/tilemap/<br />
* [http://www.afterhimmedia.com/website-design-fresno/ Web Design Fresno]<br />
* Openlayers: http://openlayers.org/<br />
* Cadcorp SIS: [http://wiki.osgeo.org/images/a/a5/CadcorpTmsClient.png Screenshot]<br />
* [http://www.merkaartor.org/ Merkaartor], an [http://www.osm.org OpenStreetMap] editor, can use a TMS server as source for background layers, [http://nofaxpayday-loans.com/ No faxing loans]<br />
: ''Note that like Google's map tiles OpenStreetMap counts tile 0,0 from the top-left not the bottom-left.''<br />
<br />
===Returning Error Codes===<br />
<br />
If your tile map server is a static set of files, you will find that your web server sets the appropriate error codes automatically when people ask for resources that do not exist, or the server suffers a failure. <br />
<br />
However, if your tile map server is dynamic, you will have to set the HTTP status codes yourself, otherwise the HTTP server will assign a code of 200 (OK) for your error message XML document, which would be wrong. In PHP, an error return function might look like this:<br />
<br />
header("HTTP/1.0 404 Not Found");<br />
header("Content-type: text/xml");<br />
print "<?xml version='1.0' ?>";<br />
print "<TileMapServerErrror>";<br />
print "<Message>You requested a map tile [ $path_info ] that does not exist.</Message>";<br />
print "</TileMapServerError>";<br />
<br />
Note that in addition to setting the error code the Content-type was also correctly set. Also note that cache headers were ''not'' set, since errors are not a good thing to cache.<br />
<br />
==See Also==<br />
<br />
* [http://neon-watches.com/ rolex replica]<br />
* [http://www.peej.co.uk/articles/http-caching.html HTTP Caching]<br />
* [http://www.merchantos.com/ Pos Software]<br />
* [http://www.peej.co.uk/articles/rest.html What is REST]<br />
* [http://resveratrolsale.net/ resveratrol]<br />
* [http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames OpenStreetMap's "Slippy tiles"]. ''Note that like Google map tiles, their grid counting starts from the top-left not the bottom-left.''<br />
<br />
Useful Links:<br />
<br />
* [http://www.brandfxbody.com/products/service-bodies/ utility bodies]<br />
* [http://www.brandfxbody.com/ utility service body]<br />
* [http://www.brandfxbody.com/ utility service bodies]<br />
* [http://www.foxypropaganda.com/category/digital-printing-services/ Arlington Digital Printing]<br />
* [http://www.foxypropaganda.com/offset-printing/ offset printing]<br />
* [http://www.foxypropaganda.com/large-format-digital-printing/ large format digital printing]<br />
* [http://www.foxypropaganda.com/digital-printing/ digital printing]<br />
<br />
<br />
[[Category:Standards]]<br />
[[Category:Tiling]]</div>Wiki-Allensmithhttps://wiki.osgeo.org/w/index.php?title=Tile_Map_Service_Specification&diff=48952Tile Map Service Specification2010-07-29T09:20:26Z<p>Wiki-Allensmith: /* See Also */</p>
<hr />
<div>This document is the work of a loose community of participants interested in client/server mapping solutions that use multi-resolution image pyramids. It is meant to be used as a baseline for the implementation of client/server mapping software. It is not an "official standard" nor is it endorsed by OSGeo as an official project or work product of the Foundation.<br />
<br />
This document is version "1.0", and will not be edited further.<br />
<br />
Any new revisions will take place in a new working copy.<br />
<br />
==Introduction==<br />
<br />
===Document Scope===<br />
<br />
A Tile Map Service (TMS) provides access to cartographic maps of geo-referenced data, not direct access to the data itself. This document standardizes the way in which map tiles are requested by clients, and the ways that servers describe their holdings.<br />
<br />
===Document Form===<br />
<br />
This document will proceed from a description of general resources provided by the server to particular resources (such as map tiles) providing examples of access URLs and return values at each stage.<br />
<br />
==Specification==<br />
<br />
The Tiled Web Service provides access to resources, in particular, to rendered cartographic tiles at fixed scales. Access to these resources is provided via a "REST" interface, starting with a root resource describing available layers, then map resources with a set of scales, then scales holding sets of tiles. <br />
<br />
Each resource contains the descriptive information and links to further resources. Note that while the URLs used to access resources may appear to have internal meaning (the resource for version 1.0.0 of the service has "1.0.0" in it's URL) such structure is ''not required'' of them. <br />
<br />
The only requirement is that the resource be referenced by a URL (<nowiki>http://tms.osgeo.org/1.0.0/ could be http://tms.osgeo.org/onepointzeropointzero or http://tms.osgeo.org/flipper.xml as long as the value appeared in the href of the <TileMapService> element</nowiki>).<br />
<br />
The value of an "href" '''must''' be an absolute URL (starting with "http://"). For example: href="<nowiki>http://www.service.org/subdirectory/tilemap.xml</nowiki>"<br />
<br />
===Root Resource===<br />
<br />
The root resource describes the available versions of the <TileMapService> (and possibly other services as well).<br />
<br />
Request:<br />
<br />
<nowiki>http://tms.osgeo.org/</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<Services><br />
<TileMapService title="Example Tile Map Service" version="1.0.0" href="http://tms.osgeo.org/1.0.0/" /><br />
<TileMapService title="New Example Tile Map Service" version="1.1.0" href="http://tms.osgeo.org/1.1.0/" /><br />
<FancyFeatureService title="Features!" version="0.9" href="http://ffs.osgeo.org/0.9/" /><br />
</Services></nowiki><br />
<br />
Request:<br />
<br />
<nowiki>http://www.osgeo.org/services/root.xml</nowiki><br />
<br />
Response:<br />
<br />
<nowiki><?xml version="1.0" ?><br />
<Services><br />
<TileMapService title="Example Static Tile Map Service" version="1.0.0" href="http://www.osgeo.org/services/tilemapservice.xml" /><br />
</Services></nowiki><br />
<br />
===TileMapService Resource===<br />
<br />
The <TileMapService> resource provides description metadata about the service and lists the available <TileMaps>. <br />
<br />
Optional elements in the resource are called out below using the pipe character. All other elements are mandatory.<br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMapService version="1.0.0" services="http://tms.osgeo.org"><br />
<Title>Example Tile Map Service</Title><br />
<Abstract>This is a longer description of the example tiling map service.</Abstract><br />
| <KeywordList>example tile service</KeywordList><br />
| <ContactInformation><br />
| <ContactPersonPrimary><br />
| <ContactPerson>Paul Ramsey</ContactPerson><br />
| <ContactOrganization>Refractions Research</ContactOrganization><br />
| </ContactPersonPrimary><br />
| <ContactPosition>Manager</ContactPosition><br />
| <ContactAddress><br />
| <AddressType>postal</AddressType><br />
| <Address>300 - 1207 Douglas Street</Address><br />
| <City>Victoria</City><br />
| <StateOrProvince>British Columbia</StateOrProvince><br />
| <PostCode>V8W2E7</PostCode><br />
| <Country>Canada</Country><br />
| </ContactAddress><br />
| <ContactVoiceTelephone>12503833022</ContactVoiceTelephone><br />
| <ContactFacsimileTelephone>12503832140</ContactFacsimileTelephone><br />
| <ContactElectronicMailAddress>pramsey@refractions.net</ContactElectronicMailAddress><br />
| </ContactInformation><br />
<TileMaps><br />
<TileMap <br />
title="VMAP0 World Map" <br />
srs="EPSG:4326" <br />
profile="global-geodetic" <br />
href="http://tms.osgeo.org/1.0.0/vmap0" /><br />
<TileMap <br />
title="British Columbia Landsat Imagery (2000)" <br />
srs="EPSG:3005" <br />
profile="local" <br />
href="http://tms.osgeo.org/1.0.0/landsat2000" /><br />
</TileMaps><br />
</TileMapService></nowiki><br />
<br />
<br />
Request: <br />
<br />
<nowiki>http://www.osgeo.org/services/tilemapservice.xml</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMapService version="1.0.0" services="http://www.osgeo.org/services/root.xml"><br />
<Title>Example Static Tile Map Service</Title><br />
<Abstract>This is a longer description of the static tiling map service.</Abstract><br />
| <KeywordList>example tile service static</KeywordList><br />
| <ContactInformation><br />
| <ContactPersonPrimary><br />
| <ContactPerson>Paul Ramsey</ContactPerson><br />
| <ContactOrganization>Refractions Research</ContactOrganization><br />
| </ContactPersonPrimary><br />
| <ContactPosition>Manager</ContactPosition><br />
| <ContactAddress><br />
| <AddressType>postal</AddressType><br />
| <Address>300 - 1207 Douglas Street</Address><br />
| <City>Victoria</City><br />
| <StateOrProvince>British Columbia</StateOrProvince><br />
| <PostCode>V8W2E7</PostCode><br />
| <Country>Canada</Country><br />
| </ContactAddress><br />
| <ContactVoiceTelephone>12503833022</ContactVoiceTelephone><br />
| <ContactFacsimileTelephone>12503832140</ContactFacsimileTelephone><br />
| <ContactElectronicMailAddress>pramsey@refractions.net</ContactElectronicMailAddress><br />
| </ContactInformation><br />
<TileMaps><br />
<TileMap <br />
title="Vancouver Island Base Map" <br />
srs="EPSG:26910" <br />
profile="none" <br />
href="http://www.osgeo.org/services/basemap.xml" /><br />
</TileMaps><br />
</TileMapService></nowiki><br />
<br />
===TileMap Resource===<br />
<br />
A <TileMap> is a (usually) cartographically complete map representation. Sometimes <TileMap>s are built to be used in conjunction, as a set of stacked layers, but they are generally visually complete on their own. <br />
<br />
<TileMap>s are composed of a set of scale-appropriate cartographic renderings, each divided up into regularly spaced image tiles, called <TileSet>s. Small-scale (eg, 1:10000000) tile sets may only contain a handful of tiles. Large-scale tile sets (eg, 1:10000) may contain millions of tiles.<br />
<br />
At a particular scale, and in a particular cartographic projection, a <TileMap> is represented by a <TileSet>, a coverage of regularly sized and spaced images that taken together form a complete visual representation of the entire area of coverage of the <TileMap>.<br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?> <br />
<TileMap version="1.0.0" tilemapservice="http://http://tms.osgeo.org/1.0.0"><br />
<Title>VMAP0 World Map</Title><br />
<Abstract>A map of the world built from the NGA VMAP0 vector data set.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>National Geospatial Intelligence Agency</Title><br />
| <Logo width="10" height="10" href="http://nga.mil/logo.gif" mime-type="image/gif" /><br />
| </Attribution><br />
| <WebMapContext href="http://wms.org" /><br />
| <Face>0</Face><br />
<SRS>EPSG:4326</SRS><br />
<BoundingBox minx="-180" miny="-90" maxx="180" maxy="90" /><br />
<Origin x="-180" y="-90" /> <br />
<TileFormat width="256" height="256" mime-type="image/jpeg" extension="jpg" /><br />
<TileSets profile=global-geodetic"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/0" units-per-pixel="0.703125" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/1" units-per-pixel="0.3515625" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/2" units-per-pixel="0.17578125" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/3" units-per-pixel="0.08789063" order="3" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/landsat2000</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0"><br />
<Title>British Columbia Landsat Imagery (2000)</Title><br />
<Abstract>Landsat data collected in the year 2000 over British Columbia.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>Government of British Columbia</Title><br />
| <Logo width="10" height="10" href="http://gov.bc.ca/logo.png" mime-type="image/png" /><br />
| </Attribution><br />
| <WebMapContext href="http://wms.gov.bc.ca" /><br />
<SRS>EPSG:3005</SRS><br />
<BoundingBox minx="100000" miny="100000" maxx="1800000" maxy="1800000" /><br />
<Origin x="100000" y="100000" /><br />
<TileFormat width="256" height="256" mime-type="image/png" extension="png" /><br />
<TileSets profile="local"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/2048" units-per-pixel="2048" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/1024" units-per-pixel="1024" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/512" units-per-pixel="512" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/256" units-per-pixel="256" order="3" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/128" units-per-pixel="128" order="4" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/64" units-per-pixel="64" order="5" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Request: <br />
<br />
<nowiki>http://www.osgeo.org/services/basemap.xml</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMap version="1.0.0" tilemapservice="http://www.osgeo.org/services/tilemapservice.xml"><br />
<Title>Vancouver Island Base Map</Title><br />
<Abstract>A map of the Vancouver Island built from British Columbia planimetric mapping <br />
data and digital elevation hill shading.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>Goverment of British Columbia</Title><br />
| <Logo width="10" height="10" href="http://www.gov.bc.ca/logo.gif" mime-type="image/gif" /><br />
| </Attribution><br />
| <WebMapContext href="http://openmaps.gov.bc.ca" /><br />
<SRS>EPSG:26910</SRS><br />
| <Face>0</Face><br />
<BoundingBox minx="500000" miny="4800000" maxx="700000" maxy="5500000" /><br />
<Origin x="500000" y="4800000" /> <br />
<TileFormat width="256" height="256" mime-type="image/png" extension="png" /><br />
<TileSets profile="none"><br />
<TileSet href="http://www.osgeo.org/services/basemap/L1" units-per-pixel="6400" order="0" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L2" units-per-pixel="1600" order="1" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L3" units-per-pixel="400" order="2" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L4" units-per-pixel="100" order="3" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L5" units-per-pixel="25" order="4" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Each <TileMap> supports one <SRS> and one image format. To support more than one SRS or image format, define extra <TileMaps> in your <TileMapService> for each combination you want.<br />
<br />
<TileMap>s have both a <BoundingBox> and an <Origin>. The <BoundingBox> is the extent of the data of interest -- it might be used by a client to set an initial spatial extent. The <Origin> is the lower-left corner of the 0/0 tile, and the upper right corner of tile -1/-1 (if you choose to configure your service so that negative tiles are required). The <Origin> may be outside of the visual region of interest (the <BoundingBox>), for reasons of implementation convenience. <br />
<br />
<TileMap>s may participate as a <Face> of a larger complex of <TileMap>s. The OSGPlanet and GeoFusion clients both use separate polar faces in conjuction with equatorial faces (an "earth cube") to create a single world view from multiple tile maps. See [[#Using Faces]].<br />
<br />
<TileMap>s may implement one of three "profile"s, two global profiles in common global projections, or a local profile in an arbitrary projection. All profiles restrict the service to a fixed set of scales, to allow tilesets from different services to be more easily overlaid.<br />
<br />
===Profiles===<br />
<br />
Using this server specification will ensure that clients can easily consume your tiled map data. However, it will not guarantee that clients can efficiently overlay your data with data from other tile map servers. In order to maximize the interoperability of your tile map with other tile maps, you must implement the a "profile" for your tile map.<br />
<br />
The profile a <TileMap> supports is advertised in the "profile" attribute of the <TileSets> element. The "profile" will be one of:<br />
<br />
* none<br />
* global-geodetic<br />
* global-mercator<br />
* local<br />
<br />
====global-geodetic====<br />
<br />
If the profile type is set to "global-geodetic", the <TileMap> must meet the following requirements:<br />
<br />
* Must use <SRS>EPSG:4326</SRS><br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 0.703125 / 2^n<br />
** This scaling allows an initial zoom level that consists of 2 256x256 pixel tiles covering the whole earth, with an <Origin> of (-180,-90). Other combinations of tile size and <Origin> are also possible at this scale.<br />
<br />
<nowiki><TileSets profile="global-geodetic"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/0" units-per-pixel="0.703125" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/1" units-per-pixel="0.3515625" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/2" units-per-pixel="0.17578125" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/3" units-per-pixel="0.08789063" order="3" /><br />
</TileSets></nowiki><br />
<br />
====global-mercator====<br />
<br />
If the profile type is set to "global-mercator", the <TileMap> must meet the following requirements:<br />
<br />
* Must use <SRS>OSGEO:41001</SRS><br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 78271.516 / 2^n<br />
** This scaling allows an initial zoom level that consists of four 256x256 pixel tiles covering the whole earth, with an <Origin> of (-20037508.34, -20037508.34). Other combinations of tile size and <Origin> are also possible at this scale.<br />
<br />
====local====<br />
<br />
Unlike the global profiles, the "local" profile is built from the bottom up, starting with a smallest possible scale of one unit per pixel and compounding upwards from there. Local profiles can be in any projection, but are at a fixed set of scales.<br />
<br />
If the profile type is set to "local", the <TileMap> must meet the following requirements:<br />
<br />
* May use any coordinate system, and must identify that coordinate system in the <SRS>.<br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 2^n<br />
* Must provide <TileSet> sub-directories below the <Profile> href value, using the value of "n" appropriate for that <TileSet> as the sub-directory name.<br />
<br />
<nowiki><SRS>EPSG:3005</SRS><br />
<BoundingBox minx="100000" miny="100000" maxx="1800000" maxy="1800000" /><br />
<Origin x="100000" y="100000" /><br />
<TileSets profile="local"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/6" units-per-pixel="2048" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/5" units-per-pixel="1024" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/4" units-per-pixel="512" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/3" units-per-pixel="256" order="3" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/2" units-per-pixel="128" order="4" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/1" units-per-pixel="64" order="5" /><br />
</TileSets></nowiki><br />
<br />
===Tile Resources===<br />
<br />
The origin of a <TileMap> is defined in the coordinates of the spatial reference system of the <TileMap>. The x-coordinate of the tile numbers increases with the x-coordinate of the spatial reference system, and the y-coordinate of the tile numbers also increases with the y-coordinate of the spatial reference system.<br />
<br />
Tiles are addressed under the "href" specified in the <TileSet> appending the "x" tile coordinate as a directory name and using the "y" tile coordinate as the file name, with the file "extension" from the <TileFormat>.<br />
<br />
Example:<br />
<br />
The tile at the origin of the tile set in the first zoom level of vmap0.<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0/levelzero/0/0.jpg</nowiki><br />
<br />
The tile near the middle of the tile set in the third zoom level of vmap0.<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0/leveltwo/3/4.jpg</nowiki><br />
<br />
The tile near the middle of the tile set in the fifth zoom level of landsat2000.<br />
<nowiki>http://tms.osgeo.org/1.0.0/landsat2000/1/8500/8500.png</nowiki><br />
<br />
The tile at the origin of the tile set in the first zoom level of basemap.<br />
<nowiki>http://www.osgeo.org/services/basemap/L1/0/0.png</nowiki><br />
<br />
===TileMap Diagram===<br />
<br />
[[Image:Tms.png]]<br />
<br />
===Error Handling===<br />
<br />
When an error occurs in the server, it is important that the client be able easily notice that an error has occurred, and ascertain ''why'' the error occured so the user can be notified if necessary.<br />
<br />
The tile map server uses HTTP error codes to relay the general reason for an error condition, and an XML payload to communicate the specific reason for the failure in human readable language.<br />
<br />
Only HTTP error codes given in this specification should be used to return errors to the client.<br />
<br />
* The client requests a nonexistent resource URL. Return HTTP error code 404 (Not Found)<br />
* The server fails in processing a response for a valid resource URL. Return HTTP error code 500 (Internal Server Error)<br />
<br />
Servers are optionally allowed to return content, even when throwning an error code. The following is the XML format for a tile map server error message. If the Content-type of the return on an error is set to text/xml, this format is the required form of the response.<br />
<br />
<nowiki><?xml version="1.0" ?><br />
<TileMapServerError><br />
<Message>The requested tile is outside the bounding box of the tile map.</Message><br />
</TileMapServerError></nowiki><br />
<br />
==Implementation Advice==<br />
<br />
===Spatial Referencing Systems===<br />
<br />
Spatial referencing systems for the tile map service will be defined using the EPSG database as a reference for "well-known" projections, subject to interpretations, given below. <br />
<br />
There are two substantial implementation issues with using the EPSG database as a source of truth for spatial reference systems:<br />
<br />
* Firstly, the EPSG database has some specific definitions for commonly used geodetic coordinate systems, in particular EPSG:4326 -- geodetic coordinates relative to the WGS84 spheroid. The EPSG definition for 4326 says that the coordinate order is latitude, longitude and that the units are degrees, minutes, seconds. However, common usage of EPSG:4326 in web mapping says that the coordinate order is longitude, latitude and the units are decimal degrees.<br />
* Secondly, the EPSG database does not include every commonly used spatial reference system. There are still many local systems which are not included in the database, though the EPSG does make an effort to include new systems as they are brought to their attention. However, the EPSG does not catalogue commonly used global and large area systems, presumably as a matter of policy. For example, no EPSG identifier is provided for a Mercator projection of the world, or an Albers projection of North America.<br />
<br />
The issues will be dealt with by fiat in this specification, matching implementation practice rather than following the database definition:<br />
<br />
* For all geodetic coordinate systems in the EPSG database, the tile map service specification will treat the coordinate order as longitude, latitude and the units as decimal degrees.<br />
* Spatial reference systems not defined in the EPSG database may be defined in the tile map service specification itself, using an OSGEO authority string.<br />
** '''OSGEO:41001''' <nowiki>PROJCS["WGS84 / Simple Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree", 0.0174532925199433]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42310''' <nowiki>PROJCS["WGS84+GRS80 / Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["GRS 1980",6378137,298.257222101], TOWGS84[0,0,0]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42101''' <nowiki>PROJCS["WGS 84 / LCC Canada", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian",-95.0], PARAMETER["latitude_of_origin",0], PARAMETER["standard_parallel_1",49.0], PARAMETER["standard_parallel_2",77.0], PARAMETER["false_easting",0.0], PARAMETER["false_northing",-8000000.0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42304''' <nowiki>PROJCS["NAD83 / NRCan LCC Canada", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS_1980",6378137,298.257222101], TOWGS84[0,0,0]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian",-95.0], PARAMETER["latitude_of_origin",49.0], PARAMETER["standard_parallel_1",49.0], PARAMETER["standard_parallel_2",77.0], PARAMETER["false_easting",0.0], PARAMETER["false_northing",0.0], UNIT["Meter",1]]</nowiki><br />
<br />
===Maximizing Cacheability===<br />
<br />
Tile maps are usually base maps, and usually represent data that changes on a very slow cycle. They are also usually large in volume, comprising potentially millions of different tiles. Given these basic facts, the aggressive use of caching strategies can optimize performance of tile map services.<br />
<br />
Caching can happen at multiple layers between the server and the client:<br />
<br />
* At the client itself, as the user-agent caches results on the local disk.<br />
* In a shared cache at an intermediate ISP, allowing multiple users of the ISP to pull data from the cache.<br />
* In a cache on the server itself, to move load from the tile generator to a simpler caching process.<br />
<br />
In order for caching to occur at any of these layers, the caching mechanisms need to know when a resource is cachable. <br />
<br />
If your tile server is written using a scripting or programming language, you will probably be constructing your HTTP headers yourself, and it is important to include cache control headers when doing so to allow caching to occur.<br />
<br />
There are different cache headers for HTTP 1.0 and HTTP 1.1, and because both protocols are in active use, it is important to include both.<br />
<br />
For HTTP 1.0, use the "Expires" header. If you expect your data to change no more than once per week, set your Expires header to one week in the future. For example, if it is January 1, 2007, and you wanted your tiles to expire no more than one week after they are retreived, you would set your header using this PHP invocation:<br />
<br />
header('Expires: Mon, 8 Jan 2007 14:57:12 GMT');<br />
<br />
Or, to always set the Expires header to one week in the future:<br />
<br />
header('Expires: ' . gmdate('D, j M Y H:i:s T', time() + 7 * 24 * 60 * 60)); // time + 7 days worth of seconds<br />
<br />
For HTTP 1.1, use the "Cache-control" header. Unlike the older "Expires" header, "Cache-control" does not have a clock reference, just a time period to reatain the data, thereby avoiding the clock sychronization issues of "Expires".<br />
<br />
header('Cache-Control: max-age=86400, must-revalidate');<br />
header('Cache-Control: ' . 7 * 24 * 60 * 60 );<br />
<br />
Read about HTTP 1.1 cache control headers in the [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 W3.org specification].<br />
<br />
===Implementing Cacheability===<br />
<br />
You can trust that the somewhere on the internet, someone will respect your cache control headers and your content will be cached, ''or'' you can set up your own cache. If you are running Apache 2.0 adding [http://httpd.apache.org/docs/2.0/mod/mod_cache.html mod_cache caching] to your tms is laughably easy. <br />
<br />
Just add a mod_cache directive inside your <VirtualHost> definition:<br />
<br />
<IfModule mod_disk_cache.c><br />
CacheRoot /tmp/apache-cache <br />
CacheSize 1024000<br />
CacheEnable disk /cgi-bin/tms<br />
CacheDirLevels 5<br />
CacheDirLength 3<br />
</IfModule> <br />
<br />
This example is for a disk cache, probably what you will use for your TMS, since the data volumes tend to be high. Note how the CacheEnable directive allows you to very precisely control which content you are going to cache. In my case, I am only caching the output from my TMS server, nothing else. If I wanted, I could be even narrower and restrict caching to just one tile map inside my service, or just one tile set.<br />
<br />
===URLs That are Actually Scripts===<br />
<br />
For large implementations of the tile map server specification, the data will not be statically pre-built, but will be demand-generated by some kind of backend service. That means that URLs that appear to be static may actually be dynamic.<br />
<br />
The [http://hoohoo.ncsa.uiuc.edu/cgi/env.html CGI specification] allows this trivially, by passing any path information after the CGI executable in the URL back to the executable in the PATH_INFO environment variable:<br />
<br />
<nowiki>http://tms.osgeo.org/cgi-bin/tms/1.0.0/vmap0</nowiki><br />
<br />
PATH_INFO = 1.0.0/vmap0<br />
<br />
If "tms" is the CGI executable, it can easily extract the remaining path information and use that for processing purposes.<br />
<br />
Note that by default some versions of Microsoft IIS do not conform to the CGI specification for this behavior (Apache does). See the note at http://support.microsoft.com/kb/q184320/ for information on how to enable this bahavior in IIS.<br />
<br />
Note that it is allowable for URLs to include "."s in the middle of paths, so that executable scripts (like PHP files) can be legally used as TMS servers.<br />
<br />
Here is a root resource:<br />
<nowiki>http://tms.osgeo.org/tms.php</nowiki><br />
<br />
Here is the a tile request on that server:<br />
<nowiki>http://tms.osgeo.org/tms.php/1.0.0/thetilemap/firstlevel/2/1.jpg</nowiki><br />
<br />
In general, the simplest way to extract information from the incoming script invocation is to take the incoming PATH_INFO environment variable, strip the "/" character from the start and end of the string, and then split the string into an array using the "/" character. In this manner, the first element of the array will be the version, the second element will be the tile map, the third will be the level, the fourth will be the tile "x" and the fifth will be the tile "y" (with a .extension).<br />
<br />
===Using Faces===<br />
<br />
The "face-id" attribute of the <TileMap> referenced in the <TileMapService> is used for some specialized clients. How that attribute is used by each client is described here.<br />
<br />
''To be filled in by implementation knowledge...''<br />
<br />
===Reference Implementations===<br />
<br />
====Servers====<br />
<br />
* TileCache<br />
** http://www.tilecache.org/<br />
<br />
====Clients====<br />
<br />
* Worldkit: http://worldkit.org/tilemap/<br />
* Openlayers: http://openlayers.org/<br />
* Cadcorp SIS: [http://wiki.osgeo.org/images/a/a5/CadcorpTmsClient.png Screenshot]<br />
* [http://www.merkaartor.org/ Merkaartor], an [http://www.osm.org OpenStreetMap] editor, can use a TMS server as source for background layers<br />
: ''Note that like Google's map tiles OpenStreetMap counts tile 0,0 from the top-left not the bottom-left.''<br />
<br />
===Returning Error Codes===<br />
<br />
If your tile map server is a static set of files, you will find that your web server sets the appropriate error codes automatically when people ask for resources that do not exist, or the server suffers a failure. <br />
<br />
However, if your tile map server is dynamic, you will have to set the HTTP status codes yourself, otherwise the HTTP server will assign a code of 200 (OK) for your error message XML document, which would be wrong. In PHP, an error return function might look like this:<br />
<br />
header("HTTP/1.0 404 Not Found");<br />
header("Content-type: text/xml");<br />
print "<?xml version='1.0' ?>";<br />
print "<TileMapServerErrror>";<br />
print "<Message>You requested a map tile [ $path_info ] that does not exist.</Message>";<br />
print "</TileMapServerError>";<br />
<br />
Note that in addition to setting the error code the Content-type was also correctly set. Also note that cache headers were ''not'' set, since errors are not a good thing to cache.<br />
<br />
==See Also==<br />
* [http://www.essaywriter.co.uk/custom-essays.aspx custom essay writing]<br />
* [http://www.peej.co.uk/articles/http-caching.html HTTP Caching]<br />
* [http://www.peej.co.uk/articles/rest.html What is REST]<br />
* [http://www.pooltemperature.com/ Pool Temperature]<br />
* [http://www.fineleather.com/ briefcases leather]<br />
* [http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames OpenStreetMap's "Slippy tiles"]. ''Note that like Google map tiles, their grid counting starts from the top-left not the bottom-left.''<br />
<br />
<br />
[[Category:Standards]]<br />
[[Category:Tiling]]</div>Wiki-Allensmithhttps://wiki.osgeo.org/w/index.php?title=Tile_Map_Service_Specification&diff=48951Tile Map Service Specification2010-07-29T09:18:50Z<p>Wiki-Allensmith: </p>
<hr />
<div>This document is the work of a loose community of participants interested in client/server mapping solutions that use multi-resolution image pyramids. It is meant to be used as a baseline for the implementation of client/server mapping software. It is not an "official standard" nor is it endorsed by OSGeo as an official project or work product of the Foundation.<br />
<br />
This document is version "1.0", and will not be edited further.<br />
<br />
Any new revisions will take place in a new working copy.<br />
<br />
==Introduction==<br />
<br />
===Document Scope===<br />
<br />
A Tile Map Service (TMS) provides access to cartographic maps of geo-referenced data, not direct access to the data itself. This document standardizes the way in which map tiles are requested by clients, and the ways that servers describe their holdings.<br />
<br />
===Document Form===<br />
<br />
This document will proceed from a description of general resources provided by the server to particular resources (such as map tiles) providing examples of access URLs and return values at each stage.<br />
<br />
==Specification==<br />
<br />
The Tiled Web Service provides access to resources, in particular, to rendered cartographic tiles at fixed scales. Access to these resources is provided via a "REST" interface, starting with a root resource describing available layers, then map resources with a set of scales, then scales holding sets of tiles. <br />
<br />
Each resource contains the descriptive information and links to further resources. Note that while the URLs used to access resources may appear to have internal meaning (the resource for version 1.0.0 of the service has "1.0.0" in it's URL) such structure is ''not required'' of them. <br />
<br />
The only requirement is that the resource be referenced by a URL (<nowiki>http://tms.osgeo.org/1.0.0/ could be http://tms.osgeo.org/onepointzeropointzero or http://tms.osgeo.org/flipper.xml as long as the value appeared in the href of the <TileMapService> element</nowiki>).<br />
<br />
The value of an "href" '''must''' be an absolute URL (starting with "http://"). For example: href="<nowiki>http://www.service.org/subdirectory/tilemap.xml</nowiki>"<br />
<br />
===Root Resource===<br />
<br />
The root resource describes the available versions of the <TileMapService> (and possibly other services as well).<br />
<br />
Request:<br />
<br />
<nowiki>http://tms.osgeo.org/</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<Services><br />
<TileMapService title="Example Tile Map Service" version="1.0.0" href="http://tms.osgeo.org/1.0.0/" /><br />
<TileMapService title="New Example Tile Map Service" version="1.1.0" href="http://tms.osgeo.org/1.1.0/" /><br />
<FancyFeatureService title="Features!" version="0.9" href="http://ffs.osgeo.org/0.9/" /><br />
</Services></nowiki><br />
<br />
Request:<br />
<br />
<nowiki>http://www.osgeo.org/services/root.xml</nowiki><br />
<br />
Response:<br />
<br />
<nowiki><?xml version="1.0" ?><br />
<Services><br />
<TileMapService title="Example Static Tile Map Service" version="1.0.0" href="http://www.osgeo.org/services/tilemapservice.xml" /><br />
</Services></nowiki><br />
<br />
===TileMapService Resource===<br />
<br />
The <TileMapService> resource provides description metadata about the service and lists the available <TileMaps>. <br />
<br />
Optional elements in the resource are called out below using the pipe character. All other elements are mandatory.<br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMapService version="1.0.0" services="http://tms.osgeo.org"><br />
<Title>Example Tile Map Service</Title><br />
<Abstract>This is a longer description of the example tiling map service.</Abstract><br />
| <KeywordList>example tile service</KeywordList><br />
| <ContactInformation><br />
| <ContactPersonPrimary><br />
| <ContactPerson>Paul Ramsey</ContactPerson><br />
| <ContactOrganization>Refractions Research</ContactOrganization><br />
| </ContactPersonPrimary><br />
| <ContactPosition>Manager</ContactPosition><br />
| <ContactAddress><br />
| <AddressType>postal</AddressType><br />
| <Address>300 - 1207 Douglas Street</Address><br />
| <City>Victoria</City><br />
| <StateOrProvince>British Columbia</StateOrProvince><br />
| <PostCode>V8W2E7</PostCode><br />
| <Country>Canada</Country><br />
| </ContactAddress><br />
| <ContactVoiceTelephone>12503833022</ContactVoiceTelephone><br />
| <ContactFacsimileTelephone>12503832140</ContactFacsimileTelephone><br />
| <ContactElectronicMailAddress>pramsey@refractions.net</ContactElectronicMailAddress><br />
| </ContactInformation><br />
<TileMaps><br />
<TileMap <br />
title="VMAP0 World Map" <br />
srs="EPSG:4326" <br />
profile="global-geodetic" <br />
href="http://tms.osgeo.org/1.0.0/vmap0" /><br />
<TileMap <br />
title="British Columbia Landsat Imagery (2000)" <br />
srs="EPSG:3005" <br />
profile="local" <br />
href="http://tms.osgeo.org/1.0.0/landsat2000" /><br />
</TileMaps><br />
</TileMapService></nowiki><br />
<br />
<br />
Request: <br />
<br />
<nowiki>http://www.osgeo.org/services/tilemapservice.xml</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMapService version="1.0.0" services="http://www.osgeo.org/services/root.xml"><br />
<Title>Example Static Tile Map Service</Title><br />
<Abstract>This is a longer description of the static tiling map service.</Abstract><br />
| <KeywordList>example tile service static</KeywordList><br />
| <ContactInformation><br />
| <ContactPersonPrimary><br />
| <ContactPerson>Paul Ramsey</ContactPerson><br />
| <ContactOrganization>Refractions Research</ContactOrganization><br />
| </ContactPersonPrimary><br />
| <ContactPosition>Manager</ContactPosition><br />
| <ContactAddress><br />
| <AddressType>postal</AddressType><br />
| <Address>300 - 1207 Douglas Street</Address><br />
| <City>Victoria</City><br />
| <StateOrProvince>British Columbia</StateOrProvince><br />
| <PostCode>V8W2E7</PostCode><br />
| <Country>Canada</Country><br />
| </ContactAddress><br />
| <ContactVoiceTelephone>12503833022</ContactVoiceTelephone><br />
| <ContactFacsimileTelephone>12503832140</ContactFacsimileTelephone><br />
| <ContactElectronicMailAddress>pramsey@refractions.net</ContactElectronicMailAddress><br />
| </ContactInformation><br />
<TileMaps><br />
<TileMap <br />
title="Vancouver Island Base Map" <br />
srs="EPSG:26910" <br />
profile="none" <br />
href="http://www.osgeo.org/services/basemap.xml" /><br />
</TileMaps><br />
</TileMapService></nowiki><br />
<br />
===TileMap Resource===<br />
<br />
A <TileMap> is a (usually) cartographically complete map representation. Sometimes <TileMap>s are built to be used in conjunction, as a set of stacked layers, but they are generally visually complete on their own. <br />
<br />
<TileMap>s are composed of a set of scale-appropriate cartographic renderings, each divided up into regularly spaced image tiles, called <TileSet>s. Small-scale (eg, 1:10000000) tile sets may only contain a handful of tiles. Large-scale tile sets (eg, 1:10000) may contain millions of tiles.<br />
<br />
At a particular scale, and in a particular cartographic projection, a <TileMap> is represented by a <TileSet>, a coverage of regularly sized and spaced images that taken together form a complete visual representation of the entire area of coverage of the <TileMap>.<br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?> <br />
<TileMap version="1.0.0" tilemapservice="http://http://tms.osgeo.org/1.0.0"><br />
<Title>VMAP0 World Map</Title><br />
<Abstract>A map of the world built from the NGA VMAP0 vector data set.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>National Geospatial Intelligence Agency</Title><br />
| <Logo width="10" height="10" href="http://nga.mil/logo.gif" mime-type="image/gif" /><br />
| </Attribution><br />
| <WebMapContext href="http://wms.org" /><br />
| <Face>0</Face><br />
<SRS>EPSG:4326</SRS><br />
<BoundingBox minx="-180" miny="-90" maxx="180" maxy="90" /><br />
<Origin x="-180" y="-90" /> <br />
<TileFormat width="256" height="256" mime-type="image/jpeg" extension="jpg" /><br />
<TileSets profile=global-geodetic"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/0" units-per-pixel="0.703125" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/1" units-per-pixel="0.3515625" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/2" units-per-pixel="0.17578125" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/3" units-per-pixel="0.08789063" order="3" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Request: <br />
<br />
<nowiki>http://tms.osgeo.org/1.0.0/landsat2000</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0"><br />
<Title>British Columbia Landsat Imagery (2000)</Title><br />
<Abstract>Landsat data collected in the year 2000 over British Columbia.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>Government of British Columbia</Title><br />
| <Logo width="10" height="10" href="http://gov.bc.ca/logo.png" mime-type="image/png" /><br />
| </Attribution><br />
| <WebMapContext href="http://wms.gov.bc.ca" /><br />
<SRS>EPSG:3005</SRS><br />
<BoundingBox minx="100000" miny="100000" maxx="1800000" maxy="1800000" /><br />
<Origin x="100000" y="100000" /><br />
<TileFormat width="256" height="256" mime-type="image/png" extension="png" /><br />
<TileSets profile="local"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/2048" units-per-pixel="2048" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/1024" units-per-pixel="1024" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/512" units-per-pixel="512" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/256" units-per-pixel="256" order="3" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/128" units-per-pixel="128" order="4" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/64" units-per-pixel="64" order="5" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Request: <br />
<br />
<nowiki>http://www.osgeo.org/services/basemap.xml</nowiki><br />
<br />
Response (Content-type: text/xml):<br />
<br />
<nowiki><?xml version="1.0" encoding="UTF-8" ?><br />
<TileMap version="1.0.0" tilemapservice="http://www.osgeo.org/services/tilemapservice.xml"><br />
<Title>Vancouver Island Base Map</Title><br />
<Abstract>A map of the Vancouver Island built from British Columbia planimetric mapping <br />
data and digital elevation hill shading.</Abstract><br />
| <KeywordList></KeywordList><br />
| <Metadata type="TC211" mime-type="text/xml" href="http://www.org" /><br />
| <Attribution><br />
| <Title>Goverment of British Columbia</Title><br />
| <Logo width="10" height="10" href="http://www.gov.bc.ca/logo.gif" mime-type="image/gif" /><br />
| </Attribution><br />
| <WebMapContext href="http://openmaps.gov.bc.ca" /><br />
<SRS>EPSG:26910</SRS><br />
| <Face>0</Face><br />
<BoundingBox minx="500000" miny="4800000" maxx="700000" maxy="5500000" /><br />
<Origin x="500000" y="4800000" /> <br />
<TileFormat width="256" height="256" mime-type="image/png" extension="png" /><br />
<TileSets profile="none"><br />
<TileSet href="http://www.osgeo.org/services/basemap/L1" units-per-pixel="6400" order="0" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L2" units-per-pixel="1600" order="1" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L3" units-per-pixel="400" order="2" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L4" units-per-pixel="100" order="3" /><br />
<TileSet href="http://www.osgeo.org/services/basemap/L5" units-per-pixel="25" order="4" /><br />
</TileSets><br />
</TileMap></nowiki><br />
<br />
Each <TileMap> supports one <SRS> and one image format. To support more than one SRS or image format, define extra <TileMaps> in your <TileMapService> for each combination you want.<br />
<br />
<TileMap>s have both a <BoundingBox> and an <Origin>. The <BoundingBox> is the extent of the data of interest -- it might be used by a client to set an initial spatial extent. The <Origin> is the lower-left corner of the 0/0 tile, and the upper right corner of tile -1/-1 (if you choose to configure your service so that negative tiles are required). The <Origin> may be outside of the visual region of interest (the <BoundingBox>), for reasons of implementation convenience. <br />
<br />
<TileMap>s may participate as a <Face> of a larger complex of <TileMap>s. The OSGPlanet and GeoFusion clients both use separate polar faces in conjuction with equatorial faces (an "earth cube") to create a single world view from multiple tile maps. See [[#Using Faces]].<br />
<br />
<TileMap>s may implement one of three "profile"s, two global profiles in common global projections, or a local profile in an arbitrary projection. All profiles restrict the service to a fixed set of scales, to allow tilesets from different services to be more easily overlaid.<br />
<br />
===Profiles===<br />
<br />
Using this server specification will ensure that clients can easily consume your tiled map data. However, it will not guarantee that clients can efficiently overlay your data with data from other tile map servers. In order to maximize the interoperability of your tile map with other tile maps, you must implement the a "profile" for your tile map.<br />
<br />
The profile a <TileMap> supports is advertised in the "profile" attribute of the <TileSets> element. The "profile" will be one of:<br />
<br />
* none<br />
* global-geodetic<br />
* global-mercator<br />
* local<br />
<br />
====global-geodetic====<br />
<br />
If the profile type is set to "global-geodetic", the <TileMap> must meet the following requirements:<br />
<br />
* Must use <SRS>EPSG:4326</SRS><br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 0.703125 / 2^n<br />
** This scaling allows an initial zoom level that consists of 2 256x256 pixel tiles covering the whole earth, with an <Origin> of (-180,-90). Other combinations of tile size and <Origin> are also possible at this scale.<br />
<br />
<nowiki><TileSets profile="global-geodetic"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/0" units-per-pixel="0.703125" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/1" units-per-pixel="0.3515625" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/2" units-per-pixel="0.17578125" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/vmap0/3" units-per-pixel="0.08789063" order="3" /><br />
</TileSets></nowiki><br />
<br />
====global-mercator====<br />
<br />
If the profile type is set to "global-mercator", the <TileMap> must meet the following requirements:<br />
<br />
* Must use <SRS>OSGEO:41001</SRS><br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 78271.516 / 2^n<br />
** This scaling allows an initial zoom level that consists of four 256x256 pixel tiles covering the whole earth, with an <Origin> of (-20037508.34, -20037508.34). Other combinations of tile size and <Origin> are also possible at this scale.<br />
<br />
====local====<br />
<br />
Unlike the global profiles, the "local" profile is built from the bottom up, starting with a smallest possible scale of one unit per pixel and compounding upwards from there. Local profiles can be in any projection, but are at a fixed set of scales.<br />
<br />
If the profile type is set to "local", the <TileMap> must meet the following requirements:<br />
<br />
* May use any coordinate system, and must identify that coordinate system in the <SRS>.<br />
* Must provide <TileSet>s with units-per-pixel meeting the following formula for any integral value of "n" greater than or equal to 0: units-per-pixel = 2^n<br />
* Must provide <TileSet> sub-directories below the <Profile> href value, using the value of "n" appropriate for that <TileSet> as the sub-directory name.<br />
<br />
<nowiki><SRS>EPSG:3005</SRS><br />
<BoundingBox minx="100000" miny="100000" maxx="1800000" maxy="1800000" /><br />
<Origin x="100000" y="100000" /><br />
<TileSets profile="local"><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/6" units-per-pixel="2048" order="0" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/5" units-per-pixel="1024" order="1" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/4" units-per-pixel="512" order="2" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/3" units-per-pixel="256" order="3" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/2" units-per-pixel="128" order="4" /><br />
<TileSet href="http://tms.osgeo.org/1.0.0/landsat2000/1" units-per-pixel="64" order="5" /><br />
</TileSets></nowiki><br />
<br />
===Tile Resources===<br />
<br />
The origin of a <TileMap> is defined in the coordinates of the spatial reference system of the <TileMap>. The x-coordinate of the tile numbers increases with the x-coordinate of the spatial reference system, and the y-coordinate of the tile numbers also increases with the y-coordinate of the spatial reference system.<br />
<br />
Tiles are addressed under the "href" specified in the <TileSet> appending the "x" tile coordinate as a directory name and using the "y" tile coordinate as the file name, with the file "extension" from the <TileFormat>.<br />
<br />
Example:<br />
<br />
The tile at the origin of the tile set in the first zoom level of vmap0.<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0/levelzero/0/0.jpg</nowiki><br />
<br />
The tile near the middle of the tile set in the third zoom level of vmap0.<br />
<nowiki>http://tms.osgeo.org/1.0.0/vmap0/leveltwo/3/4.jpg</nowiki><br />
<br />
The tile near the middle of the tile set in the fifth zoom level of landsat2000.<br />
<nowiki>http://tms.osgeo.org/1.0.0/landsat2000/1/8500/8500.png</nowiki><br />
<br />
The tile at the origin of the tile set in the first zoom level of basemap.<br />
<nowiki>http://www.osgeo.org/services/basemap/L1/0/0.png</nowiki><br />
<br />
===TileMap Diagram===<br />
<br />
[[Image:Tms.png]]<br />
<br />
===Error Handling===<br />
<br />
When an error occurs in the server, it is important that the client be able easily notice that an error has occurred, and ascertain ''why'' the error occured so the user can be notified if necessary.<br />
<br />
The tile map server uses HTTP error codes to relay the general reason for an error condition, and an XML payload to communicate the specific reason for the failure in human readable language.<br />
<br />
Only HTTP error codes given in this specification should be used to return errors to the client.<br />
<br />
* The client requests a nonexistent resource URL. Return HTTP error code 404 (Not Found)<br />
* The server fails in processing a response for a valid resource URL. Return HTTP error code 500 (Internal Server Error)<br />
<br />
Servers are optionally allowed to return content, even when throwning an error code. The following is the XML format for a tile map server error message. If the Content-type of the return on an error is set to text/xml, this format is the required form of the response.<br />
<br />
<nowiki><?xml version="1.0" ?><br />
<TileMapServerError><br />
<Message>The requested tile is outside the bounding box of the tile map.</Message><br />
</TileMapServerError></nowiki><br />
<br />
==Implementation Advice==<br />
<br />
===Spatial Referencing Systems===<br />
<br />
Spatial referencing systems for the tile map service will be defined using the EPSG database as a reference for "well-known" projections, subject to interpretations, given below. <br />
<br />
There are two substantial implementation issues with using the EPSG database as a source of truth for spatial reference systems:<br />
<br />
* Firstly, the EPSG database has some specific definitions for commonly used geodetic coordinate systems, in particular EPSG:4326 -- geodetic coordinates relative to the WGS84 spheroid. The EPSG definition for 4326 says that the coordinate order is latitude, longitude and that the units are degrees, minutes, seconds. However, common usage of EPSG:4326 in web mapping says that the coordinate order is longitude, latitude and the units are decimal degrees.<br />
* Secondly, the EPSG database does not include every commonly used spatial reference system. There are still many local systems which are not included in the database, though the EPSG does make an effort to include new systems as they are brought to their attention. However, the EPSG does not catalogue commonly used global and large area systems, presumably as a matter of policy. For example, no EPSG identifier is provided for a Mercator projection of the world, or an Albers projection of North America.<br />
<br />
The issues will be dealt with by fiat in this specification, matching implementation practice rather than following the database definition:<br />
<br />
* For all geodetic coordinate systems in the EPSG database, the tile map service specification will treat the coordinate order as longitude, latitude and the units as decimal degrees.<br />
* Spatial reference systems not defined in the EPSG database may be defined in the tile map service specification itself, using an OSGEO authority string.<br />
** '''OSGEO:41001''' <nowiki>PROJCS["WGS84 / Simple Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree", 0.0174532925199433]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42310''' <nowiki>PROJCS["WGS84+GRS80 / Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["GRS 1980",6378137,298.257222101], TOWGS84[0,0,0]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42101''' <nowiki>PROJCS["WGS 84 / LCC Canada", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian",-95.0], PARAMETER["latitude_of_origin",0], PARAMETER["standard_parallel_1",49.0], PARAMETER["standard_parallel_2",77.0], PARAMETER["false_easting",0.0], PARAMETER["false_northing",-8000000.0], UNIT["Meter",1]]</nowiki><br />
** '''OSGEO:42304''' <nowiki>PROJCS["NAD83 / NRCan LCC Canada", GEOGCS["NAD83", DATUM["North_American_Datum_1983", SPHEROID["GRS_1980",6378137,298.257222101], TOWGS84[0,0,0]], PRIMEM["Greenwich",0], UNIT["Decimal_Degree",0.0174532925199433]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian",-95.0], PARAMETER["latitude_of_origin",49.0], PARAMETER["standard_parallel_1",49.0], PARAMETER["standard_parallel_2",77.0], PARAMETER["false_easting",0.0], PARAMETER["false_northing",0.0], UNIT["Meter",1]]</nowiki><br />
<br />
===Maximizing Cacheability===<br />
<br />
Tile maps are usually base maps, and usually represent data that changes on a very slow cycle. They are also usually large in volume, comprising potentially millions of different tiles. Given these basic facts, the aggressive use of caching strategies can optimize performance of tile map services.<br />
<br />
Caching can happen at multiple layers between the server and the client:<br />
<br />
* At the client itself, as the user-agent caches results on the local disk.<br />
* In a shared cache at an intermediate ISP, allowing multiple users of the ISP to pull data from the cache.<br />
* In a cache on the server itself, to move load from the tile generator to a simpler caching process.<br />
<br />
In order for caching to occur at any of these layers, the caching mechanisms need to know when a resource is cachable. <br />
<br />
If your tile server is written using a scripting or programming language, you will probably be constructing your HTTP headers yourself, and it is important to include cache control headers when doing so to allow caching to occur.<br />
<br />
There are different cache headers for HTTP 1.0 and HTTP 1.1, and because both protocols are in active use, it is important to include both.<br />
<br />
For HTTP 1.0, use the "Expires" header. If you expect your data to change no more than once per week, set your Expires header to one week in the future. For example, if it is January 1, 2007, and you wanted your tiles to expire no more than one week after they are retreived, you would set your header using this PHP invocation:<br />
<br />
header('Expires: Mon, 8 Jan 2007 14:57:12 GMT');<br />
<br />
Or, to always set the Expires header to one week in the future:<br />
<br />
header('Expires: ' . gmdate('D, j M Y H:i:s T', time() + 7 * 24 * 60 * 60)); // time + 7 days worth of seconds<br />
<br />
For HTTP 1.1, use the "Cache-control" header. Unlike the older "Expires" header, "Cache-control" does not have a clock reference, just a time period to reatain the data, thereby avoiding the clock sychronization issues of "Expires".<br />
<br />
header('Cache-Control: max-age=86400, must-revalidate');<br />
header('Cache-Control: ' . 7 * 24 * 60 * 60 );<br />
<br />
Read about HTTP 1.1 cache control headers in the [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 W3.org specification].<br />
<br />
===Implementing Cacheability===<br />
<br />
You can trust that the somewhere on the internet, someone will respect your cache control headers and your content will be cached, ''or'' you can set up your own cache. If you are running Apache 2.0 adding [http://httpd.apache.org/docs/2.0/mod/mod_cache.html mod_cache caching] to your tms is laughably easy. <br />
<br />
Just add a mod_cache directive inside your <VirtualHost> definition:<br />
<br />
<IfModule mod_disk_cache.c><br />
CacheRoot /tmp/apache-cache <br />
CacheSize 1024000<br />
CacheEnable disk /cgi-bin/tms<br />
CacheDirLevels 5<br />
CacheDirLength 3<br />
</IfModule> <br />
<br />
This example is for a disk cache, probably what you will use for your TMS, since the data volumes tend to be high. Note how the CacheEnable directive allows you to very precisely control which content you are going to cache. In my case, I am only caching the output from my TMS server, nothing else. If I wanted, I could be even narrower and restrict caching to just one tile map inside my service, or just one tile set.<br />
<br />
===URLs That are Actually Scripts===<br />
<br />
For large implementations of the tile map server specification, the data will not be statically pre-built, but will be demand-generated by some kind of backend service. That means that URLs that appear to be static may actually be dynamic.<br />
<br />
The [http://hoohoo.ncsa.uiuc.edu/cgi/env.html CGI specification] allows this trivially, by passing any path information after the CGI executable in the URL back to the executable in the PATH_INFO environment variable:<br />
<br />
<nowiki>http://tms.osgeo.org/cgi-bin/tms/1.0.0/vmap0</nowiki><br />
<br />
PATH_INFO = 1.0.0/vmap0<br />
<br />
If "tms" is the CGI executable, it can easily extract the remaining path information and use that for processing purposes.<br />
<br />
Note that by default some versions of Microsoft IIS do not conform to the CGI specification for this behavior (Apache does). See the note at http://support.microsoft.com/kb/q184320/ for information on how to enable this bahavior in IIS.<br />
<br />
Note that it is allowable for URLs to include "."s in the middle of paths, so that executable scripts (like PHP files) can be legally used as TMS servers.<br />
<br />
Here is a root resource:<br />
<nowiki>http://tms.osgeo.org/tms.php</nowiki><br />
<br />
Here is the a tile request on that server:<br />
<nowiki>http://tms.osgeo.org/tms.php/1.0.0/thetilemap/firstlevel/2/1.jpg</nowiki><br />
<br />
In general, the simplest way to extract information from the incoming script invocation is to take the incoming PATH_INFO environment variable, strip the "/" character from the start and end of the string, and then split the string into an array using the "/" character. In this manner, the first element of the array will be the version, the second element will be the tile map, the third will be the level, the fourth will be the tile "x" and the fifth will be the tile "y" (with a .extension).<br />
<br />
===Using Faces===<br />
<br />
The "face-id" attribute of the <TileMap> referenced in the <TileMapService> is used for some specialized clients. How that attribute is used by each client is described here.<br />
<br />
''To be filled in by implementation knowledge...''<br />
<br />
===Reference Implementations===<br />
<br />
====Servers====<br />
<br />
* TileCache<br />
** http://www.tilecache.org/<br />
<br />
====Clients====<br />
<br />
* Worldkit: http://worldkit.org/tilemap/<br />
* Openlayers: http://openlayers.org/<br />
* Cadcorp SIS: [http://wiki.osgeo.org/images/a/a5/CadcorpTmsClient.png Screenshot]<br />
* [http://www.merkaartor.org/ Merkaartor], an [http://www.osm.org OpenStreetMap] editor, can use a TMS server as source for background layers<br />
: ''Note that like Google's map tiles OpenStreetMap counts tile 0,0 from the top-left not the bottom-left.''<br />
<br />
===Returning Error Codes===<br />
<br />
If your tile map server is a static set of files, you will find that your web server sets the appropriate error codes automatically when people ask for resources that do not exist, or the server suffers a failure. <br />
<br />
However, if your tile map server is dynamic, you will have to set the HTTP status codes yourself, otherwise the HTTP server will assign a code of 200 (OK) for your error message XML document, which would be wrong. In PHP, an error return function might look like this:<br />
<br />
header("HTTP/1.0 404 Not Found");<br />
header("Content-type: text/xml");<br />
print "<?xml version='1.0' ?>";<br />
print "<TileMapServerErrror>";<br />
print "<Message>You requested a map tile [ $path_info ] that does not exist.</Message>";<br />
print "</TileMapServerError>";<br />
<br />
Note that in addition to setting the error code the Content-type was also correctly set. Also note that cache headers were ''not'' set, since errors are not a good thing to cache.<br />
<br />
==See Also==<br />
* [http://www.essaywriter.co.uk/custom-essays.aspx custom essay writing]<br />
* [http://www.peej.co.uk/articles/http-caching.html HTTP Caching]<br />
* [http://www.peej.co.uk/articles/rest.html What is REST]<br />
* [http://www.pooltemperature.com/ Pool Temperature]<br />
* [http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames OpenStreetMap's "Slippy tiles"]. ''Note that like Google map tiles, their grid counting starts from the top-left not the bottom-left.''<br />
<br />
<br />
[[Category:Standards]]<br />
[[Category:Tiling]]</div>Wiki-Allensmith