File: transform.py

package info (click to toggle)
python-geopandas 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,752 kB
  • sloc: python: 26,021; makefile: 147; sh: 25
file content (24 lines) | stat: -rw-r--r-- 793 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from geopandas import GeoDataFrame, GeoSeries, read_file
import numpy as np
import pandas as pd
from shapely.geometry import Point
from geopandas.tests.util import _NYBB

class CRS:
    def setup(self):
        nybb = read_file(_NYBB)
        self.long_nybb = GeoDataFrame(pd.concat(10 * [nybb]), crs=nybb.crs)

        num_points = 20000
        longitudes = np.random.rand(num_points) - 120
        latitudes = np.random.rand(num_points) + 38
        self.point_df = GeoSeries(
            [Point(x, y) for (x, y) in zip(longitudes, latitudes)]
        )
        self.point_df.crs = {"init": "epsg:4326"}

    def time_transform_wgs84(self):
        self.long_nybb.to_crs({"init": "epsg:4326"})

    def time_transform_many_points(self):
        self.point_df.to_crs({"init": "epsg:32610"})