boolean isSingleFloor(List<Sample> samples) {
   Set<Double> floorSet = new HashSet<>();
   for (Sample s : samples) {
     Location loc = s.getLocation();
     double z = loc.getZ();
     floorSet.add(z);
   }
   if (floorSet.size() == 1) {
     return true;
   } else {
     return false;
   }
 }
  public static List<Location> readWalkLocations(InputStream is) {
    int z = 0;
    List<Location> locs = new ArrayList<>();
    try {
      JSONObject json = (JSONObject) JSON.parse(is);
      String type = json.getString("type");
      if (type.equals("FeatureCollection")) {
        JSONArray features = json.getJSONArray("features");
        Iterator<JSONObject> iter = features.iterator();
        while (iter.hasNext()) {
          JSONObject feature = iter.next();
          JSONObject properties = feature.getJSONObject("properties");
          JSONObject geometry = feature.getJSONObject("geometry");
          type = properties.getString("type");
          if (type.equals("walk")) {

            double height = Double.parseDouble(properties.getString("height"));
            int repeat = Integer.parseInt(properties.getString("repeat"));

            JSONArray coordinates = geometry.getJSONArray("coordinates");

            Iterator<JSONArray> iterCoords = coordinates.iterator();
            while (iterCoords.hasNext()) {
              JSONArray coord = iterCoords.next();

              double x = coord.getDouble(0);
              double y = coord.getDouble(1);

              Location loc = new Location(x, y, z);
              loc.setH((float) height);

              for (int t = 0; t < repeat; t++) {
                locs.add(loc);
              }
            }
          }
        }
      }
    } catch (NullPointerException | JSONException e) {
      e.printStackTrace();
    }
    return locs;
  }
  public static List<Location> readGridLocations(InputStream is) {

    int z = 0;

    List<Location> locs = new ArrayList<>();
    try {
      JSONObject json = (JSONObject) JSON.parse(is);
      String type = json.getString("type");
      if (type.equals("FeatureCollection")) {
        JSONArray features = json.getJSONArray("features");
        Iterator<JSONObject> iter = features.iterator();
        while (iter.hasNext()) {
          JSONObject feature = iter.next();
          JSONObject properties = feature.getJSONObject("properties");
          JSONObject geometry = feature.getJSONObject("geometry");
          String propertiesType = properties.getString("type");
          String geometryType = geometry.getString("type");
          if (propertiesType.equals("grid")) {
            double height = Double.parseDouble(properties.getString("height"));
            int repeat = Integer.parseInt(properties.getString("repeat"));
            int spacing = Integer.parseInt(properties.getString("interval"));

            JSONArray coordinates = geometry.getJSONArray("coordinates");
            Iterator<JSONArray> iterCoords = null;
            if (geometryType.equals("Polygon")) {
              JSONArray exteriorRing = coordinates.getJSONArray(0);
              iterCoords = exteriorRing.iterator();
            } else if (geometryType.equals("LineString")) {
              iterCoords = coordinates.iterator();
            }

            double minx = Double.MAX_VALUE;
            double miny = Double.MAX_VALUE;
            double maxx = -Double.MAX_VALUE;
            double maxy = -Double.MAX_VALUE;
            while (iterCoords.hasNext()) {
              JSONArray coord = iterCoords.next();
              double x = coord.getDouble(0);
              double y = coord.getDouble(1);
              minx = Math.min(minx, x);
              miny = Math.min(miny, y);
              maxx = Math.max(maxx, x);
              maxy = Math.max(maxy, y);
            }

            double x = minx;
            while (x <= maxx) {
              double y = miny;
              while (y <= maxy) {
                Location loc = new Location(x, y, z);
                loc.setH((float) height);
                for (int t = 0; t < repeat; t++) {
                  locs.add(loc);
                }
                y += spacing;
              }
              x += spacing;
            }
          }
        }
      }
    } catch (NullPointerException | JSONException e) {
      e.printStackTrace();
    }
    return locs;
  }