@@ -416,14 +416,23 @@ $.fn.storeLocator = function(options) {
416416 else if ( settings . dataType === 'kml' ) {
417417 //Process KML
418418 $ ( data ) . find ( 'Placemark' ) . each ( function ( ) {
419- var locationData = {
420- 'name' : $ ( this ) . find ( 'name' ) . text ( ) ,
421- 'lat' : $ ( this ) . find ( 'coordinates' ) . text ( ) . split ( "," ) [ 1 ] ,
422- 'lng' : $ ( this ) . find ( 'coordinates' ) . text ( ) . split ( "," ) [ 0 ] ,
423- 'description' : $ ( this ) . find ( 'description' ) . text ( )
419+ var $placemark = $ ( this ) , locationData = {
420+ 'name' : $placemark . find ( 'name' ) . text ( ) ,
421+ 'lat' : $placemark . find ( 'coordinates' ) . text ( ) . split ( "," ) [ 1 ] ,
422+ 'lng' : $placemark . find ( 'coordinates' ) . text ( ) . split ( "," ) [ 0 ] ,
423+ // Promote setting a locdescription key for a singular description to use in templates instead, as some KML generators (like Google Maps Engine) populates the generic description including all key: values set.
424+ 'description' : $placemark . find ( 'description' ) . text ( )
424425 } ;
426+
427+ $placemark . find ( 'displayName' ) . each ( function ( ) {
428+ var thisDataKey = $ ( this ) . text ( ) ,
429+ thisDataVal = $ ( this ) . next ( ) . text ( ) ;
430+ locationData [ thisDataKey ] = thisDataVal ;
431+ } ) ;
432+
433+ if ( locationData [ 'web' ] ) locationData [ 'web' ] = locationData [ 'web' ] . replace ( "http://" , "" ) ; // Remove scheme (todo: should NOT be done)
425434
426- locationData [ 'distance' ] = GeoCodeCalc . CalcDistance ( orig_lat , orig_lng , locationData [ 'lat' ] , locationData [ 'lng' ] , GeoCodeCalc . EarthRadius ) ;
435+ locationData [ 'distance' ] = GeoCodeCalc . CalcDistance ( orig_lat , orig_lng , locationData [ 'lat' ] , locationData [ 'lng' ] , GeoCodeCalc . EarthRadius ) ;
427436
428437 //Create the array
429438 if ( settings . maxDistance === true && firstRun !== true ) {
@@ -659,7 +668,7 @@ $.fn.storeLocator = function(options) {
659668 }
660669
661670 //Add origin marker if the setting is set
662- if ( settings . originMarker === true && settings . fullMapStart === false ) {
671+ if ( firstRun !== true && settings . originMarker === true ) {
663672 var originPinShadow = new google . maps . MarkerImage ( "http://chart.apis.google.com/chart?chst=d_map_pin_shadow" ,
664673 new google . maps . Size ( 40 , 37 ) ,
665674 new google . maps . Point ( 0 , 0 ) ,
@@ -672,6 +681,9 @@ $.fn.storeLocator = function(options) {
672681 shadow : originPinShadow ,
673682 draggable : false
674683 } ) ;
684+ if ( settings . zoomLevel === 0 ) {
685+ bounds . extend ( originPoint ) ;
686+ }
675687 }
676688
677689 //Add markers and infowindows loop
@@ -813,4 +825,4 @@ $.fn.storeLocator = function(options) {
813825
814826 } ) ;
815827} ;
816- } ) ( jQuery ) ;
828+ } ) ( jQuery ) ;
0 commit comments