<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Gestión del Territorio</title>
  <link rel="alternate" href="http://blog.andago.com/web/blog-andago/gestion-del-territorio/-/blogs/rss" />
  <subtitle>Gestión del Territorio</subtitle>
  <entry>
    <title>OpenLayers: Reproyeción de capas WMS (EPSG:4326) sobre proyección de GoogleMaps (EPSG:900913).</title>
    <link rel="alternate" href="http://blog.andago.com/web/blog-andago/gestion-del-territorio/-/blogs/openlayers:-reproyecion-de-capas-wms-epsg:4326-sobre-proyeccion-de-googlemaps-epsg:900913" />
    <author>
      <name>José Luis García Monzón</name>
    </author>
    <id>http://blog.andago.com/web/blog-andago/gestion-del-territorio/-/blogs/openlayers:-reproyecion-de-capas-wms-epsg:4326-sobre-proyeccion-de-googlemaps-epsg:900913</id>
    <updated>2009-08-06T11:09:33Z</updated>
    <published>2009-08-06T08:13:59Z</published>
    <summary type="html">&lt;p&gt;&lt;meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"&gt;&lt;title&gt;&lt;/title&gt;&lt;meta name="GENERATOR" content="OpenOffice.org 3.0  (Win32)"&gt;&lt;style type="text/css"&gt;	&lt;!--	@page { margin: 2cm }	P { margin-bottom: 0.21cm }	--&gt;	&lt;/style&gt; &lt;/meta&gt;&lt;/meta&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin-bottom: 0cm; text-align: center;"&gt;&lt;img height="405" width="551" src="http://blog.andago.com/image/image_gallery?uuid=e7656ad1-7025-4ec7-b93b-9bdf6908d176&amp;amp;groupId=16326&amp;amp;t=1249556784316" alt="" /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;Uno de los principales problemas a los que nos enfrentamos a la hora de mostrar datos cartográficos es la multi-proyección de las diferentes capas que queremos integrar. El problema se acentúa cuando utilizamos proyecciones tan específicas como la EPSG:900913 de GoogleMaps. A continuación os comento cómo resolvimos ciertos problemas que nos fueron surgiendo con la utilización de capas servidas vía WMS con proyección EPSG:4326. Entre los problemas que encontrábamos era que la mayoría de los servidores OGC, de cartografía de España, ofrecían datos en unas proyecciones que no terminaban de encajar con las de GoogleMaps, como el IDEE, Catastro, Cartociudad, etc... ni con los datos propios almacenados en proyecciones diferentes. Esto hacía que los mapas y puntos editados con OpenLayers apareciesen desplazados en oblicuo, con lo que no podíamos solapar las capas.&lt;/p&gt;            &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;El problema lo resolvimos configurando OpenLayers para que permita GoogleMaps como capa principal base, y peticiones&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;a mapserver para proyecciones sobre EPSG:4326, siendo mapserver el encargado de realizar las peticiones al resto de servidores&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;OGC vía WMS sobre la proyección correcta. Por cierto, el OpenLayers Spherical Mercator no nos valió, o no supimos configurarlo bien.&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;Las configuraciones que hemos realizado en cada uno de los archivos del sistema son:&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&lt;strong&gt;CONFIGURACIÓN&amp;nbsp;OPENLAYERS&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;En el api de definición de capas de Openlayers, hemos definido como capa principal la de GoogleMaps y una nueva con proyección EPSG:4326.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;   &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;var options = {&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;projection: new OpenLayers.Projection(&amp;quot;EPSG:900913&amp;quot;),&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;displayProjection: new OpenLayers.Projection(&amp;quot;EPSG:4326&amp;quot;),&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;units: &amp;quot;m&amp;quot;,&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;numZoomLevels: 18,&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;maxResolution: 156543.0339,&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34)&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;};&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;map = new OpenLayers.Map('map', options);&amp;nbsp;&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;&lt;p&gt;Hemos definido una nueva capa WMS sobre nuestro cgi &amp;quot;mapserv&amp;quot; que realiza las llamadas al CGI de mapserver.&amp;nbsp;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;  &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;var wms = new OpenLayers.Layer.WMS( &amp;quot;Pruebas&amp;quot;,&amp;quot;http://localhost:8180/pruebas/cgi-bin/mapserv?&amp;quot;,&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;{ map: /opt/configuracion.map,&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;transparent: 'true', layers:&amp;quot;Puntos Interés&amp;quot; ,&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;format: 'image/png',&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;units: &amp;quot;m&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;},{singleTile: 'false'});&lt;/p&gt;&lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;nbsp;&lt;/p&gt;  &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&lt;strong&gt; CONFIGURACIÓN&amp;nbsp;MAPSERVER&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Para que mapserver entienda la proyección de Google se ha incluido esta linea en el archivo /usr/share/proj/epsg:&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;  &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;lt;900913 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&lt;a target="Mapserver" href="http://trac.osgeo.org/mapserver/wiki/RenderingOsmData"&gt;http://trac.osgeo.org/mapserver/wiki/RenderingOsmData&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;&amp;nbsp;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;En el archivo de configuración del mapserver &amp;quot;configuracion.map&amp;quot; se han definido las proyecciones a utilizar, aunque creo que no son todas necesarias:&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;   &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;wms_srs&amp;quot; &amp;quot;epsg:4326 EPSG:23030 EPSG:900913&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;PROJECTION&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;init=epsg:900913&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;END&amp;nbsp;&lt;/p&gt;   &lt;ul&gt;&lt;li&gt;En el archivo de configuración de mapserver hemos incluido la definición de una nueva capa con los datos da acceso WMS de Catastro.&lt;/li&gt;&lt;/ul&gt;  &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;LAYER&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;NAME CATASTRO&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;SIZEUNITS PIXELS&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;TYPE RASTER&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;UNITS METERS&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;STATUS off&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;TRANSPARENCY 40&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;CONNECTIONTYPE WMS&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;CONNECTION  &amp;quot;http://ovc.catastro.meh.es/Cartografia/WMS/ServidorWMS.aspx?&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;METADATA&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;wms_srs&amp;quot; &amp;quot;EPSG:4326&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;wms_name&amp;quot;  &amp;quot;Catastro&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;wms_formatlist&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;image/png,image/jpeg,image/gif,image/bmp,image/tif,image/wmf&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;wms_format&amp;quot;  &amp;quot;image/png&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;selected&amp;quot;  &amp;quot;0&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;wms_server_version&amp;quot;  &amp;quot;1.1.0&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;wms_title&amp;quot; &amp;quot;Catastro&amp;quot;EPSG:4326&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;wms_transparent&amp;quot; &amp;quot;false&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;&amp;quot;wms_connectiontimeout&amp;quot; &amp;quot;40&amp;quot;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;END&lt;/p&gt; &lt;p style="margin-bottom: 0cm; text-align: justify; margin-left: 40px;"&gt;END # Layer&lt;/p&gt;&lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&amp;nbsp;&lt;/p&gt;  &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;Espero que a alguien le ayude los pasos que hemos seguido, y sobre todo si sabéis una forma más sencilla de utilización en openLayers con la cartografía de GoogleMaps como base, capas de mapserver, capas WMS en proyección EPSG:4326 y funcionalidades de edición, que nos lo comente.&lt;/p&gt;&lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&amp;nbsp;&lt;/p&gt;   &lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;Un saludo&lt;/p&gt;&lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin-bottom: 0cm; text-align: justify;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</summary>
    <dc:creator>José Luis García Monzón</dc:creator>
    <dc:date>2009-08-06T08:13:59Z</dc:date>
  </entry>
</feed>