Pmapper5 (or 4.x) and streetview

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Pmapper5 (or 4.x) and streetview

This post was updated on .
In pmapper5 if you modify PM.Control.PMToolClick.js in the bottom of its part in this way:

  onClick: function(e) {
        var fromProjection = new OpenLayers.Projection("EPSG:900913");   // Transform from Spherical Mercator Projection WGS 1984
        var toProjection   = new OpenLayers.Projection("EPSG:4326"); // to WGS 1984
        var xyMap = map.getLonLatFromViewPortPx(e.xy);
        var mouseXY = (xyMap.lon) + ',' + (xyMap.lat);
                var position = new OpenLayers.LonLat(xyMap.lon,xyMap.lat).transform( fromProjection, toProjection);


window.open("http://yoursite.it/street.php?lat="+position.lat+"&lon="+position.lon+"","_blank","toolbar=yes, scrollbars=yes, resizable=yes, top=200, left=200, width=810, height=310");

    execute: function(mouseXY) {
    CLASS_NAME: "OpenLayers.Control.PMToolClick"

the code gets the coordinate by clicking on your map and open "street.php" which is a google streetview api (https://developers.google.com/maps/documentation/javascript/examples/streetview-service) in the position where you clicked

modify google api (that I called street.php) in its top part in this way:

 $x= $_GET['lon'];
  $y= $_GET['lat'];


  <!DOCTYPE html>
    <meta charset="utf-8">
    <title>Street View service</title>
    <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } </style>    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>    <script>
function initialize() {
  var fenway = new google.maps.LatLng(<?php echo $y ?>,<?php echo $x ?>);