hiI am able to text file in asp.net the text file have latitude and longitudeusing<script runat="server"> Sub WriteToFile(ByVal sender As System.Object, ByVal e As System.EventArgs) ''Put user code to initialize the page here ''Dim fp As StreamReader ''Dim mystr As String Dim mypoints() As String Try Dim readFile As System.IO.TextReader = New _ StreamReader("C:\vnr.txt") Dim mystr = readFile.ReadToEnd() mypoints = mystr.Split(";\n").ToArray readFile.Close() Catch err As Exception lblStatus.Text = "File Read failed. Reason is as follows <br><br>" & err.ToString() Finally End Try End Sub</script>from above code i want to read mypoints array to pts instead of assigning those values<script type="text/javascript"> //<![CDATA[ if (GBrowserIsCompatible()) { // Display the map, with some controls and set the initial location var map = new GMap(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(17.541536925025802,78.38722586631775),15); // create a polygon // var pts = [new GLatLng(17.541536925025802,78.38722586631775), new GLatLng(17.541148187221358,78.3871078491211), // new GLatLng(17.540636688840067,78.38702201843262), new GLatLng(17.540145649036166,78.38693618774414), // new GLatLng(17.53968529801197,78.38677525520325),new GLatLng(17.53921471575673,78.38651776313782), // new GLatLng(17.53835538848651,78.38580965995789),new GLatLng(17.53732214435186,78.38572382926941), // new GLatLng(17.536104750142222,78.38491916656494),new GLatLng(17.53733237452067,78.38338494300842), // new GLatLng(17.539265866061044,78.38428616523743),new GLatLng(17.54188474235469,78.38574528694153), //new GLatLng(17.541536925025802,78.38722586631775)]; var polygon = new GPolygon(pts, null, 5, 0.7, "#aaaaff", 0.5, {clickable:false} ); map.addOverlay(polygon); // === A method for testing if a point is inside a polygon // === Returns true if poly contains point // === Algorithm shamelessly stolen from http://alienryderflex.com/polygon/ GPolygon.prototype.Contains = function(point) { var j=0; var oddNodes = false; var x = point.lng(); var y = point.lat(); for (var i=0; i < this.getVertexCount(); i++) { j++; if (j == this.getVertexCount()) {j = 0;} if (((this.getVertex(i).lat() < y) && (this.getVertex(j).lat() >= y)) || ((this.getVertex(j).lat() < y) && (this.getVertex(i).lat() >= y))) { if ( this.getVertex(i).lng() + (y - this.getVertex(i).lat()) / (this.getVertex(j).lat()-this.getVertex(i).lat()) * (this.getVertex(j).lng() - this.getVertex(i).lng())<x ) { oddNodes = !oddNodes } } } return oddNodes; }if any one know this please help meThanks and RegardsN.L.Kalyani[edit]Code block added, "Ignore HTML..." option disabled - OriginalGriff[/edit] 解决方案 这篇关于从vb读取数组值到脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-22 21:41