把google地图放在自己的网站,希望添加的地址标签只在自己网站看到,别的网站不能看到google官方网站也不能看到我的地点标记 打算给自己的网站放个google地图,听说挺简单。但我希望在自己的网站给google地图添加的标签(如:我公司的某办事处,我公司的研发机构地址等),只能在我们自己网站看到,别的网站不能看到我输入的地点标签。google官方网站也不能看到我的地点标记。这些地址都是商业机密。请问能实现吗?怎么做?具体怎么做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以的标记其实只是在MAP上画的点,跟服务器无关var map = null; var geocoder = null; var icon_red = new GIcon(); icon_red.image = "http://labs.google.com/ridefinder/images/mm_20_red.png"; icon_red.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; icon_red.iconSize = new GSize(12, 20); icon_red.shadowSize = new GSize(22, 20); icon_red.iconAnchor = new GPoint(6, 20); icon_red.infoWindowAnchor = new GPoint(5, 1); var METERS_PER_MILE = 1609.344; var reg = new RegExp("(^|&)"+ "Zip" +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); var DEFAULT_ZIP=""; if (r!=null) { DEFAULT_ZIP =r[2]; } var DEFAULT_RADIUS1 = 5; var DEFAULT_RADIUS2 = 10; var DEFAULT_RADIUS3 = 15; var DEFAULT_RADIUS4 = 20; var DEFAULT_RADIUS5 = 25; var DEFAULT_RADIUS6 = 30; var zip = DEFAULT_ZIP; var r1 = DEFAULT_RADIUS1 * METERS_PER_MILE; var r2 = DEFAULT_RADIUS2 * METERS_PER_MILE; var r3 = DEFAULT_RADIUS3 * METERS_PER_MILE; var r4 = DEFAULT_RADIUS4 * METERS_PER_MILE; var r5 = DEFAULT_RADIUS5 * METERS_PER_MILE; var r6 = DEFAULT_RADIUS6 * METERS_PER_MILE; var query_vars = readQueryString(); if (typeof(query_vars["zip"]) != "undefined") zip = query_vars["zip"]; if (typeof(query_vars["r1"]) != "undefined") r1 = parseFloat(query_vars["r1"]) * METERS_PER_MILE; if (typeof(query_vars["r2"]) != "undefined") r2 = parseFloat(query_vars["r2"]) * METERS_PER_MILE; if (typeof(query_vars["r3"]) != "undefined") r3 = parseFloat(query_vars["r3"]) * METERS_PER_MILE; if (typeof(query_vars["r4"]) != "undefined") r4 = parseFloat(query_vars["r4"]) * METERS_PER_MILE; if (typeof(query_vars["r5"]) != "undefined") r5 = parseFloat(query_vars["r5"]) * METERS_PER_MILE; if (typeof(query_vars["r6"]) != "undefined") r6 = parseFloat(query_vars["r6"]) * METERS_PER_MILE; function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("go_map")); map.disableDragging(); alert(map); geocoder = new GClientGeocoder(); showMap(zip); } } function showMap(zipCode) { if (geocoder) { geocoder.getLatLng( ZipCode, function(point) { if (!point) { alert(zipCode + " not found"); } else { var mapBounds = new GLatLngBounds(); mapBounds.extend(destPoint(0, r6, point)); mapBounds.extend(destPoint(60, r6, point)); mapBounds.extend(destPoint(120, r6, point)); mapBounds.extend(destPoint(180, r6, point)); mapBounds.extend(destPoint(240, r6, point)); mapBounds.extend(destPoint(300, r6, point)); mapBounds.extend(destPoint(360, r6, point)); map.setCenter(point, map.getBoundsZoomLevel(mapBounds)); map.addOverlay(new GMarker(point,icon_red)); drawFilledCircle(point, destPoint(360, r6, point), "#FF0000"); drawFilledCircle(point, destPoint(360, r5, point), "#ffd600"); drawFilledCircle(point, destPoint(360, r4, point), "#57ef15"); drawFilledCircle(point, destPoint(360, r3, point), "#0046ad"); drawFilledCircle(point, destPoint(360, r2, point), "#ffd600"); drawFilledCircle(point, destPoint(360, r1, point), "#ee0ba9"); drawCircle(point, destPoint(270, r6, point), "#FF0000"); drawCircle(point, destPoint(270, r5, point), "#ffd600"); drawCircle(point, destPoint(270, r4, point), "#57ef15"); drawCircle(point, destPoint(270, r3, point), "#0046ad"); drawCircle(point, destPoint(270, r2, point), "#ffd600"); drawCircle(point, destPoint(270, r1, point), "#ee0ba9"); } } ); } } function drawCircle(centerMarker, radiusMarker, color){ var normalProj = G_NORMAL_MAP.getProjection(); var zoom = map.getZoom(); var centerPt = normalProj.fromLatLngToPixel(centerMarker, zoom); var radiusPt = normalProj.fromLatLngToPixel(radiusMarker, zoom); var circlePoints = Array(); with (Math) { var radius = floor(sqrt(pow((centerPt.x-radiusPt.x),2) + pow((centerPt.y-radiusPt.y),2))); for (var a = 0 ; a < 361 ; a+=10 ) { var aRad = a*(PI/180); y = centerPt.y + radius * sin(aRad) x = centerPt.x + radius * cos(aRad) var p = new GPoint(x,y); circlePoints.push(normalProj.fromPixelToLatLng(p, zoom)); } map.addOverlay(new GPolyline(circlePoints, color, 1, 0.5)); } } function drawFilledCircle(centerMarker, radiusMarker, color){ var normalProj = G_NORMAL_MAP.getProjection(); var zoom = map.getZoom(); var centerPt = normalProj.fromLatLngToPixel(centerMarker, zoom); var radiusPt = normalProj.fromLatLngToPixel(radiusMarker, zoom); var circlePoints = Array(); with (Math) { var radius = floor(sqrt(pow((centerPt.x-radiusPt.x),2) + pow((centerPt.y-radiusPt.y),2))); var thickness = min(255,radius); for (var n = 1 ; n < floor(2* radius / thickness)+1 ; n++ ) { radiusB = radius - (thickness / 2) * n; for (var a = 0 ; a < 361 ; a+=10 ) { var aRad = a*(PI/180); y = centerPt.y + radiusB * sin(aRad) x = centerPt.x + radiusB * cos(aRad) var p = new GPoint(x,y); circlePoints.push(normalProj.fromPixelToLatLng(p, zoom)); } var radOnEarth = (centerMarker.distanceFrom(radiusMarker)/1000).toFixed(3); map.addOverlay(new GPolyline(circlePoints, color, thickness, 0.15)); } } } function destPoint(brng, dist, p1) { var R = 6371000; var d = parseFloat(dist) / R; brng = (brng) * Math.PI / 180; var latitude = Math.asin( Math.sin(p1.latRadians())*Math.cos(d) + Math.cos(p1.latRadians())*Math.sin(d)*Math.cos(brng) ); var longitude = p1.lngRadians() + Math.atan2(Math.sin(brng) * Math.sin(d) * Math.cos(p1.latRadians()), Math.cos(d) - Math.sin(p1.latRadians()) * Math.sin(latitude)); if (isNaN(latitude) || isNaN(longitude)) return null; return new GLatLng(latitude * (180/Math.PI), longitude * (180/Math.PI)); } function readQueryString (){ var URL = location.href; var a_out = new Object(); var s_loc = String(URL); if(s_loc.indexOf('?')>0) { var p; var s_query = s_loc.substr(s_loc.indexOf('?')+1); var a_query = s_query ? s_query.split('&') : new Array(); for(var i=0; i<a_query.length; i++) { p = a_query[i].split('='); a_out[p[0]] = p[1].replace(/\+/g, ' '); } } return a_out; } window.onload = load(); 有关操作DataList中其它控件的问题。 如何实现树型控件? 在不能使用数据库“作业”功能的情况下,能否在.net程序里实现类似功能 关于在线打印,提供一个简单的工具 关于datagrid的问题,怎么改变超链接的属性? 分不多在一问,获取aspx文件的源代码 我想做一个时间控件(用户控件) 如何能使DataGrid控件中EditCommand事件仅使用一次? 我是做asp的,已七年了,去年12月份开始学asp.net(c#),学了不少,但没什么感觉,请高手指点 asp.net mvc3先上图,否则说不清楚 救救我!! .net技术,Gridview绑定问题,高手请进
标记其实只是在MAP上画的点,跟服务器无关
var map = null;
var geocoder = null;
var icon_red = new GIcon();
icon_red.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon_red.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon_red.iconSize = new GSize(12, 20);
icon_red.shadowSize = new GSize(22, 20);
icon_red.iconAnchor = new GPoint(6, 20);
icon_red.infoWindowAnchor = new GPoint(5, 1);
var METERS_PER_MILE = 1609.344;
var reg = new RegExp("(^|&)"+ "Zip" +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
var DEFAULT_ZIP="";
if (r!=null)
{
DEFAULT_ZIP =r[2];
}
var DEFAULT_RADIUS1 = 5;
var DEFAULT_RADIUS2 = 10;
var DEFAULT_RADIUS3 = 15;
var DEFAULT_RADIUS4 = 20;
var DEFAULT_RADIUS5 = 25;
var DEFAULT_RADIUS6 = 30;
var zip = DEFAULT_ZIP;
var r1 = DEFAULT_RADIUS1 * METERS_PER_MILE;
var r2 = DEFAULT_RADIUS2 * METERS_PER_MILE;
var r3 = DEFAULT_RADIUS3 * METERS_PER_MILE;
var r4 = DEFAULT_RADIUS4 * METERS_PER_MILE;
var r5 = DEFAULT_RADIUS5 * METERS_PER_MILE;
var r6 = DEFAULT_RADIUS6 * METERS_PER_MILE;
var query_vars = readQueryString();
if (typeof(query_vars["zip"]) != "undefined")
zip = query_vars["zip"];
if (typeof(query_vars["r1"]) != "undefined")
r1 = parseFloat(query_vars["r1"]) * METERS_PER_MILE;
if (typeof(query_vars["r2"]) != "undefined")
r2 = parseFloat(query_vars["r2"]) * METERS_PER_MILE;
if (typeof(query_vars["r3"]) != "undefined")
r3 = parseFloat(query_vars["r3"]) * METERS_PER_MILE;
if (typeof(query_vars["r4"]) != "undefined")
r4 = parseFloat(query_vars["r4"]) * METERS_PER_MILE;
if (typeof(query_vars["r5"]) != "undefined")
r5 = parseFloat(query_vars["r5"]) * METERS_PER_MILE;
if (typeof(query_vars["r6"]) != "undefined")
r6 = parseFloat(query_vars["r6"]) * METERS_PER_MILE;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("go_map"));
map.disableDragging();
alert(map);
geocoder = new GClientGeocoder();
showMap(zip);
}
}
if (geocoder) {
geocoder.getLatLng(
ZipCode,
function(point) {
if (!point) {
alert(zipCode + " not found");
} else {
var mapBounds = new GLatLngBounds();
mapBounds.extend(destPoint(0, r6, point));
mapBounds.extend(destPoint(60, r6, point));
mapBounds.extend(destPoint(120, r6, point));
mapBounds.extend(destPoint(180, r6, point));
mapBounds.extend(destPoint(240, r6, point));
mapBounds.extend(destPoint(300, r6, point));
mapBounds.extend(destPoint(360, r6, point));
map.setCenter(point, map.getBoundsZoomLevel(mapBounds));
map.addOverlay(new GMarker(point,icon_red));
drawFilledCircle(point, destPoint(360, r6, point), "#FF0000"); drawFilledCircle(point, destPoint(360, r5, point), "#ffd600"); drawFilledCircle(point, destPoint(360, r4, point), "#57ef15"); drawFilledCircle(point, destPoint(360, r3, point), "#0046ad"); drawFilledCircle(point, destPoint(360, r2, point), "#ffd600"); drawFilledCircle(point, destPoint(360, r1, point), "#ee0ba9");
drawCircle(point, destPoint(270, r6, point), "#FF0000"); drawCircle(point, destPoint(270, r5, point), "#ffd600"); drawCircle(point, destPoint(270, r4, point), "#57ef15");
drawCircle(point, destPoint(270, r3, point), "#0046ad"); drawCircle(point, destPoint(270, r2, point), "#ffd600"); drawCircle(point, destPoint(270, r1, point), "#ee0ba9"); } } ); } } function drawCircle(centerMarker, radiusMarker, color){ var normalProj = G_NORMAL_MAP.getProjection(); var zoom = map.getZoom(); var centerPt = normalProj.fromLatLngToPixel(centerMarker, zoom); var radiusPt = normalProj.fromLatLngToPixel(radiusMarker, zoom); var circlePoints = Array(); with (Math) { var radius = floor(sqrt(pow((centerPt.x-radiusPt.x),2) + pow((centerPt.y-radiusPt.y),2))); for (var a = 0 ; a < 361 ; a+=10 ) { var aRad = a*(PI/180); y = centerPt.y + radius * sin(aRad) x = centerPt.x + radius * cos(aRad) var p = new GPoint(x,y); circlePoints.push(normalProj.fromPixelToLatLng(p, zoom)); } map.addOverlay(new GPolyline(circlePoints, color, 1, 0.5)); } } function drawFilledCircle(centerMarker, radiusMarker, color){ var normalProj = G_NORMAL_MAP.getProjection(); var zoom = map.getZoom(); var centerPt = normalProj.fromLatLngToPixel(centerMarker, zoom); var radiusPt = normalProj.fromLatLngToPixel(radiusMarker, zoom);
var circlePoints = Array(); with (Math) { var radius = floor(sqrt(pow((centerPt.x-radiusPt.x),2) + pow((centerPt.y-radiusPt.y),2))); var thickness = min(255,radius); for (var n = 1 ; n < floor(2* radius / thickness)+1 ; n++ ) { radiusB = radius - (thickness / 2) * n; for (var a = 0 ; a < 361 ; a+=10 ) { var aRad = a*(PI/180); y = centerPt.y + radiusB * sin(aRad) x = centerPt.x + radiusB * cos(aRad) var p = new GPoint(x,y); circlePoints.push(normalProj.fromPixelToLatLng(p, zoom)); } var radOnEarth = (centerMarker.distanceFrom(radiusMarker)/1000).toFixed(3); map.addOverlay(new GPolyline(circlePoints, color, thickness, 0.15)); } } } function destPoint(brng, dist, p1) { var R = 6371000; var d = parseFloat(dist) / R; brng = (brng) * Math.PI / 180;
var latitude = Math.asin( Math.sin(p1.latRadians())*Math.cos(d) + Math.cos(p1.latRadians())*Math.sin(d)*Math.cos(brng) ); var longitude = p1.lngRadians() + Math.atan2(Math.sin(brng) * Math.sin(d) * Math.cos(p1.latRadians()), Math.cos(d) - Math.sin(p1.latRadians()) * Math.sin(latitude)); if (isNaN(latitude) || isNaN(longitude)) return null;
return new GLatLng(latitude * (180/Math.PI), longitude * (180/Math.PI)); }
function readQueryString (){
var URL = location.href;
var a_out = new Object();
var s_loc = String(URL);
if(s_loc.indexOf('?')>0) {
var p;
var s_query = s_loc.substr(s_loc.indexOf('?')+1);
var a_query = s_query ? s_query.split('&') : new Array();
for(var i=0; i<a_query.length; i++) {
p = a_query[i].split('=');
a_out[p[0]] = p[1].replace(/\+/g, ' ');
}
}
return a_out;
}
window.onload = load();