asp.net mvc 4 - Shows only the last marker info window even though there are 154 others -
so managed markers , info windows workin using razor , google maps api doing following:
@{ ienumerable<ufa.location.core.location> location = ufalocation___front.helpers.queryhelper.queryhelper.getalllocations(); foreach(var loc in location){ <text> var contentstring_@loc.id = "@loc.name"; mapmarker_@loc.id = new google.maps.marker({ position: new google.maps.latlng(@loc.latitude, @loc.longitude), map: map, title: "hello world!" }); var infowindow = new google.maps.infowindow({ content: contentstring_@loc.id }); google.maps.event.addlistener(mapmarker_@loc.id, 'click', function() { infowindow.open(map, mapmarker_@loc.id); }); </text> } } updated
so shows info box each location, want content in it, name of last location, regardless of location. info box not tied 1 specific location, though have made them each id, if makes sense.
<script defer="defer" type="text/javascript"> var map = new openlayers.map('map', {alloverlays: true, controls: []}); var wms_layer_test_5000_fkr = new openlayers.layer.wms( 'test_5000_fkr', 'http://130.237.175.39:8080/geoserver/wms/test_test', {layers: 'test_5000_fkr', transparent: "true", format: "image/png"}, {maxextent: new openlayers.bounds(585000, 6600000, 740000, 6722500), maxresolution: 'auto', projection:"epsg:3006", units: "m"}, {isbaselayer: false}, {visibility: true}, {transparent: true} ); map.addlayers([wms_layer_test_5000_fkr]); var scalebar = new openlayers.control.scaleline(); map.addcontrol(scalebar); map.addcontrol( new openlayers.control.mouseposition({ prefix: '<a target="_blank" ' + 'href="http://spatialreference.org/ref/epsg/3006/">' + 'sweref99 tm: </a>', separator: ' , ', numdigits: 0, emptystring: 'mouse not on map.' }) ); var panel = new openlayers.control.navtoolbar(); map.addcontrol(panel); var panzoom = new openlayers.control.panzoombar(); map.addcontrol(panzoom); var layer = new openlayers.control.layerswitcher({'ascending':false}); map.addcontrol(layer); map.zoomtomaxextent(); </script>
Comments
Post a Comment