Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Pytanie] Mapa google ze zdjecia


Rekomendowane odpowiedzi

Opublikowano

przede wszystkim musisz wyciągnać całą mapkę czyli jak to zdjęcie to zdjęcie poczym przekonwertować to przez pewien program co daje nam widok z lotu ptaka poczym ją dodac do głownej bazy.

Opublikowano

http://sdpanel.p.ht/gamehub/mapa/index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>SDMap</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=AIzaSyCB57WP6Wos61VhxicXtXJt2bBJCgj315o" type="text/javascript"></script>
    <script type="text/javascript">

      // EuclideanProjection taken from: http://econym.googlepages.com/example_custommapflat.htm

      // ====== Create the Euclidean Projection for the flat map ======
      // == Constructor ==
      function EuclideanProjection(a){
        this.pixelsPerLonDegree=[];
        this.pixelsPerLonRadian=[];
        this.pixelOrigo=[];
        this.tileBounds=[];
        var b=256;
        var c=1;
        for(var d=0;d<a;d++){
          var e=b/2;
          this.pixelsPerLonDegree.push(b/360);
          this.pixelsPerLonRadian.push(b/(2*Math.PI));
          this.pixelOrigo.push(new GPoint(e,e));
          this.tileBounds.push(c);
          b*=2;
          c*=2
        }
      }
 
      // == Attach it to the GProjection() class ==
      EuclideanProjection.prototype=new GProjection();
 
 
      // == A method for converting latitudes and longitudes to pixel coordinates == 
      EuclideanProjection.prototype.fromLatLngToPixel=function(a,{
        var c=Math.round(this.pixelOrigo[b].x+a.lng()*this.pixelsPerLonDegree[b]);
        var d=Math.round(this.pixelOrigo[b].y+(-2*a.lat())*this.pixelsPerLonDegree[b]);
        return new GPoint(c,d)
      };

      // == a method for converting pixel coordinates to latitudes and longitudes ==
      EuclideanProjection.prototype.fromPixelToLatLng=function(a,b,c){
        var d=(a.x-this.pixelOrigo[b].x)/this.pixelsPerLonDegree[b];
        var e=-0.5*(a.y-this.pixelOrigo[b].y)/this.pixelsPerLonDegree[b];
        return new GLatLng(e,d,c)
      };

      // == a method that checks if the y value is in range, and wraps the x value ==
      EuclideanProjection.prototype.tileCheckRange=function(a,b,c){
        var d=this.tileBounds[b];
        if (a.y<0 || a.y>=d || a.x<0 || a.x>=d) { // By DracoBlue: added this, to avoid repeatition 
          return false;
        }
        return true
      }

      // == a method that returns the width of the tilespace ==      
      EuclideanProjection.prototype.getWrapWidth=function(zoom) {
        return this.tileBounds[zoom]*256;
      }
	  
	  
	// Here comes the dmap specific stuff:

	var gtasaIcons = {};
	var markers = [];
	var markersText = [];
	var map = null;
	var update_c = 1;
	
	function fetchData() {
		GDownloadUrl("fetch_data.php?uc="+update_c+"&json=", function(data) {
			update_c++;
			data = eval("("+data+")");
			if (typeof data.items !== "undefined") {
				for (id in data.items) {
					var item = data.items[id];
					var point = new GLatLng(((parseFloat(item.pos.y)*90)/3000),
								((parseFloat(item.pos.x)*90)/1500));
					if (typeof markers[item.id] === "undefined" || markers[item.id] === null) {
						markers[item.id] = {}
						var marker = createMapMarker(point, item.id, item.text, parseInt(item.icon));
						markers[item.id].marker = marker;
						markers[item.id].id = item.id;
						markersText[item.id] = "<b>" + item.name + "</b> <br/>" + item.text;
						map.addOverlay(markers[item.id].marker);
					} else {
						// already exists: update!
						markersText[item.id] = "<b>" + item.name + "</b> <br/>" + item.text;
						markers[item.id].marker.setLatLng(point);
					}
					markers[item.id].update_c = update_c;
				}
			}
			// remove the old ones
			for (i in markers) {
				if (markers[i].update_c != update_c) {
					map.removeOverlay(markers[i].marker);
					markers[i] = null;
					markersText[id] = null;
				}
			}
		});
	}

	function checkBounds() {
		var allowedBounds;

		if(map.getZoom()==2)
		   allowedBounds = new GLatLngBounds(new GLatLng(-45, -42), new GLatLng(45, 43));
		else if(map.getZoom()==3)
		   allowedBounds = new GLatLngBounds(new GLatLng(-80, -115), new GLatLng(80, 120));
		else
		   allowedBounds = new GLatLngBounds(new GLatLng(-130, -150), new GLatLng(130, 150));

		if (allowedBounds.contains(map.getCenter())) return;
		var C = map.getCenter();
		var X = C.lng();
		var Y = C.lat();
		var AmaxX = allowedBounds.getNorthEast().lng();
		var AmaxY = allowedBounds.getNorthEast().lat();
		var AminX = allowedBounds.getSouthWest().lng();
		var AminY = allowedBounds.getSouthWest().lat();
		if (X < AminX) X = AminX;
		if (X > AmaxX) X = AmaxX;
		if (Y < AminY) Y = AminY;
		if (Y > AmaxY) Y = AmaxY;
		map.setCenter(new GLatLng(Y, X));
	}
	
    function load(){
		if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("map"));

			var copyright = new GCopyright(1, new GLatLngBounds(new GLatLng(-180, -180), new GLatLng(180, 180)), 0, '');
			var copyrights = new GCopyrightCollection('');
			copyrights.addCopyright(copyright);
			var tilelayer = new GTileLayer(copyrights, 1, 4);
			tilelayer.getTileUrl = function(tile, zoom) { 
			return 'map/'+tile.x+'x'+tile.y+'-'+(6-zoom)+".jpg"; };
			var CUSTOM_MAP = new GMapType( [tilelayer], new EuclideanProjection(20), "SD" );
			CUSTOM_MAP.getMinimumResolution = function(){return 2};
			CUSTOM_MAP.getMaximumResolution = function(){return 4};
			
			map.addMapType(CUSTOM_MAP);
			map.setMapType(CUSTOM_MAP);
			map.addControl(new GSmallMapControl());
			map.enableScrollWheelZoom();
			map.setCenter(new GLatLng(0, 0), 2);
			GEvent.addListener(map, "move", function () {
				checkBounds()
			});
			document.getElementById('map').style.backgroundColor = "#324a54";
			fetchData();
		}
    }

    function createMapMarker(point, id, text, type) {
	
	if (typeof gtasaIcons[type] === "undefined") {
		var icon = new GIcon(); 
		icon.image = 'icons/Icon_'+type+'.gif';
		icon.iconSize = new GSize(20, 20);
		icon.iconAnchor = new GPoint(10, 10);
		icon.infoWindowAnchor = new GPoint(1, 1);
		gtasaIcons[type] = icon;
	}
	
      var marker = new GMarker(point, gtasaIcons[type]);
      GEvent.addListener(marker, 'click', function() {
        marker.openInfoWindowHtml(markersText[id]);
      });
      return marker;
    }

    //]]>
    </script>
	<style type="text/css">
		.gmnoprint {
			background: #3b3b3b;
			color: #fff;
			font-family: Tahoma;
			font-size: 13px;
			-webkit-border-radius: 5px;
			-moz-border-radius: 5px;
			border-radius: 5px;
		}
		img[src="http://maps.gstatic.com/intl/pl_ALL/mapfiles/iw3.png"]{
			filter: alpha(opacity=30);
			opacity: 0.3;
		}
		a {
			text-decoration: none;
			filter: alpha(opacity=30);
			opacity: 0.3;
		}
		body {
			margin: 0;
			padding: 0;
			background: #3b3b3b url(img/bg.jpg);
			background-size: 100%;
			background-attachment: fixed;
			color: #fff;
			font-family: Tahoma;
			font-size: 13px;
		}
		#map {
			margin: 0;
			padding: 0;
		}
	</style>
  </head>

	<body onload="load()" onunload="GUnload()">
		<div id="map" style="width: 780px; height: 512px"></div>
	</body>
</html>

to jest źródło tej mapki, może uda ci się to zmienić pod siebie ;)

Osobiście pomagam tylko na PW lub e-mail


-----------------------------------------------------------------


https://github.com/smietanka

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...