spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

how to display one location from an array of location based on sensor number


I can't see your code, so it's hard to know.

Here is a working solution, by calling initialize when clicking on html elements

This resets the map with a new marker.

  • Defined initialize() with parameter "select"

  • Beneath the map variable (but inside initialize) made a marker, which picks the data using the previously defined "select" parameter.

  • Used html element to call initialize with parameter value.

Normal Google map otherwise.

It really helps if we can see your code, in future.

<!DOCTYPE html>
<html>
  <head>
    <style>
      #map-canvas {
        width: 500px;
        height: 400px;
      }
    </style>
    <script
src="https://maps.googleapis.com/maps/api/js"></script>
    <script>

    var locations = [
      ['Sensor 1', -33.890542, 151.274856, 4],
      ['Sensor 2', -33.923036, 151.259052, 5],
      ['Sensor 3', -34.028249, 151.157507, 3],
      ['Sensor 4', -33.80010128657071,
151.28747820854187, 2],
      ['Sensor 5', -33.950198, 151.259302, 1]
    ];

    function initialize(select) {
      var myLatlng = new
google.maps.LatLng(-33.890542, 151.274856);
      var mapOptions = {
        zoom: 9,
        center: myLatlng
      }
      var map = new
google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
      var marker = new google.maps.Marker({
        position: new
google.maps.LatLng(locations[select][1],
locations[select][2]),
        map: map
      });
    }

    google.maps.event.addDomListener(window,
'load', initialize);

    </script>
  </head>
  <body>
    <p onclick="initialize(0)">Sensor
1</p>
    <p onclick="initialize(1)">Sensor
2</p>
    <p onclick="initialize(2)">Sensor
3</p>
    <p onclick="initialize(3)">Sensor
4</p>
    <p onclick="initialize(4)">Sensor
5</p>
    <div id="map-canvas"></div>
  </body>
</html>

Categories : Javascript

Related to : how to display one location from an array of location based on sensor number
Which is better for getting assembly location , GetAssembly().Location or GetExecutingAssembly().Location
It seems rather obvious: When you want the executing assembly, use GetExecutingAssembly. Sometimes you don't have one, for example when running as an Office add-in. You could use Assembly.GetAssembly instead.

Categories : C#
Get Map location based on the text dynamically
I wrote the custom method (CLLocationCoordinate2D) geoCodeUsingAddress:(NSString *)address { double latitude = 0, longitude = 0; NSString *esc_addr = [address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *req = [NSString stringWithFormat:@"http://maps.google.com/maps/api/geocode/json sensor=false&addr

Categories : IOS
Get number of satellites using fused location
Unfortunately, Fused Location does not have the sattelites information when you Location.getExtras(). You would basically get a NullPointerException. As you said, GpsStatus is the only way to do it.

Categories : Android
Query to Sum Numbers Based on Location (State)
I went back and used a UNION statement to give me the correct answer: select sum(procperf) as 'Procedures Performed' from ( select sum(proceduresperformed) as procperf from DriveProjectionAndCollectedTotals DPaCT inner join rpt_DriveMaster DM on DPaCT.DriveID=DM.DriveID left outer join rpt_Accounts Acct on DM.AccountID=Acct.AccountID inner join rpt_AddressDetail AD on Acct.AccountID=AD.AccountID

Categories : SQL
C++ finding the min location, sort, and swap in a 2D array
The easiest way to iterate over a (so-called) 2D array is to use two nested loops: for(unsigned int j=0; j<numRows; ++j) for(unsigned int k=0; k<numColumns; ++k) ... do something with A[j][k] ...

Categories : C++
Recently Add
Busy Indicator while page is loading
parent.document.getElementById and images path
Can not get bootstrap datetime picker to display properly
reading select box jquery issues
DC.JS Pie Chart + Select Deslect from external JavaScript function
Why would I ever need to cancelAnimationFrame()
Angular.ui alert doesn't close
HTML/JS How to position a rectangle relative to 'any' side of the parent canvas element
parse variable to xml
C# Dictionary equivalent in JavaScript
ExtJS Dashboard Panel Fit Panel Vertically
jQuery cross domain ajax call - Interpreted as script but transferred with MIME type text/xml
Reactjs map returns unexpected token }
Working with multiple pages in apache cordova and vs2013
Resize iframe to loaded content
Why 13596*0.1 is different than 13596/10?
AngularJS Validate all forms on application load
javascript open popup without menu/url/titlebar/scrollbar/anything
Can I use Razor syntax inside Javascript included in a ScriptBundle?
How to show a box for comment reply with id
parse name from user input when using jquery serialize
How to parse and load javascript object?
Marionette not navigating to the same url
Adding Google+ Sign in button to website
GRUNT - Install Grunt Packages?
how should I create the path of templateUrl property in Angular ui-router?
Update mysql database with jquery array using ajax
Run the same function on each item in a list / array
Get all ticks values (NVD3)
Button Click Event not Passing input String to MVC Controller Method
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.