Return a Geo dataframe
551150
def geoframe(self, *args, **kwargs):
        """"""

        from geopandas import GeoDataFrame
        import geopandas as gpd
        from shapely.geometry.polygon import BaseGeometry
        from shapely.wkt import loads

        gdf = None
        try:
            gdf = self.resolved_url.geoframe(*args, **kwargs)
        except AttributeError:
            pass

        if gdf is None:
            try:
                gdf = self.resolved_url.geo_generator.geoframe(*args, **kwargs)
            except AttributeError:
                pass

        if gdf is None:
            try:
                gdf = self.row_generator.geoframe(*args, **kwargs)
            except AttributeError:
                pass

        if gdf is None:
            try:

                gdf = GeoDataFrame(self.dataframe(*args, **kwargs))

                first = next(gdf.iterrows())[1]['geometry']

                if isinstance(first, str):
                    # We have a GeoDataframe, but the geometry column is still strings, so
                    # it must be converted
                    shapes = [loads(row['geometry']) for i, row in gdf.iterrows()]

                elif not isinstance(first, BaseGeometry):
                    # If we are reading a metatab package, the geometry column's type should be
                    # 'geometry' which will give the geometry values class type of
                    # rowpipe.valuetype.geo.ShapeValue. However, there are other
                    # types of objects that have a 'shape' property.

                    shapes = [row['geometry'].shape for i, row in gdf.iterrows()]

                else:
                    shapes = gdf['geometry']

                gdf['geometry'] = gpd.GeoSeries(shapes)
                gdf.set_geometry('geometry')

                # Wild guess. This case should be most often for Metatab processed geo files,
                # which are all 4326
                if gdf.crs is None:
                    gdf.crs = {'init': 'epsg:4326'}


            except KeyError as e:
                raise ResourceError("Failed to create GeoDataFrame for resource '{}': No geometry column".format(self.name))
            except (KeyError,TypeError) as e:
                raise ResourceError("Failed to create GeoDataFrame for resource '{}': {}".format(self.name, str(e)))

        assert gdf.crs is not None
        return gdf
1153047
def wwln_to_geopandas(file):
    """"""
    tmp = pd.read_csv(file, parse_dates=True, header=None,
                      names=['date', 'time', 'lat', 'lon', 'err', '#sta'])
    list_dts = [gen_datetime(dvals, tvals)
                for dvals, tvals in zip(tmp['date'], tmp['time'])]
    points = [[Point(tmp.lat[row], tmp.lon[row]), dt]
              for row, dt in zip(tmp.index, list_dts)]
    df = gpd.GeoDataFrame(points, columns=['geometry', 'dt'])
    return df
34934
def coordinates(self, x, y, **kwargs):
        ''''''
        kwargs['returntype'] = 'geographies'
        fields = {
            'x': x,
            'y': y
        }

        return self._fetch('coordinates', fields, **kwargs)
1156939
def get_dataset(self, key, info):
        """"""
        if key.name in ['longitude', 'latitude']:
            logger.debug('Reading coordinate arrays.')

            if self.lons is None or self.lats is None:
                self.lons, self.lats = self.get_lonlats()

            if key.name == 'latitude':
                proj = Dataset(self.lats, id=key, **info)
            else:
                proj = Dataset(self.lons, id=key, **info)

        else:
            data = self.get_sds_variable(key.name)
            proj = Dataset(data, id=key, **info)

        return proj
888855
def geo_search(self, radius, node=None, center=False, **kwargs):
        ''''''
        node = as_node(node if node is not None else self)

        G = self.subgraph(**kwargs)

        pos = nx.get_node_attributes(G, 'pos')
        if not pos:
            return []
        nodes, coords = list(zip(*pos.items()))
        kdtree = KDTree(coords)  # Cannot provide generator.
        indices = kdtree.query_ball_point(pos[node], radius)
        return [nodes[i] for i in indices if center or (nodes[i] != node)]
723553
def __geo_point(lat, lon, elev):
        
        logger_noaa_lpd.info("enter geo_point")
        coordinates = []
        geo_dict = OrderedDict()
        geometry_dict = OrderedDict()
        for index, point in enumerate(lat):
            coordinates.append(lat[index])
            coordinates.append(lon[index])
        if elev:
            coordinates = coordinates + elev
        geometry_dict['type'] = 'Point'
        geometry_dict['coordinates'] = coordinates
        geo_dict['type'] = 'Feature'
        geo_dict['geometry'] = geometry_dict
        return geo_dict
68722
def as_frame(self):
        
        data = {sid: pd.Series(data) for sid, data in self.response_map.iteritems()}
        frame = pd.DataFrame.from_dict(data, orient='index')
        # layer in any missing fields just in case
        frame = frame.reindex_axis(self.request.fields, axis=1)
        return frame
1263020
def to_world(self, shape, dst_crs=None):
        """"""
        if dst_crs is None:
            dst_crs = self.crs
        shp = transform(shape, self.crs, dst_crs, dst_affine=self.affine)
        return GeoVector(shp, dst_crs)
673235
def get_sub_dataframe(keys, by_position: true)
      return Daru::DataFrame.new({}) if keys == []

      keys = @index.pos(*keys) unless by_position

      sub_df = row_at(*keys)
      sub_df = sub_df.to_df.transpose if sub_df.is_a?(Daru::Vector)

      sub_df
    end
552961
def geojson(self):
        """"""
        return {
            "type": "FeatureCollection",
            "features": [f.geojson(i) for i, f in self._features.items()]
        }
1367101
def geoid(self):
        """""""

        if self.valuetype_class.is_geoid():
            return self

        for c in self.table.columns:
            if c.parent == self.name and  c.valuetype_class.is_geoid():
                return c
1325518
def by_geopoint(self, lat, long):
        

        header, content = self._http_request(self.BASE_URL, lat=lat, long=long)		
        return json.loads(content)
1278191
function(coords) {

			var dist = 0, last;
			for (var i = 0, l = coords.length; i < l; ++i) {
				if(last) {
					dist += geolib.getDistance(coords[i], last);
				}
				last = coords[i];
			}

			return dist;

		}
149089
def _get_dataframe(self):
        
        if self.source_conn is None:  # Use local file
            return ge.read_csv(self.dataset_name, **self.dataset_params)

        if isinstance(self.source_conn, S3Hook):
            hook = ExpectationS3CsvHook(aws_conn_id=self.source_conn_id)

            return hook.get_ge_df(self.dataset_name, self.source_bucket_name, **self.dataset_params)

        if isinstance(self.source_conn, DbApiHook):
            hook = ExpectationMySQLHook(mysql_conn_id=self.source_conn_id)

            return hook.get_ge_df(self.dataset_name, **self.dataset_params)
574716
def _shape(self, df):
        

        row, col = df.shape
        return row + df.columns.nlevels, col + df.index.nlevels
1363878
def ref_context_from_geoloc(geoloc):
    """"""
    text = geoloc.get('text')
    geoid = geoloc.get('geoID')
    rc = RefContext(name=text, db_refs={'GEOID': geoid})
    return rc
391361
def extract(self, point_x, point_y, radius=0):
        '''
        
        '''
        row, col = map_pixel(point_x, point_y, self.x_cell_size, self.y_cell_size,
                             self.xmin, self.ymax)
        col2 = np.abs(radius/self.x_cell_size).astype(int)
        row2 = np.abs(radius/self.y_cell_size).astype(int)
        return GeoRaster(self.raster[max(row-row2, 0):min(row+row2+1, self.shape[0]), \
                        max(col-col2, 0):min(col+col2+1, self.shape[1])], self.geot,
                        nodata_value=self.nodata_value,\
                        projection=self.projection, datatype=self.datatype)