I am working on a project and every half of my HD page does not have to reload each other The page needs to be updated in the HTML page. I am using Google Map API and JSON which I am attempting to load is a geographical zone. My HTML page is currently looking like this:
& lt; Meta name = "viewport" content = "initial-scale = 1.0, user-scalable = no" & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Style & gt; HTML, body, # map-canvas {height: 100%; Margin: 0 px; Padding: 0 pixels} & lt; / Style & gt; & Lt; Script type = "text / javascript" src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyDwcEjr78AKq9cTP-dPWfFSeGaJ_-CkGSA" & gt; & Lt; / Script & gt; & Lt; Script src = "geoJsonInputData.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; Var map; Var myLocation = {'latitude': 38.255753, 'longitude': 140.836304}; Var myLatlng = new google.maps.LatLng (myLocation.latitude, myLocation.longitude); Var map option = {zoom: 16, center: mitlagaz, map type epe: google.maps.MapTypeId.ROADMAP}; Initialize function () {// Create a map map - New google.maps.Map (document.getElementById ('map-canvas'), map options); // Load a GeoJSON map.data.addGeoJson (data); } Google.maps.event.addDomListener (window, 'load', start); Set intern (refreshdata, 2000); Function Refresh Data () {var myLatlng = new google.maps.LatLng (newLocation.latitude, newLocation.longitude); Map.setCenter (myLatlng); Map.data.addGeoJson (data); } Google.maps.event.addDomListener (window, 'load', start); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "map-canvas" & gt; & Lt; / Div & gt; & Lt; / Body & gt;
As you can see, I actually try to use the Refresh Data function to reload the variable data while representing a geographical zone. But when I do this, I have a map screen (zoom and other buttons without a Google map but I can not see the map) and then to see the map, I have to manually refresh the page.
What do I need to do, update it from GeoSession automatically and without any visible problem from JS script
Here is the geographical input dotajes and in the variable data, you can see an example of my auto-geared geometry:
var NewLocation = {'latitude': 140.836304, 'longitude' : 38.255753}; Var "Data": "Feature Collection", "FEATURES": [{"Type": "Feature", "Properties": {}, "Geometry": {"Type": "Linestring", "Coordinate": [[140.836304,38.255753], [140.83640400000002,38.255853], [140.83650400000002,38.255953000000005]]}}]}};
Thanks!
Comments
Post a Comment