- Posts: 2
- Thank you received: 0
customMapType1 is not defined - Admin side
- anphonic
- Topic Author
- Offline
- New Member
Less
More
11 years 5 months ago #2313
by anphonic
customMapType1 is not defined - Admin side was created by anphonic
Good morning,
I was setting up placemarks on a production site and it was working fine, but then after adding another Placemark Group I began getting this error in the dev console of Chrome
This is the entire codeblock and line is
. I reset everything back to how I had it when it was working, added my google maps API key, and made sure that I had it set to use the Roadmap still but am still receiving this error. This occurs on any tab where the map is displayed but the map and placemarks work correctly on the front of the site.
lcem.anphonic.com/storm-shelters/storm-shelter-locations
Thanks in advance!
I was setting up placemarks on a production site and it was working fine, but then after adding another Placemark Group I began getting this error in the dev console of Chrome
Code:
Uncaught ReferenceError: customMapType1 is not defined index.php:3405
This is the entire codeblock and line is
Code:
map.mapTypes.set('customMapType1', customMapType1);
Thanks in advance!
Code:
<script type="text/javascript" >//<![CDATA[
var initialLocation;
var spblocation;
var browserSupportFlag = new Boolean();
var map;
var infowindow;
var marker;
var geocoder;
var inputPlacesAC;
function initialize() {
infowindow = new google.maps.InfoWindow();
geocoder = new google.maps.Geocoder();
spblocation = new google.maps.LatLng(59.9388, 30.3158);
var myOptions = {
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP,
panControl: true,
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.DEFAULT
},
mapTypeControl: true,
mapTypeControlOptions: {
mapTypeIds: [
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.TERRAIN,
google.maps.MapTypeId.SATELLITE,
google.maps.MapTypeId.HYBRID
,'osm'
,'customMapType1'
]
},
scaleControl: false,
streetViewControl: false,
rotateControl: false,
overviewMapControl: true
};
var openStreetType = new google.maps.ImageMapType({
getTileUrl: function(ll, z) {
var X = ll.x % (1 << z); // wrap
return "http://tile.openstreetmap.org/" + z + "/" + X + "/" + ll.y + ".png";
},
tileSize: new google.maps.Size(256, 256),
isPng: true,
maxZoom: 18,
name: "OSM",
alt: "OpenStreetMap Layer"
});
map = new google.maps.Map(document.getElementById("GMapsID"), myOptions);
map.mapTypes.set('osm', openStreetType);
map.mapTypes.set('customMapType1', customMapType1);
initialLocation = new google.maps.LatLng(35.353132, -94.43468999999999);
map.setCenter(initialLocation);
marker = new google.maps.Marker({
position: initialLocation,
draggable:true,
map: map,
animation: google.maps.Animation.DROP,
title:"First Baptist Church"
});
google.maps.event.addListener(marker, 'drag', function(event) {
document.forms.adminForm.jform_longitude.value = event.latLng.lng();
document.forms.adminForm.jform_latitude.value = event.latLng.lat();
});
google.maps.event.addListener(map, 'click', function(event) {
marker.setPosition(event.latLng);
document.forms.adminForm.jform_longitude.value = event.latLng.lng();
document.forms.adminForm.jform_latitude.value = event.latLng.lat();
});
inputPlacesAC = document.getElementById('searchTextField');
var autocompletePlaces = new google.maps.places.Autocomplete(inputPlacesAC);
autocompletePlaces.bindTo('bounds', map);
google.maps.event.addListener(autocompletePlaces, 'place_changed', function() {
var place = autocompletePlaces.getPlace();
var markerPlacesACText = place.name;
if (place.geometry.viewport)
{
map.fitBounds(place.geometry.viewport);
}
else
{
map.setCenter(place.geometry.location);
map.setZoom(17);
}
marker.setPosition(place.geometry.location);
marker.setTitle(markerPlacesACText);
marker.setMap(map);
document.forms.adminForm.jform_longitude.value = place.geometry.location.lng();
document.forms.adminForm.jform_latitude.value = place.geometry.location.lat();
});
};
function loadScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places&callback=initialize";
document.body.appendChild(script);
};
function handleNoGeolocation(errorFlag) {
if (errorFlag == true) {
initialLocation = spblocation;
} else {
initialLocation = spblocation;
}
map.setCenter(initialLocation);
marker.setPosition(initialLocation);
};
function Do_Find() { geocoder.geocode( { 'address': inputPlacesAC.value}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latlngFind = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng());
map.setCenter(latlngFind);
map.setZoom(17);
marker.setPosition(latlngFind);
marker.setTitle(inputPlacesAC.value);
marker.setMap(map);
document.forms.adminForm.jform_longitude.value = latlngFind.lng();
document.forms.adminForm.jform_latitude.value = latlngFind.lat();
}
else
{
alert("Geocode was not successful for the following reason: " + status + "\n" + "for address: "+inputPlacesAC.value);
}
});
};
window.onload = loadScript;
//]]></script>
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
11 years 5 months ago #2314
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic customMapType1 is not defined - Admin side
Hi.
You configure map to show your custom map type, and set it for map by default.
But I think you are not create definition for your custom map type. Go to Map Types tab and check it
You configure map to show your custom map type, and set it for map by default.
But I think you are not create definition for your custom map type. Go to Map Types tab and check it
Don't forget support my developments: post review in JED , donate , help with translation
The following user(s) said Thank You: anphonic
Please Log in or Create an account to join the conversation.
- anphonic
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
11 years 5 months ago #2317
by anphonic
Replied by anphonic on topic customMapType1 is not defined - Admin side
For whatever reason it was working initially but quit.
I disabled the custom map type that I had created and it started working again.
Thanks
I disabled the custom map type that I had created and it started working again.
Thanks
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
11 years 5 months ago #2318
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic customMapType1 is not defined - Admin side
I think it was not working initially. I think you are not set value "Allow Custom Map Types" to Yes.
Because if you set it to No (by default), I ignore all other fields
* Custom Map Types List
* Map Type = First Custom Map Type
But you set it to yes, and set Map Type to "First Custom Map Type"
In this case I populate map type list and try to set default map type to your custom map type
And I don't check correct data entering when I display map, because it is time consuming - to check correct data reference. And I want - show map as quick as possible.
Because if you set it to No (by default), I ignore all other fields
* Custom Map Types List
* Map Type = First Custom Map Type
But you set it to yes, and set Map Type to "First Custom Map Type"
In this case I populate map type list and try to set default map type to your custom map type
And I don't check correct data entering when I display map, because it is time consuming - to check correct data reference. And I want - show map as quick as possible.
Don't forget support my developments: post review in JED , donate , help with translation
Please Log in or Create an account to join the conversation.
Time to create page: 0.187 seconds