从WebGIS应用程序在mysql中存储图像

时间:2013-10-25 13:04:25

标签: java php html mysql gis

我在编写代码方面非常业余。我想创建一个应用程序来存储LNG,lat和其他数据,以及mysql中的图像。我已经设置好了,我创建了一个单独的应用程序,用于通过WebGIS应用程序存储图像和数据存储。现在我不知道如何整合这两个应用程序。

如果有人可以帮助我,请展示如何整合此代码:

<form enctype="multipart/form-data" action="add.php" method="POST"> 
Photo: <input type="file" name="photo"><br> 
<input type="submit" value="Add"> 
</form>

<!DOCTYPE html >
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Map Simple</title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<link rel="stylesheet" href="/ol/theme/default/style.css" type="text/css">
<link rel="stylesheet" href="/ol/theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="/ol/OpenLayers.js"></script>



<script type="text/javascript">




var marker;
var infowindow;

var customIcons = {
  restaurant: {
    icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png',
    shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
  },
  bar: {
    icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png',
    shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'
  }
};


function initialize() {


  var latlng = new google.maps.LatLng(45.0000, 17.5000);
  var options = {
    zoom: 10,
    center: latlng,
    mapTypeId: google.maps.MapTypeId.SATELLITE
  }
  var map = new google.maps.Map(document.getElementById("map-canvas"), options);
  var html = "<table>" +
             "<tr><td>Name:</td> <td><input type='text' id='name'/> </td> </tr>" +
             "<tr><td>Address:</td> <td><input type='text' id='address'/></td> </tr>" +
             "<tr><td>Type:</td> <td><select id='type'>" +
             "<option value='bar' SELECTED>bar</option>" +
             "<option value='restaurant'>restaurant</option>" +
             "</select> </td></tr>" +
             "<tr><td></td><td><input type='button' value='Save & Close onclick='saveData()'/></td></tr>";
infowindow = new google.maps.InfoWindow({
 content: html
});

google.maps.event.addListener(map, "click", function(event) {
    marker = new google.maps.Marker({
      position: event.latLng,
      map: map
    });
    google.maps.event.addListener(marker, "click", function() {
      infowindow.open(map, marker);
    });
});

}


function saveData() {
  var name = escape(document.getElementById("name").value);
  var address = escape(document.getElementById("address").value);
  var type = document.getElementById("type").value;
  var latlng = marker.getPosition();

  var url = "phpsqlinfo_addrow.php?name=" + name + "&address=" + address +
            "&type=" + type + "&lat=" + latlng.lat() + "&lng=" + latlng.lng();
  downloadUrl(url, function(data, responseCode) {
    if (responseCode == 200 && data.length <= 1) {
      infowindow.close();
      document.getElementById("message").innerHTML = "Location added.";
    }
  });

}

function downloadUrl(url, callback) {
  var request = window.ActiveXObject ?
      new ActiveXObject('Microsoft.XMLHTTP') :
      new XMLHttpRequest;

  request.onreadystatechange = function() {
    if (request.readyState == 4) {
      request.onreadystatechange = doNothing;
      callback(request.responseText, request.status);
    }
  };

  request.open('GET', url, true);
  request.send(null);
}

function doNothing() {}




</script>
</head>

<body style="margin:10px; padding:10px;" onload="initialize()">
<div id="map-canvas" style="width: 100%; height: 800px"></div>
<div id="message"></div>
</body>

</html>

感谢

0 个答案:

没有答案