Benutzer:Red Rooster: Unterschied zwischen den Versionen

Aus FürthWiki

Zeile 17: Zeile 17:


==wikiscript test==
==wikiscript test==
wikiscript  
<wikiscript  
src="http://gmodules.com/ig/ifr?url=http://www.therandomhomepage.com/google/gadgets/randomwiki/RandomWikiModule.xml
src="http://gmodules.com/ig/ifr?url=http://www.therandomhomepage.com/google/gadgets/randomwiki/RandomWikiModule.xml
  &up_moduletitle=&up_language=en&synd=open&w=320&h=350
  &up_moduletitle=&up_language=en&synd=open&w=320&h=350
  &title=&lang=en&country=ALL&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js">
  &title=&lang=en&country=ALL&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js">
/wikiscript>
<wikiscript src="http://wiki.faerdd.com/public_html/wiki/index.php/Benutzer:Red_Rooster/wikiminiatlas2.js"></wikiscript>
<wikiscript type="text/javascript">
        var lon = 5;
        var lat = 40;
        var zoom = 5;
        var map, layer, gml;
        function export_vectors() {
            var x = new OpenLayers.Format.XML();
            var content = x.write(gml.renderer.rendererRoot);
            $("vectors").value = content;
            $("vectors").style.display = "block";
            $("vectorlink").href = "data:image/svg+xml," + escape(content);
            $("vectorlink").style.display="block";
        }
        function on_feature_hover(feature) {
            var text ="<ul>";
            var type ="way";
            if (feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
                type = "node";
            }   
            text += "<li>" + feature.osm_id + ": <a href='http://crschmidt.net/osm/attributes.html?type="+type+"&id="+feature.osm_id+"'>Edit</a>, <a href='http://www.openstreetmap.org/api/0.5/"+type + "/" + feature.osm_id + "'>API</a></li>";
            for (var key in feature.attributes) {
                text += "<li>" + key + ": " + feature.attributes[key] + "</li>";
            }
            text += "</ul>";
            $("status").innerHTML = text;
        } 
        function clear_data() {
            gml.destroyFeatures();
        }
        function new_data() {
            if (!check_zoom()) { return; }
            clear_data();
            gml.loaded = false;
            gml.url = "http://www.openstreetmap.org/api/0.5/map?bbox=" + map.getExtent().toBBOX();
            $("status").innerHTML = "Loading more data...";
            gml.loadGML();
        }
        function style_osm_feature(feature) {
            feature.style = OpenLayers.Util.extend({'fill':'black'}, OpenLayers.Feature.Vector.style['default']);
            if (feature.attributes.highway == "motorway") {
                feature.style.strokeColor = "blue";
                feature.style.strokeWidth = 5;
            } else if (feature.attributes.highway == "primary") {
                feature.style.strokeColor = "red";
            } else if (feature.attributes.highway == "secondary") {
                feature.style.strokeColor = "orange";
            } else if (feature.attributes.highway) {
                feature.style.strokeColor = "black";
            } 
        }
        function check_zoom() {
            var zoom = map.getZoom();
            if (zoom >= 11) { return true; }
            if (zoom >= 9) { return confirm("Loading this amount of data may slow your browser. Are you sure you want to do this?"); }
            $("status").innerHTML = "Area too large. Zoom in to load data. (Current zoom level: "+ zoom + ". Must be at zoom 9+.)";
            return false;
        }   
        function init(){
            OpenLayers.ProxyHost = "proxy.cgi?url=";
            OpenLayers.Feature.Vector.style['default'].strokeWidth = 4;
            OpenLayers.Feature.Vector.style['default'].cursor = 'pointer';
            map = new OpenLayers.Map('map', {'maxResolution': 360/512/16, 'numZoomLevels':15, controls: [ new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanZoomBar() ]});
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.Permalink());
            layer = new OpenLayers.Layer.WMS( "OSM",
              [
                "http://t1.hypercube.telascience.org/tiles?",
                "http://t2.hypercube.telascience.org/tiles?",
                "http://t3.hypercube.telascience.org/tiles?",
                "http://t4.hypercube.telascience.org/tiles?"
                ],
                {layers: 'osm-4326', format: 'image/png' } );
            map.addLayer(layer);
            if (!map.getCenter()) {
                gml = new OpenLayers.Layer.GML("OSM", "osm/sutton_coldfield.osm", {format: OpenLayers.Format.OSM});
                map.zoomToExtent(new OpenLayers.Bounds(-1.819072,52.549034,-1.814341,52.551582));
            } else {
                if (map.getZoom() >= 11) {
                    gml = new OpenLayers.Layer.GML("OSM", "http://www.openstreetmap.org/api/0.5/map?bbox=" + map.getExtent().toBBOX(), {format: OpenLayers.Format.OSM});
                } else {
                    gml = new OpenLayers.Layer.GML("OSM", "xml/cambridgeport.osm", {format: OpenLayers.Format.OSM});
                }   
            }   
            gml.events.register("loadstart", null, function() { $("status").innerHTML = "Loading..."; })
            gml.events.register("loadend", null, function() { $("status").innerHTML = ""; })
            map.addLayer(gml);
            gml.preFeatureInsert = style_osm_feature;
            var sf = new OpenLayers.Control.SelectFeature(gml, {'onSelect': on_feature_hover});
            map.addControl(sf);
            sf.activate();
        }
</wikiscript>
</wikiscript>

Version vom 15. März 2008, 23:52 Uhr

Links

Java

Beiträge von Red Rooster

openStreetMaps

Vorlage:Browse link <map>lat=55.25|lon=-3.845|zoom=5|w=300|h=460</map>

http://www.openstreetmap.org/?lat=49.47417&lon=10.98879&zoom=15&layers=B0FT

wikiscript test

<wikiscript src="http://gmodules.com/ig/ifr?url=http://www.therandomhomepage.com/google/gadgets/randomwiki/RandomWikiModule.xml

&up_moduletitle=&up_language=en&synd=open&w=320&h=350
&title=&lang=en&country=ALL&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js">

</wikiscript>