| Version 4 (modified by celso, 6 years ago) |
|---|
SAPO::Widget.Maps->renderMap
This method will render an interactive Map from SAPO Mapas
Syntax
var render = new SAPO.Widget.Maps({
mapspot:'div_id_name',
maptitle:'Map Example',
mapcss:'smapa',
selfrender: false,
markers: Markers
});
render.renderTags(jsonMarkers);
CSS Styles
#smapa { position:relative;top:10px;left:50px;width:800px;height:500px;background-color:#FDF7DE }
#smapa .tab {height:2em;}
#smapa .map_pin { position:absolute; top:-2px; left:20px; margin:2px 0 0 0; border:1px solid black;
padding-left:2px; padding-right:2px; background-color:#eeeeee; font-weight:bold; font-size:0.8em;
color:#484848; font-family: verdana; white-space:nowrap }
Input Parameters
All the parameters come form the main class JSON object. See Syntax.
Markers JSON object
var Markers= {
"rss": {
"channel": {
"copyright": "©2005, PT.COM",
"description": "Pesquisa Notícias por title:lisboa",
"item": [
{
"author": "Rádio Renascença",
"dc:date": "2006-10-25T23:19:00Z",
"description": "Os trabalhadores ..",
"guid": "http:\/\//www.rr.pt\/noticia.asp?idnoticia=178760",
"link": "http:\/\/www.rr.pt\/noticia.asp?idnoticia=178760",
"title": "Lisboa: Funcionários admitem fazer greve",
"geo:lat": 38.711548,
"geo:lon": -9.13774
},
{
"author": "Público",
"dc:date": "2006-10-25T19:01:00Z",
"description": "...seu avião tenha aterrado de emergência hoje no aeroporto de Lisboa",
"guid": "http:\/\/www.publico.clix.pt\/shownews.asp?id=1274542",
"link": "http:\/\/www.publico.clix.pt\/shownews.asp?id=1274542",
"title": "Avião da EasyJet aterrou em Lisboa \"por precaução\"",
"geo:lat": 38.769882,
"geo:lon": -9.128402
}
] //item
} //channel
} //rss
}; //obj
Optional Markers parameters
Markers.map_options= {
mapcontrol: "large",
lat: 39, // optional
lon: -9 , // optional
zoom: 12, // optional (17-10)
navigation: false, // optional, default is true
locator_callback: null //callback function for widgets - optional
};
Markers.icon= {
image: "http://mapas.sapo.pt/imgs/feed.png", // img src or html
iconSize: {x: 16, y: 16},
infoWindowAnchor: {x: 8, y: 0},
iconAnchor: {x: 8, y: 0} // pixel offset from lat,lon
}
Markers.icon_selected= {
image: "http://mapas.sapo.pt/imgs/feed_sel.png", // img src or html
iconSize: {x: 16, y: 16},
infoWindowAnchor: {x: 8, y: 0},
iconAnchor: {x: 8, y: 0}, // pixel offset from lat,lon
display_titles: true // display titles using "map_pin" css class
}
Compatibility
| All browsers | Yes |
Depends
- http://js.sapo.pt/XML/W3CDom/
- http://js.sapo.pt/XML/Sax/
- http://js.sapo.pt/SAPO/
- http://js.sapo.pt/SAPO/Exception/
- http://js.sapo.pt/SAPO/Maps/Map/
- http://js.sapo.pt/SAPO/Widget/Maps/
Sample
Other methods from this Class
Community feedback