私はhttp://www.gfmap.comにウェブサイトを持っており、グルテンフリーのレストラン、ショップ、ベーカリーなどを表示しています。20,000 を超えるアイテムを備えた Fusion Table から運営されています。
カテゴリ(レストランなど)に基づいて Google マップのアイコンの色を変更できるかどうかを知りたい
これがコードです...
<script type="text/javascript">
var initialLocation;
var companyLocale = new google.maps.LatLng(-33.869629, 151.206955);
var localArray = [companyLocale];
var noGeo = new google.maps.LatLng(51.506325, -0.127144);
var map;
var layerl0;
function initialize() {
map = new google.maps.Map(document.getElementById('themap'),
{
zoom: 12
});
if(navigator.geolocation) {
browserSupportFlag = true;
navigator.geolocation.getCurrentPosition(function(position) {
initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
map.setCenter(initialLocation);
}, function() {
handleNoGeolocation(browserSupportFlag);
});
}else {
handleNoGeolocation();
}
function handleNoGeolocation() {
initialLocation = noGeo;
localArray.unshift(initialLocation);
map.setCenter(initialLocation);
}
var style = [
{
featureType: 'administrative.land_parcel',
elementType: 'all',
stylers: [
{ visibility: 'off' }
]
}
];
var styledMapType = new google.maps.StyledMapType(style, {
map: map,
name: 'Styled Map'
});
map.mapTypes.set('map-style', styledMapType);
map.setMapTypeId('map-style');
layerl0 = new google.maps.FusionTablesLayer({
query: {
select: "'location'",
from: 4015038
},
map: map
});
}
function changeMapl0() {
var searchString = document.getElementById('search-string-l0').value.replace(/'/g, "\\'");
layerl0.setOptions({
query: {
select: "'location'",
from: 4015038,
where: "'Type' = '" + searchString + "'"
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
function ga() {
var address = document.getElementById('q').value;
if (address != ''){
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address + ' AU'}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
if (results[0].geometry.location_type == google.maps.GeocoderLocationType.APPROXIMATE){
map.setZoom(12);
} else {map.setZoom(12);}
}
else {alert("Sorry, we can't find that place using Google.");}
});
}
}
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-31494612-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
答えはこの投稿Custom Google Map Icon If Value >=1に関連していると思いますが、うまくいきません。私は JavaScript を知りませんが、この Web サイトをできる限り一緒にハッキングしました。
どんな助けでも感謝します。
ありがとう
マット