[Spanish] Re: Problema con popup en capa MapServer
Laurent Vaïsse
lvaisse at gmail.com
Thu Oct 21 11:28:26 EDT 2010
Este ejemplo funciona con WFS, y vi que tu mapfile si esta configurado para
WFS, sin embargo, me parece que lla forma la mas facil de servir tus datos,
en un popup o en cualquier otra parte de tu pagina web, es usar la funcion
GetFeatureInfo de OpenLayers con el WMS..
http://openlayers.org/dev/examples/getfeatureinfo-popup.html
Saludos
On Wed, Oct 20, 2010 at 11:54 AM, florencia.bujan <florita026 en gmail.com>wrote:
>
> Laurent,
>
> Muchas gracias por tu respuesta.
> Te cuento que estoy trabajando con OpenLayers. Además tengo la base de
> datos
> en PostGis.
>
> Hace algunos meses que estoy trabajando con esta herramienta y me ha sido
> de
> gran utilidad. Las capas me las dibuja correctamente y puedo hacer
> consultas
> sobre ellas. Ahora estoy tratando de desplegar en popup información traida
> desde la geodatabase.
>
> O sea, lo que yo quiero hacer ahora es mostrar (además de los mapas con sus
> colores) la información adicional de la GDB en alguna parte. En el ejemplo
> que me estoy basando es el siguiente:
> http://dev4.mapgears.com/bdga/options-by-zoom-and-highlight-bdga.html,
> pero
> tal vez tu me dices que hay otra forma mejor de hacerlo sin necesidad de
> los
> popups.
>
> En el .map me defino la capa de la siguiente forma:
>
> ************* MAP FILE ***************
> MAP
> NAME GIS
> SIZE 700 700
> STATUS ON
> EXTENT -63.4393 -33.974 -48.1827 -32.0861
>
> FONTSET "misc/fonts/fonts.txt"
> SYMBOLSET "misc/symbols/symbols.sym"
>
> IMAGECOLOR 255 255 255
> UNITS dd
>
> WEB
> METADATA
> "wms_title" "Sistema de
> Información Geográfica"
> "wms_onlineresource"
> "
> http://localhost/cgi-bin/mapserv.exe?map=../htdocs/Florencia/GISManager/flor.map&
> "
> "wms_srs" "EPSG:4326"
> "wms_transparent" "true"
> "labelcache_map_edge_buffer" "-10"
> "wfs_title" "Terrazas"
> "wfs_onlineresource"
> "
> http://localhost/cgi-bin/mapserv.exe?map=../htdocs/Florencia/GISManager/flor.map&
> "
> "wfs_srs" "EPSG:4326"
> "wfs_abstract" "Some text"
> "wfs_encoding" "UTF-8"
> "wfs_namespace_prefix" "MF"
> END
> END
>
> PROJECTION
> "init=EPSG:4326"
> END
>
> # Capa de Terrazas
> LAYER
> CONNECTIONTYPE postgis
> NAME "Terrazas"
> STATUS ON
> CONNECTION "user=** password=** dbname=** host=**"
> DATA "the_geom from (SELECT l.* from terrazas l, campos c
> WHERE
> c.id=l.idcampo) as terrazas using unique gid using SRID=-1"
> METADATA
> "wfs_title" "Terrazas"
> "gml_featureid" "Terrazas"
> "gml_include_items" "all"
> "wfs_typename" "Terrazas"
> END
>
> TYPE LINE
> CLASS
> NAME "Terrazas"
> STYLE
> SIZE 4
> COLOR 0 192 255
> SYMBOL "BigLine"
> END
> END
> TOLERANCE 20
> END
> END
>
>
>
>
>
> En la función init del openlayers tengo algo del estilo:
>
> ****** OPENLAYERS ********
> OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '2';
>
> var oRegStyleMap = new OpenLayers.StyleMap({
> strokeColor: "black",
> strokeWidth: 2,
> strokeOpacity: 1,
> fillOpacity: 0.8
> });
>
> var aRegColor = {
> '01': {fillColor:"purple" },
> '02': {fillColor:"blue" },
> '03': {fillColor:"yellow" },
> '04': {fillColor:"red" },
> '05': {fillColor:"#ffa500" }, //orange
> '06': {fillColor:"red" },
> '07': {fillColor:"purple" },
> '08': {fillColor:"blue" },
> '09': {fillColor:"green" },
> '10': {fillColor:"#ffa500" },
> '11': {fillColor:"#ffa500" },
> '12': {fillColor:"green" },
> '13': {fillColor:"purple" },
> '14': {fillColor:"#ffa500" },
> '15': {fillColor:"yellow" },
> '16': {fillColor:"green" },
> '17': {fillColor:"blue" }
> };
> oRegStyleMap.addUniqueValueRules("default", "res_co_reg", aRegColor);
>
> // LOCAL SETTINGS
> var szBDGAMapPath = "../htdocs/Florencia/GISManager/flor.map";
> var szHost = "http://localhost/";
> var szMSURL = szHost+"cgi-bin/mapserv.exe";
>
> oMap = new OpenLayers.Map( 'map');
>
> //CAPA BASE
> var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
> "http://vmap0.tiles.osgeo.org/wms/vmap0",
> {layers: 'basic'} );
> oMap.addLayers([wms]);
> oMap.setCenter(new OpenLayers.LonLat(-57.5, -34), 9);
>
> //CAPA LOCAL
> var olWFSReg = new OpenLayers.Layer.Vector("Terrazas", {
> styleMap: oRegStyleMap,
> strategies: [
> new OpenLayers.Strategy.OptionsByZoom({
> optionsByZoom: {
> 0: {featureType: "Terrazas"},
> 1: {featureType: "Terrazas"},
> 2: {featureType: "Terrazas"},
> 3: {featureType: "Terrazas"}
> },
> defaultOptions: {featureType: "Terrazas"}
> }),
> new OpenLayers.Strategy.BBOX()
> ],
> protocol: new OpenLayers.Protocol.WFS({
> version: "1.0.0",
> url: stringMapa+"&",
> extractAttributes:true,
> featureType: "Terrazas",
> srsName: "EPSG:4326",
> featureNS: "http://localhost4/",
> geometryName: "the_geom",
> schema:
>
> szMSURL+"?service=WFS&version=1.0.0&request=DescribeFeatureType&TypeName=Terrazas"
> })
> });
> oMap.addLayers([ olWFSReg ]);
>
> var highlighter = new OpenLayers.Control.HighlightFeature({
> layer: olWFSReg,
> displayPopup: true,
> popupOffset: {
> 'left': 45,
> 'right': 0,
> 'top': 5
> },
> popupTitle: "Province information",
> popupSize: new OpenLayers.Size(200,225),
> style:{
> strokeColor: "black",
> strokeWidth: 2,
> strokeOpacity: 0.8,
> fillOpacity: 0.5,
> fillColor: "black"
> }
> });
> oMap.addControl(highlighter);
> highlighter.activate();
>
> oMap.addControl(new OpenLayers.Control.Navigation());
> oMap.addControl(new OpenLayers.Control.Scale($('scale')));
> oMap.addControl(new OpenLayers.Control.LayerSwitcher());
> oMap.addControl(new OpenLayers.Control.PanZoomBar());
>
>
> Desde ya muchas gracias y saludos,
> Florencia
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Problema-con-popup-en-capa-MapServer-tp5655608p5655941.html
> Sent from the OSGeo Spanish Local Chapter mailing list archive at
> Nabble.com.
> _______________________________________________
> Spanish mailing list
> Spanish en lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/spanish
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://lists.osgeo.org/pipermail/spanish/attachments/20101021/98b3f3e0/attachment-0001.html
More information about the Spanish
mailing list