public function testNoopTransformNewYork() { $LatLng = new LatLng(40.7127, -74.0059, 0, RefEll::grs80()); $LatLngTrans = clone $LatLng; $LatLngTrans->transformDatum(RefEll::grs80(), 0, 0, 0, 0, 0, 0, 0); $this->assertEquals($LatLng->getLat(), $LatLngTrans->getLat(), 'Latitude transform failed'); $this->assertEquals($LatLng->getLng(), $LatLngTrans->getLng(), 'Longitude transform failed'); }
/** * Convert a latitude, longitude height to x, y, z * Formula for transformation is taken from OS document * "A Guide to Coordinate Systems in Great Britain" * * @param LatLng $latLng * @return Cartesian */ public static function fromLatLong(LatLng $latLng) { $a = $latLng->getRefEll()->getMaj(); $eSquared = $latLng->getRefEll()->getEcc(); $phi = deg2rad($latLng->getLat()); $lambda = deg2rad($latLng->getLng()); $v = $a / sqrt(1 - $eSquared * pow(sin($phi), 2)); $x = ($v + $latLng->getH()) * cos($phi) * cos($lambda); $y = ($v + $latLng->getH()) * cos($phi) * sin($lambda); $z = ((1 - $eSquared) * $v + $latLng->getH()) * sin($phi); return new static($x, $y, $z, $latLng->getRefEll()); }
/** * Get the map javascript * * @return string */ function getMapJS() { $output = sprintf("var %s;\nfunction phpgooglemap_%s() {\n\nthis.initialize = function() {\n\n", $this->map_id, $this->map_id); $output .= "\tvar self = this;\n"; $output .= "\tthis.map_options = {\n"; $output .= sprintf("\t\tzoom: %s,\n", $this->zoom); if (!$this->scrollable) { $output .= "\t\tscrollwheel: false,\n"; } if (!$this->streetview) { $output .= "\t\tstreetViewControl: false,\n"; } if (!$this->draggable) { $output .= "\t\tdraggable: false,\n"; } $output .= sprintf("\t\tnavigationControl: %s,\n", $this->phpToJs($this->navigation_control)); $output .= sprintf("\t\tmapTypeControl: %s,\n", $this->phpToJs($this->map_type_control)); $output .= sprintf("\t\tscaleControl: %s,\n", $this->phpToJs($this->scale_control)); $output .= "\t\tnavigationControlOptions: {\n"; if ($this->navigation_control_style) { $output .= sprintf("\t\t\tstyle: google.maps.NavigationControlStyle.%s,\n", strtoupper($this->navigation_control_style)); } if ($this->navigation_control_position) { $output .= sprintf("\t\t\tposition: google.maps.ControlPosition.%s,\n", strtoupper($this->navigation_control_position)); } $output .= "\t\t},\n"; $output .= "\t\tmapTypeControlOptions: {\n"; if ($this->map_type_control_style) { $output .= sprintf("\t\t\tstyle: google.maps.MapTypeControlStyle.%s,\n", strtoupper($this->map_type_control_style)); } if ($this->map_type_control_position) { $output .= sprintf("\t\t\tposition: google.maps.ControlPosition.%s,\n", strtoupper($this->map_type_control_position)); } if (count($this->map_types)) { $map_types_string = ''; foreach ($this->map_types as $map_type) { if (isset($this->map_styles[$map_type])) { $map_types_string .= sprintf("'%s',", $this->map_styles[$map_type]->var_name); } else { $map_types_string .= sprintf("google.maps.MapTypeId.%s,", strtoupper($map_type)); } } $output .= sprintf("\t\t\tmapTypeIds: [%s],\n", rtrim($map_types_string, ',')); } $output .= "\t\t},\n"; $output .= "\t\tscaleControlOptions: {\n"; if ($this->scale_control_position) { $output .= sprintf("\t\t\tposition: google.maps.ControlPosition.%s,\n", strtoupper($this->scale_control_position)); } $output .= "\t\t},\n"; $output .= sprintf("\t\tmapTypeId: google.maps.MapTypeId.%s,\n", strtoupper($this->map_type)); $output .= "\t};\n\n"; $output .= sprintf("\tthis.map = new google.maps.Map(document.getElementById(\"%s\"), this.map_options);\n", $this->map_id); foreach ($this->map_styles as $map_style) { $output .= sprintf("\t%sMapStyle = %s;\n", $map_style->var_name, $map_style->style); $output .= sprintf("\t%sStyleOptions = { name: \"%s\"};\n", $map_style->var_name, $map_style->name); $output .= sprintf("\t%sMapType = new google.maps.StyledMapType(%sMapStyle, %sStyleOptions);\n", $map_style->var_name, $map_style->var_name, $map_style->var_name); $output .= sprintf("\tthis.map.mapTypes.set('%s', %sMapType);\n", $map_style->var_name, $map_style->var_name); } if (count($this->custom_controls)) { $output .= "\n\tthis.custom_controls = [];\n"; foreach ($this->custom_controls as $n => $custom_control) { $output .= sprintf("\tvar cc%s_outer = document.createElement('DIV');\n", $n); foreach ($custom_control->options['outer'] as $var => $val) { $output .= sprintf("\tcc%s_outer.%s = '%s';\n", $n, $var, $val); } $output .= sprintf("\tvar cc%s_inner = document.createElement('DIV');\n", $n); foreach ($custom_control->options['inner'] as $var => $val) { $output .= sprintf("\tcc%s_inner.%s = '%s';\n", $n, $var, $val); } $output .= sprintf("\tcc%s_outer.appendChild(cc%s_inner);\n", $n, $n); $output .= sprintf("\tvar cc%s_holder = document.createElement('DIV');\n", $n); $output .= sprintf("\tcc%s_holder.appendChild(cc%s_outer);\n", $n, $n); $output .= sprintf("\tthis.map.controls[google.maps.ControlPosition.%s].push(cc%s_holder);\n", $custom_control->position, $n); $output .= sprintf("\tthis.custom_controls[%s] = cc%s_holder;\n\n", $n, $n); foreach ($custom_control->listeners as $listener) { $output .= sprintf("\tgoogle.maps.event.addDomListener(cc%s_holder, '%s', %s);\n\n", $n, $listener['event'], $listener['function']); } } } if (count($this->shapes)) { $output .= sprintf("\n\tthis.shapes = [];\n", $this->map_id); foreach ($this->shapes as $n => $shape) { if ($shape->decoratee instanceof \PHPGoogleMaps\Overlay\Circle) { $output .= sprintf("\tthis.shapes[%s] = new google.maps.Circle( {\n", $n); $output .= sprintf("\t\tcenter: new google.maps.LatLng(%s,%s),\n", $shape->center->getLat(), $shape->center->getLng()); $output .= sprintf("\t\tradius: %s,\n", $shape->radius); } elseif ($shape->decoratee instanceof \PHPGoogleMaps\Overlay\Rectangle) { $output .= sprintf("\tthis.shapes[%s] = new google.maps.Rectangle( {\n", $n); $output .= sprintf("\t\tbounds: new google.maps.LatLngBounds(new google.maps.LatLng(%s,%s),new google.maps.LatLng(%s,%s)),\n", $shape->southwest->getLat(), $shape->southwest->getLng(), $shape->northeast->getLat(), $shape->northeast->getLng()); } foreach ($shape->getOptions() as $var => $val) { $output .= sprintf("\t\t%s: %s,\n", $var, $this->phpToJs($val)); } $output .= sprintf("\t\tmap: this.map\n"); $output .= "\t} );\n"; } } if (count($this->polys)) { $output .= sprintf("\n\tthis.polys = [];\n", $this->map_id); foreach ($this->polys as $n => $poly) { if ($poly->decoratee instanceof \PHPGoogleMaps\Overlay\Polygon) { $output .= sprintf("\tthis.polys[%s] = new google.maps.Polygon( {\n", $n); foreach ($poly->getOptions() as $var => $val) { $output .= sprintf("\t\t%s: %s,\n", $var, $this->phpToJs($val)); } $output .= sprintf("\t\tpaths: %s,\n", $this->parseLatLngs($this->phpToJs($poly->getPaths()))); $output .= sprintf("\t\tmap: this.map\n"); $output .= "\t} );\n"; } elseif ($poly->decoratee instanceof \PHPGoogleMaps\Overlay\Polyline) { $output .= sprintf("\tthis.polys[%s] = new google.maps.Polyline( {\n", $n); foreach ($poly->getOptions() as $var => $val) { $output .= sprintf("\t\t%s: %s,\n", $var, $this->phpToJs($val)); } $output .= sprintf("\t\tpath: %s,\n", $this->parseLatLngs($this->phpToJs($poly->getPaths()))); $output .= sprintf("\t\tmap: this.map\n"); $output .= "\t} );\n"; } } } if ($this->directions) { $output .= "\tthis.directions = {};\n"; $renderer_options = "\tthis.directions.renderer_options = {\n"; foreach ($this->directions->renderer_options as $renderer_option => $renderer_value) { switch ($renderer_option) { case 'panel': $renderer_options .= sprintf("\t\tpanel: document.getElementById(\"%s\"),\n", $renderer_value); break; default: $renderer_options .= sprintf("\t\t%s:%s,\n", $renderer_option, $this->phpToJs($renderer_value)); } } $renderer_options .= "\t};\n\n"; $output .= $renderer_options; $output .= "\tthis.directions.renderer = new google.maps.DirectionsRenderer(this.directions.renderer_options);\n\tthis.directions.service = new google.maps.DirectionsService();\n"; $output .= "\tthis.directions.renderer.setMap(this.map);\n\n"; $request_options = sprintf("\tthis.directions.request_options = {\n", $this->map_id); if (isset($this->units) && !isset($this->directions->request_options['units'])) { $this->directions->request_options['units'] = $this->units; } foreach ($this->directions->request_options as $request_option => $request_value) { switch ($request_option) { case 'waypoints': $request_options .= sprintf("\t\twaypoints: %s,\n", $this->parseLatLngs($this->phptoJs($request_value))); break; case 'origin': $request_options .= sprintf("\t\torigin: new google.maps.LatLng(%s,%s),\n", $this->directions->request_options['origin']->getLat(), $this->directions->request_options['origin']->getLng()); break; case 'destination': $request_options .= sprintf("\t\tdestination: new google.maps.LatLng(%s,%s),\n", $this->directions->request_options['destination']->getLat(), $this->directions->request_options['destination']->getLng()); break; case 'travelMode': $request_options .= sprintf("\t\ttravelMode: google.maps.DirectionsTravelMode.%s,\n", strtoupper($this->directions->request_options['travelMode'])); break; case 'units': $request_options .= sprintf("\t\tunitSystem: google.maps.DirectionsUnitSystem.%s,\n", isset($this->directions->request_options['units']) ?: $this->units); break; default: $request_options .= sprintf("\t\t%s:%s,\n", $request_option, $this->phpToJs($request_value)); } } $request_options .= "\t};\n"; $output .= $request_options; $output .= "\t\n\tthis.directions.service.route(this.directions.request_options, function(response,status) {\n\t\tif (status == google.maps.DirectionsStatus.OK) {\n\t\t\tself.directions.success = response;\n\t\t\tself.directions.renderer.setDirections(response);\n\t\t}\n\t\telse {\n\t\t\tself.directions.error = status;\n\t\t}\n\t});\n\n"; } if (count($this->marker_shapes)) { $output .= sprintf("\n\tthis.marker_shapes = [];\n", $this->map_id); foreach ($this->marker_shapes as $marker_shape) { $output .= sprintf("\tthis.marker_shapes[%s] = {\n", $marker_shape->id); $output .= sprintf("\t\ttype: \"%s\",\n", $marker_shape->type); $output .= sprintf("\t\tcoord: [%s]\n", implode(",", $marker_shape->coords)); $output .= "\t};\n"; } } $this->extractMarkerData(); if (count($this->marker_icons)) { $output .= sprintf("\n\tthis.marker_icons = [];\n", $this->map_id); foreach ($this->marker_icons as $marker_icon_id => $marker_icon) { $output .= sprintf("\tthis.marker_icons[%s] = new google.maps.MarkerImage(\n\t\t\"%s\",\n", $marker_icon_id, $marker_icon->icon); $output .= sprintf("\t\tnew google.maps.Size(%s, %s),\n", $marker_icon->width, $marker_icon->height); $output .= sprintf("\t\tnew google.maps.Point(%s, %s),\n", (int) $marker_icon->origin_x, (int) $marker_icon->origin_y); $output .= sprintf("\t\tnew google.maps.Point(%s, %s)\n", (int) $marker_icon->anchor_x, (int) $marker_icon->anchor_y); $output .= "\t);\n"; } } if (count($this->markers) && $this->auto_encompass) { $output .= "\n\tthis.bounds = new google.maps.LatLngBounds();\n"; } if ($this->info_windows) { $output .= "\tthis.info_window = new google.maps.InfoWindow();\n"; } if (count($this->marker_shapes)) { $output .= sprintf("\n\tthis.marker_shapes = [];\n", $this->map_id); foreach ($this->marker_shapes as $shape_id => $marker_shape) { $output .= sprintf("\tthis.marker_shapes[%s] = {\n", $shape_id); $output .= sprintf("\t\ttype: \"%s\",\n", $marker_shape->type); $output .= sprintf("\t\tcoord: [%s]\n", implode(",", $marker_shape->coords)); $output .= "\t};\n"; } } if (count($this->marker_groups)) { $output .= "\n\tthis.marker_groups = [];\n"; $output .= "\tthis.marker_group_function = function( group_name, f_all, f_group ) {\n\t\tfor (i in map.markers) {\n\t\t\tvar marker = map.markers[i];\n\t\t\tf_all(marker);\n\t\t}\n\t\tfor (i in map.marker_groups[group_name].markers) {\n\t\t\tvar marker = map.markers[map.marker_groups[group_name].markers[i]];\n\t\t\tf_group(marker);\n\t\t}\n\t};\n"; foreach ($this->marker_groups as $marker_group_var => $marker_group) { $output .= sprintf("\tthis.marker_groups[\"%s\"] = {name: \"%s\", markers:[%s]};\n", $marker_group_var, $marker_group['name'], implode(',', $marker_group['markers'])); } } if (count($this->markers)) { $output .= "\n\tthis.markers = [];\n"; } foreach ($this->getMarkers() as $marker_id => $marker) { if ($marker->isGeolocated()) { if (!$this->geolocation) { $this->enableGeolocation($marker->geolocation_timeout, $marker->geolocation_high_accuracy); } $output .= "\tif ( navigator.geolocation && typeof geolocation != 'undefined' ) {\n"; } if ($this->stagger_markers) { $output .= sprintf("\tthis.markers[%s] = {\n", $marker_id); } else { $output .= sprintf("\tthis.markers[%s] = new google.maps.Marker({\n", $marker_id); } if ($marker->geolocation) { $output .= "\t\tposition: geolocation,\n"; } else { $output .= sprintf("\t\tposition: new google.maps.LatLng(%s,%s),\n", $marker->position->getLat(), $marker->position->getLng()); } if (!$this->clustering_js) { $output .= "\t\tmap: this.map,\n"; } if (is_int($marker->_icon_id)) { $output .= sprintf("\t\ticon:this.marker_icons[%s],\n", $marker->_icon_id); } if (is_int($marker->_shadow_id)) { $output .= sprintf("\t\tshadow:this.marker_icons[%s],\n", $marker->_shadow_id); } if (is_int($marker->_shape_id)) { $output .= sprintf("\t\tshape:this.marker_shapes[%s],\n", $marker->_shape_id); } if (count($marker->groups)) { $gs = $this->marker_groups; $output .= sprintf("\t\tgroups:[%s],\n", implode(',', array_map(function ($g) use($gs) { return $gs[$g->var_name]['id']; }, $marker->groups))); } if ($marker->animation) { $output .= sprintf("\t\tanimation: google.maps.Animation.%s,\n", strtoupper($marker->animation)); $marker->removeOption('animation'); } foreach ($marker->getOptions() as $marker_option => $marker_value) { $output .= sprintf("\t\t%s:%s,\n", $marker_option, $this->phpToJs($marker_value)); } $output .= sprintf("\t}%s;\n", $this->stagger_markers ? '' : ')'); if ($this->info_windows) { if (isset($marker->content)) { $output .= sprintf("\tgoogle.maps.event.addListener(this.markers[%s], 'click', function() { if ( !self.markers[%s].getVisible() ) return; self.info_window.setContent(self.markers[%s].content);self.info_window.open(self.map,self.markers[%s]); });\n", $marker_id, $marker_id, $marker_id, $marker_id); } } if ($this->auto_encompass & !isset($marker->location)) { $output .= sprintf("\tthis.bounds.extend(this.markers[%s].position);\n", $marker_id); $output .= "\tthis.map.fitBounds(this.bounds);\n"; } if ($marker->geolocation) { $output .= "\t}\n\n"; } } if ($this->clustering_js) { $output .= sprintf("\n\tvar markerCluster = new MarkerClusterer(this.map, this.markers, %s);\n", $this->phpToJs($this->clustering_options)); } if (count($this->ground_overlays)) { $output .= "\tthis.ground_overlays = [];\n"; foreach ($this->ground_overlays as $n => $ground_overlay) { $output .= sprintf("\tthis.ground_overlays[%s] = new google.maps.GroundOverlay('%s', new google.maps.LatLngBounds(new google.maps.LatLng(%s,%s),new google.maps.LatLng(%s,%s)), %s);\n\tthis.ground_overlays[%s].setMap(this.map);\n\n", $n, $ground_overlay->url, $ground_overlay->southwest->getLat(), $ground_overlay->southwest->getLng(), $ground_overlay->northeast->getLat(), $ground_overlay->northeast->getLng(), $this->phpToJs($ground_overlay->options), $n); } } if (count($this->kml_layers)) { $output .= "\tthis.kml_layers = [];\n"; foreach ($this->kml_layers as $n => $kml_layer) { $output .= sprintf("\tthis.kml_layers[%s] = new google.maps.KmlLayer('%s', %s);\n\tthis.kml_layers[%s].setMap(this.map);\n\n", $n, $kml_layer->url, $this->phpToJs($kml_layer->options), $n); } } if (count($this->panoramio_layers)) { $output .= "\tthis.panoramio_layers = [];\n"; foreach ($this->panoramio_layers as $n => $panoramio_layer) { $output .= sprintf("\tthis.panoramio_layers[%s] = new google.maps.panoramio.PanoramioLayer();\n\tthis.panoramio_layers[%s].setMap(this.map);\n", $n, $n); if ($p_tag = $panoramio_layer->getOption('tag')) { $output .= sprintf("\tthis.panoramio_layers[%s].setTag('%s');\n", $n, $p_tag); } if ($p_user_id = $panoramio_layer->getOption('user_id')) { $output .= sprintf("\tthis.panoramio_layers[%s].setUserId('%s');\n", $n, $p_user_id); } $output .= "\n"; } } if (count($this->fusion_tables)) { $output .= "\tthis.fusion_tables = [];\n"; foreach ($this->fusion_tables as $n => $fusion_table) { $ft_options = ''; foreach ($fusion_table->getOptions() as $var => $val) { if ($var == 'query') { $val = $this->switchQuotes($val); } $ft_options .= sprintf("\t\t%s: %s,\n", $this->phpToJs($var), $this->phpToJs($val)); } $output .= sprintf("\tthis.fusion_tables[%s] = new google.maps.FusionTablesLayer(%s, {\n%s\t});\n\tthis.fusion_tables[%s].setMap(this.map);\n\n", $n, $fusion_table->table_id, $ft_options, $n); } } if (count($this->binds)) { foreach ($this->binds as $bind) { $output .= sprintf("\t%s.bindTo('%s', %s, '%s');\n", $bind['bindee']->getJsVar(), $bind['bindee_property'], $bind['binder']->getJsVar(), $bind['binder_property']); } } if ($this->adsense) { $output .= sprintf("\tadsense_options = {\n\t\tformat: google.maps.adsense.AdFormat.%s,\n\t\tposition: google.maps.ControlPosition.%s,\n\t\tmap: this.map,\n\t\tvisible: %s,\n\t\tpublisherId: '%s'\n\t}\n\tad_unit = new google.maps.adsense.AdUnit(document.createElement('div'), adsense_options);\n\n", strtoupper($this->adsense_format), strtoupper($this->adsense_position), $this->phpToJs($this->adsense_visible), $this->adsense_publisher_id); } if ($this->traffic_layer) { $output .= "\tthis.traffic_layer = new google.maps.TrafficLayer();\n\tthis.traffic_layer.setMap(this.map);\n\n"; } if ($this->bicycle_layer) { $output .= "\tthis.bicycle_layer = new google.maps.BicyclingLayer();\n\tthis.bicycle_layer.setMap(this.map);\n\n"; } if ($this->center_on_user) { if ($this->geolocation_backup) { $output .= "\tif ( typeof geolocation != 'undefined' ) {\n"; } $output .= "\t\tthis.map.setCenter( geolocation );\n"; if ($this->geolocation_backup) { $output .= sprintf("\t}\n\telse {\n\t\tthis.map.setCenter( new google.maps.LatLng(%s,%s) );\n\t}\n\n", $this->geolocation_backup->getLat(), $this->geolocation_backup->getLng()); } } if ($this->center) { $output .= sprintf("\tthis.map.setCenter( new google.maps.LatLng(%s,%s) );\n", $this->center->getLat(), $this->center->getLng()); } if (count($this->event_listeners)) { $output .= "\tthis.event_listeners = [];\n"; foreach ($this->event_listeners as $n => $event_listener) { $event_class = get_class($event_listener->decoratee); $output .= sprintf("\tthis.event_listeners[%s] = google.maps.event.add%sListener%s(%s, '%s', %s);\n", $n, $event_class == 'PHPGoogleMaps\\Event\\DomEventListener' ? 'Dom' : '', $event_listener->once ? 'Once' : '', $event_listener->object instanceof \PHPGoogleMaps\Core\MapObjectDecorator || $event_listener->object instanceof \PHPGoogleMaps\Map ? $event_listener->object : sprintf('document.getElementById("%s")', $event_listener->object), $event_listener->event, $event_listener->function); } } if ($this->streetview) { $streetview_options = ''; if (isset($this->streetview->options)) { foreach ($this->streetview->options as $streetview_option => $streetview_value) { switch ($streetview_option) { case 'container': break; default: $streetview_options .= sprintf("\t\t%s:%s,\n", $streetview_option, $this->parseLatLngs($this->phpToJs($streetview_value))); } } } $output .= sprintf("\tthis.streetview = new google.maps.StreetViewPanorama(document.getElementById(\"%s\"), {\n%s\t});\n\tthis.map.setStreetView(this.streetview);\n", $this->streetview->container, $streetview_options); } $output .= sprintf("\n};\n\n}\nfunction initialize_%s() {\n\t%s = new phpgooglemap_%s();\n\t%s.initialize();\n\n%s\n\n}\n\n", $this->map_id, $this->map_id, $this->map_id, $this->map_id, $this->mobile_iphone_fullscreen ? 'setTimeout(function() { window.scrollTo(0, 1) }, 100);' : ''); if ($this->geolocation) { $output .= "function get_geolocation() {\n"; $output .= sprintf("\tnavigator.geolocation.getCurrentPosition( geolocation_success_init, geolocation_error_init, {enableHighAccuracy: %s, timeout: %s} );\n", $this->geolocation_high_accuracy ? 'true' : 'false', $this->geolocation_timeout); $output .= "}\n"; $output .= "function geolocation_success_init( position ) {\n"; $output .= sprintf("\tgeolocation_status=1;\n\tgeolocation_lat = position.coords.latitude;\n\tgeolocation_lng = position.coords.longitude;\n\tgeolocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);%s\n\tinitialize_%s();\n}\n", $this->geolocation_success_callback ? "\n\t" . $this->geolocation_success_callback . "();" : '', $this->map_id); $output .= sprintf("function geolocation_error_init( error ){\n\tgeolocation_status=0;\n\tgeolocation_error = error.code;%s\n\tinitialize_%s();\n}\n", $this->geolocation_fail_callback ? "\n\t" . $this->geolocation_fail_callback . "();" : '', $this->map_id); $output .= "if ( navigator.geolocation ) {\n"; $output .= "\tgoogle.maps.event.addDomListener(window, \"load\", get_geolocation );\n"; $output .= "}\nelse {\n"; $output .= sprintf("\tgeolocation_status = 0;\n\tgeolocation_error = -1;\n\tgoogle.maps.event.addDomListener(window, \"load\", initialize_%s );\n}\n\n", $this->map_id, $this->map_id); } else { $output .= sprintf("google.maps.event.addDomListener(window, \"load\", initialize_%s );\n\n", $this->map_id, $this->map_id); } if ($this->compress_output) { $output = preg_replace('~\\n|\\t~', '', $output); $output = preg_replace('~\\s*([:=\\(\\)\\{\\},])\\s*~', "\$1", $output); } $output = preg_replace('~,(\\s*[\\}|\\)])~', '$1', $output); return sprintf("\n<script type=\"text/javascript\">\n\n%s\n\n</script>", $output); }
/** * Get lng * * @return float */ public function getLng() { return $this->latLng->getLng(); }