Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

geo-mashup custom WordPress

  • SOLVED

Hi Dylan or other geomashup users,

Have had successful map - customized based with custom markers using custom fields (and js) Not sure what happened - BUT presently the js doesn't appear to be loading. I know far too little to identify the problem which is probably as simple as poorly written js. Please help and thanks! Jenn

Wordpress V3.9.2
Geo Mashup v1.8.0
Geo Mashup Custom Plugin (latest)
Google Maps v3
JS and functions.php below

Current code, js
// JavaScript Document
GeoMashup.addAction( 'objectIcon', function( properties, object ) {
// Use a special icon in case the custom 'complete' var is set to 1
if ( object.my_complete == 1 ) {
object.icon.image = properties.template_url_path + '/member-icons/bank.png';
object.icon.iconSize = [ 32, 37 ];

} else if ( object.my_complete == 2 ) {
object.icon.image = properties.template_url_path + '/member-icons/barnard.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 3 ) {
object.icon.image = properties.template_url_path + '/member-icons/cathedral.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 4 ) {
object.icon.image = properties.template_url_path + '/member-icons/columbia.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 5 ) {
object.icon.image = properties.template_url_path + '/member-icons/corpus.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 6 ) {
object.icon.image = properties.template_url_path + '/member-icons/interchurch.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 7 ) {
object.icon.image = properties.template_url_path + '/member-icons/ihouse.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 8 ) {
object.icon.image = properties.template_url_path + '/member-icons/jts.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 9 ) {
object.icon.image = properties.template_url_path + '/member-icons/msm.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 10 ) {
object.icon.image = properties.template_url_path + '/member-icons/riverside.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 11 ) {
object.icon.image = properties.template_url_path + '/member-icons/sthildas.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 12 ) {
object.icon.image = properties.template_url_path + '/member-icons/stlukes.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 13 ) {
object.icon.image = properties.template_url_path + '/member-icons/teachers.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 14 ) {
object.icon.image = properties.template_url_path + '/member-icons/ulysses.png'; object.icon.iconSize = [ 32, 37 ];
}
else if ( object.my_complete == 15 ) {
object.icon.image = properties.template_url_path + '/member-icons/uts.png'; object.icon.iconSize = [ 32, 37 ];
}


else {
object.icon.image = properties.template_url_path + '/map-icons/low.png';
object.icon.iconSize = [ 35, 47 ];
}
} );
GeoMashup.addAction( 'loadedMap', function( properties, map ) {
var google_map = map.getMap();
var custom_styles = [
{
featureType: "all",
elementType: "all",
stylers: [
{ saturation: -97 }
]
},{
featureType: "administrative.locality",
elementType: "all",
stylers: [
{ visibility: "off" }
]
},{
featureType: "road.highway",
elementType: "all",
stylers: [
{ visibility: "on" },
{ hue: "#E39939" },
{ saturation: 70 },
{ lightness: 30 }
]
},{
featureType: "transit.station",
elementType: "all",
stylers: [
{ visibility: "on" },
{color: "#f30000"},
]
},{

featureType: "poi.park",
elementType: "geometry.fill",
stylers: [
{visibility:"on"},
{color: "#238300"},
{saturation:150},
{lightness:10},

]
},{

featureType: "water",
elementType: "geometry.fill",
stylers: [
{visibility:"on"},
{color: "#5794bf"},
{saturation:70},

]
},{
featureType: "poi",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
},{
featureType: "administrative.neighborhood",
elementType: "all",
stylers: [
{ visibility: "on" }
]
},{
featureType: "all",
elementType: "labels.text",
stylers: [
{ color: "#555555"},
{weight: "0.1"},
]
},{

featureType: "administrative.neighborhood",
elementType: "labels.text",
stylers: [
{ color: "#733e1d"},
{weight: "0.1"},
{visibility: "on" }
]
},{
featureType: "transit.station",
elementType: "labels.text",
stylers: [
{ visibility: "on" },
{color: "#f30000"},
{weight:"0.05"},
]
},{
featureType: "transit.station.bus",
elementType: "geometry",
stylers: [
{ visibility: "on" },
{color: "#f30000"},
{weight:"0.05"},
]
},{
featureType: "road.arterial",
elementType: "all",
stylers: [
{ saturation: 70 },
{ hue: "#E39939" },
{ lightness: 30 }
]
}
];
var map_type = new google.maps.StyledMapType( custom_styles, { name: 'rsf' } );
google_map.mapTypes.set( 'yellow', map_type );
google_map.setMapTypeId( 'yellow' );
} );
//Add support for Google Earth plug-in
mashup.map.addMapType(G_SATELLITE_3D_MAP);
mashup.map.addControl(new GHierarchicalMapTypeControl());
//Street View for MH
//if (GeoMashup.opts.load_svMH && confirm('Take a virtual street tour of Morningside Heights (Google Street View requires the Flash plugin)')) {
// var streetView = new GLatLng(40.697488,-73.979681);
//panoramaOptions = { latlng:streetView };
//var svMH = new GStreetviewPanorama(document.getElementById("geoMashup"), panoramaOptions);
//}



function my_geo_mashup_locations_json_filter( $json_properties, $queried_object ) {
$post_id = $queried_object->object_id;
$imagetype = get_post_meta( $post_id, 'imagetype', true);
if ( $imagetype == 'bank' ) {
$json_properties['my_complete'] = 1;
} else if ( $imagetype == 'barnard' ) {
$json_properties['my_complete'] = 2;
}
//etc.
else {
$json_properties[''];
}

return $json_properties;
}
add_filter( 'geo_mashup_locations_json_object','my_geo_mashup_locations_json_filter', 10, 2 );

Answers (1)

2014-08-12

Dylan Kuhn answers:

It would help if you can include a URL where I can see the map, but I can tell by looking that this code won't work:


mashup.map.addMapType(G_SATELLITE_3D_MAP);
mashup.map.addControl(new GHierarchicalMapTypeControl());


Google dropped support for the Earth plugin in the maps API. Try removing that first.


jennbeez comments:

Hi -

Removing those lines didn't address my custom marker issue

Here is the url
http://morningside-alliance.org/member-map/
uses wordpress code
[geo_mashup_map height="800" width="800" auto_info_open="false" map_post_type="members"]

also another use of geo mashup map
http://morningside-alliance.org/self-guided-tour-map/


Dylan Kuhn comments:

Thanks, that helps. Can you verify for me that the Geo Mashup Custom plugin is activated?


jennbeez comments:

Woops
OK It is now
It pulls one custom marker (else) but not for each per example above bank and barnard


Dylan Kuhn comments:

Your code appears to be working as far as I can see. Your filter is only setting two icons (just the ones you included in your snippet actually), and those are not being found. Make sure they're present in the theme folder that's being referenced:


GET http://morningside-alliance.org/site/wp-content/themes/reactor-maa/member-icons/bank.png 404 (Not Found)
GET http://morningside-alliance.org/site/wp-content/themes/reactor-maa/member-icons/barnard.png 404 (Not Found)


jennbeez comments:

Yep - there it is just a basic file naming mistake. A good opportunity though for me to contribute and thank you for your great and valuable work. Thanks! Jenn