Returns a feature name of a nearby location.

        Often this feature refers to a street or neighborhood within the given
        results.
420316
def vicinity(self):
        
        if self._vicinity == '' and self.details != None and 'vicinity' in self.details:
            self._vicinity = self.details['vicinity']
        return self._vicinity
1210311
public void markNeighbor( DelaunayTriangle t )
    {
        if( t.contains( points[1], points[2] ) )
        {
            neighbors[0] = t;
            t.markNeighbor( points[1], points[2], this );
        }
        else if( t.contains( points[0], points[2] ) )
        {
            neighbors[1] = t;
            t.markNeighbor( points[0], points[2], this );
        }
        else if( t.contains( points[0], points[1] ) )
        {
            neighbors[2] = t;
            t.markNeighbor( points[0], points[1], this );
        }
        else
        {
            logger.error( "markNeighbor failed" );
        }
    }
1062010
function getCentroidFeatureForPolygon (coordinates, properties, newProperties) {
    let centroid = Geo.centroid(coordinates);
    if (!centroid) {
        return;
    }

    // clone properties and mixix newProperties
    let centroid_properties = {};
    Object.assign(centroid_properties, properties, newProperties);

    return {
        type: 'Feature',
        properties: centroid_properties,
        geometry: {
            type: 'Point',
            coordinates: centroid
        }
    };
}
180264
private String getSourceName(final String property) {
        if (propertyNameMap.containsKey(property)) {
            return propertyNameMap.get(property);
        } else {
            return property;
        }
    }
642398
def _makeLocationElement(self, locationObject, name=None):
        

        locElement = ET.Element("location")
        if name is not None:
           locElement.attrib['name'] = name
        for dimensionName, dimensionValue in locationObject.items():
           dimElement = ET.Element('dimension')
           dimElement.attrib['name'] = dimensionName
           if type(dimensionValue)==tuple:
               dimElement.attrib['xvalue'] = "%f"%dimensionValue[0]
               dimElement.attrib['yvalue'] = "%f"%dimensionValue[1]
           else:
               dimElement.attrib['xvalue'] = "%f"%dimensionValue
           locElement.append(dimElement)
        return locElement
433559
def _proximity_to_association(proximity):
    """"""
    # pylint:disable=invalid-name
    # I'm afraid that the short names here are just a function of the
    # mathematical nature of the code.

    # Special case: zero-size matrix
    if proximity.shape[0] == 0 or proximity.shape[1] == 0:
        return proximity

    # Take SVD of proximity matrix
    U, sing_vals, Vh = np.linalg.svd(proximity)

    # Count the number of non-zero singular values
    nsv = np.count_nonzero(sing_vals)

    # Trim U and Vh to match
    U, Vh = U[:, :nsv], Vh[:nsv, :]

    # Compute new matrix as if singular values were unity
    return U.dot(Vh)
227913
def getFeatureID(self, location):
    
    if not self.contains(location):
      return self.EMPTY_FEATURE

    if self.almostEqual(abs(location[2]), self.height / 2.):
      if self.almostEqual(location[0] ** 2 + location[1] ** 2,
                          self.radius ** 2):
        return self.CYLINDER_EDGE
      else:
        return self.FLAT
    else:
      return self.CYLINDER_SURFACE
1340363
def getFeatureID(self, location):
    
    truthyFeature = self.contains(location)
    if not truthyFeature:
      return self.EMPTY_FEATURE
    elif truthyFeature=='face':
      return self.FLAT
    elif truthyFeature=='vertex':
      return self.POINTY
    elif truthyFeature=="edge":
      return self.EDGE
    elif truthyFeature=="surface":
      return self.SURFACE
    else:
      return self.EMPTY_FEATURE
382478
@Override
    public String getLocalName(int index) {
        if (index < 0 || index >= attributesList.size()) {
            return null;
        }
        Attribute attr = attributesList.get(index);
        // FIXME attr.localName is sometimes null, why?
        if (namespaces && attr.localName == null) {
            // XXX fix this here for now
            int ci = attr.name.indexOf(':');
            attr.localName = (ci == -1) ? attr.name
                    : attr.name.substring(ci + 1);
        }
        return (attr.localName == null) ? "" : attr.localName;
    }
364136
def get_neighborhood_network(self, node_name: str, order: int = 1) -> Graph:
        
        logger.info("In get_neighborhood_graph()")
        neighbors = list(self.get_neighbor_names(node_name, order))
        neighbor_network = self.graph.copy()
        neighbor_network.delete_vertices(self.graph.vs.select(name_notin=neighbors))
        return neighbor_network
1372917
def get_algo(self, args: argparse.Namespace, algo: str) -> object:
        
        if algo == 'nn':
            return NearestNeighbor(args.nnk)
176556
function runListFeatures(callback) {
  var rectangle = {
    lo: {
      latitude: 400000000,
      longitude: -750000000
    },
    hi: {
      latitude: 420000000,
      longitude: -730000000
    }
  };
  console.log('Looking for features between 40, -75 and 42, -73');
  var call = client.listFeatures(rectangle);
  call.on('data', function(feature) {
      console.log('Found feature called "' + feature.name + '" at ' +
          feature.location.latitude/COORD_FACTOR + ', ' +
          feature.location.longitude/COORD_FACTOR);
  });
  call.on('end', callback);
}
783888
def sampleLocationFromFeature(self, feature):
    
    if feature == "face":
      return self._sampleFromFaces()
    elif feature == "edge":
      return self._sampleFromEdges()
    elif feature == "vertex":
      return self._sampleFromVertices()
    elif feature == "random":
      return self.sampleLocation()
    else:
      raise NameError("No such feature in {}: {}".format(self, feature))
619984
protected List<int[]> getNearestNeighbors(float xSource, float ySource) {

		List<int[]> results = new ArrayList<int[]>();

		// Get the coverage data source pixels for x and y
		CoverageDataSourcePixel xPixel = getXSourceMinAndMax(xSource);
		CoverageDataSourcePixel yPixel = getYSourceMinAndMax(ySource);

		// Determine which x pixel is the closest, the second closest, and the
		// distance to the second pixel
		int firstX;
		int secondX;
		float xDistance;
		if (xPixel.getOffset() > .5) {
			firstX = xPixel.getMax();
			secondX = xPixel.getMin();
			xDistance = 1.0f - xPixel.getOffset();
		} else {
			firstX = xPixel.getMin();
			secondX = xPixel.getMax();
			xDistance = xPixel.getOffset();
		}

		// Determine which y pixel is the closest, the second closest, and the
		// distance to the second pixel
		int firstY;
		int secondY;
		float yDistance;
		if (yPixel.getOffset() > .5) {
			firstY = yPixel.getMax();
			secondY = yPixel.getMin();
			yDistance = 1.0f - yPixel.getOffset();
		} else {
			firstY = yPixel.getMin();
			secondY = yPixel.getMax();
			yDistance = yPixel.getOffset();
		}

		// Add the closest neighbor
		results.add(new int[] { firstX, firstY });

		// Add the second and third neighbor based upon the x and y distances to
		// second coordinates
		if (xDistance <= yDistance) {
			results.add(new int[] { secondX, firstY });
			results.add(new int[] { firstX, secondY });
		} else {
			results.add(new int[] { firstX, secondY });
			results.add(new int[] { secondX, firstY });
		}

		// Add the farthest neighbor
		results.add(new int[] { secondX, secondY });

		// If right on the boundary between the forward and backwards pixel, add
		// the backwards pixel options
		if (xPixel.getOffset() == 0) {
			results.add(new int[] { xPixel.getMin() - 1, yPixel.getMin() });
			results.add(new int[] { xPixel.getMin() - 1, yPixel.getMax() });
		}
		if (yPixel.getOffset() == 0) {
			results.add(new int[] { xPixel.getMin(), yPixel.getMin() - 1 });
			results.add(new int[] { xPixel.getMax(), yPixel.getMin() - 1 });
		}
		if (xPixel.getOffset() == 0 && yPixel.getOffset() == 0) {
			results.add(new int[] { xPixel.getMin() - 1, yPixel.getMin() - 1 });
		}

		return results;
	}
834058
public String getLocalName(int index) {
    if (index < 0 || index >= indexSet.size())
      return null;
    return attributes.getLocalName(indexSet.get(index));
  }
296696
def seq_neighborhoods(self,seq,flanksize):
        
        subseqs = []
        matches, endpoints, scores = self.scan(seq)
        laststart, laststop = -1, -1
        for start, stop in endpoints:
            curstart, curstop = max(0,start-flanksize), min(stop+flanksize,len(seq))
            if curstart > laststop:
                if laststop != -1:
                    subseqs.append(seq[laststart:laststop])
                laststart, laststop = curstart, curstop
            else:
                laststop = curstop
        if endpoints: subseqs.append(seq[laststart:laststop])
        return subseqs
1041931
def location_nearbystops(self, origin_coord_lat, origin_coord_long):
        
        response = self._request(
            '',
            originCoordLat=origin_coord_lat,
            originCoordLong=origin_coord_long)
        return _get_node(response, 'LocationList', 'StopLocation')