datapunt_processing.transform.geospatial package¶
Submodules¶
datapunt_processing.transform.geospatial.addres_to_latlon_in_df module¶
-
datapunt_processing.transform.geospatial.addres_to_latlon_in_df.
adress_to_latlon
(df)¶ This function adds the lattitude and longtitude to a pandas df based on an adress.
input: pandas df met tenminste de volgende variabelen:
- Straat: String met de naam van de straat
- Huisnr: String met huisnummer
output: pandas df waaraan de volgende variabelen zijn toegevoegd:
- lon: longtitude behorend bij adres
- lat: lattitude behorend bij adres
datapunt_processing.transform.geospatial.api_clean_BAG_address_NED module¶
-
datapunt_processing.transform.geospatial.api_clean_BAG_address_NED.
main
()¶
-
datapunt_processing.transform.geospatial.api_clean_BAG_address_NED.
parser
()¶ Parser function to run arguments from commandline and to add description to sphinx docs. To see possible styling options: https://pythonhosted.org/an_example_pypi_project/sphinx.html
datapunt_processing.transform.geospatial.api_get_areacodes_from_latlon module¶
-
datapunt_processing.transform.geospatial.api_get_areacodes_from_latlon.
getAreaCodes
(item, lat, lon)¶ - Get specific information like area codes based radius to nearest address based on lat/lon value
- ex: https://api.data.amsterdam.nl/geosearch/search/?item=verblijfsobject&lat=52.3731750&lon=4.8924655&radius=50
It currently is coded to work to get: - “buurt” - “buurtcombinatie” - “stadsdeel”
-
datapunt_processing.transform.geospatial.api_get_areacodes_from_latlon.
getAreaCodesforDataFrame
(df, item)¶ Get specific information like area codes based radius to nearest address based on lat/lon value for each row in pandas DF. Args:
df with column “lon” and “lat” item, which is “buurt”, “buurtcombinatie” or “stadsdeel”- Returns:
- df with two new columns that describe name and code of the item “
-
datapunt_processing.transform.geospatial.api_get_areacodes_from_latlon.
getJson
(url)¶ Get a json from an url
- Args:
url: give an api url:
https://api.data.amsterdam.nl/bag/gebieden/stadsdeel
- Returns:
- a parsed json result or an error message
datapunt_processing.transform.geospatial.api_get_nearest_address_from_latlon module¶
-
datapunt_processing.transform.geospatial.api_get_nearest_address_from_latlon.
get_address_near_point
(lat, lon, radius)¶ Get nearest addres and housenumber based on location.
get_address_near_point(52.3729378, 4.8937806, 50)
- Args:
- lat: 52.3729378
- lon: 4.8937806
- radius: 50
- Returns:
- Dictionary of the first found address with openbareruimte, huisnummer, postcode, etc…
-
datapunt_processing.transform.geospatial.api_get_nearest_address_from_latlon.
get_openbareruimte
(lat, lon)¶ Get the name the street location where it coordinate resides on.
- Args:
- lat: 52.3729378
- lon: 4.8937806
- Result:
- Returns dictionary of the openbare ruimte object
datapunt_processing.transform.geospatial.csv_get_centroid_of_street module¶
-
datapunt_processing.transform.geospatial.csv_get_centroid_of_street.
get_centroid_street
(filename, street_column, city_name)¶ Get the X,Y centroid of an address.
- Args:
- street_column: Dam 1
- city_name: Amsterdam
- Returns:
- Origional CSV file with coordinates and BAG corrected naming.
-
datapunt_processing.transform.geospatial.csv_get_centroid_of_street.
main
()¶
-
datapunt_processing.transform.geospatial.csv_get_centroid_of_street.
parser
()¶
datapunt_processing.transform.geospatial.divide_bbox_amsterdam_in_quadrants module¶
-
datapunt_processing.transform.geospatial.divide_bbox_amsterdam_in_quadrants.
calculation
(number_of_boxes, bbox)¶ Divide the BBOX of the City of Amsterdam in x number of quadrants/rectangles for use in limiting WFS/geo queries.
- Args:
- number_of_boxes: in multiples of 2, 8 works well for most cases.
- bbox: [110200,476772,134030,493900]
- Returns:
- list of quadrants [[x1,y1,x2,y2],[..]]
datapunt_processing.transform.geospatial.postgres_add_areas_from_coordinates module¶
-
datapunt_processing.transform.geospatial.postgres_add_areas_from_coordinates.
executeScriptsFromFile
(pg_str, filename)¶ WIP does not work yet
-
datapunt_processing.transform.geospatial.postgres_add_areas_from_coordinates.
main
()¶
-
datapunt_processing.transform.geospatial.postgres_add_areas_from_coordinates.
parser
()¶
datapunt_processing.transform.geospatial.rd_to_wgs84 module¶
-
datapunt_processing.transform.geospatial.rd_to_wgs84.
rd_to_wgs84
(X, Y)¶ Quick reprojection method, does result in 1m max offset difference. Use Postgres ST_Transform method if you want a better reprojection. Example downloaded from http://forum.geocaching.nl/index.php?showtopic=7886