Package: onemapsg
OneMap API ClientPython Wrapper Client for the OneMap APIDocs here:https://docs.onemap.sg/PyPI Link:https://pypi.org/project/onemapsg/Register for an API key here:https://developers.onemap.sg/signup/This client:Authenticates for a valid API token, and refreshes as needed!Returns everything as a nice dictionary!Example UsagefromonemapsgimportOneMapClientClient=OneMapClient("YOUR_EMAIL","YOUR_PASSWORD")Client.search("Dragon View Park")# Result'''{'found': 1,'totalNumPages': 1,'pageNum': 1,'results': [{'SEARCHVAL': 'DRAGON VIEW PARK','BLK_NO': '','ROAD_NAME': 'NIL','BUILDING': 'DRAGON VIEW PARK','ADDRESS': 'DRAGON VIEW PARK SINGAPORE','POSTAL': 'NIL','X': '27415.382888752','Y': '31015.7030415982','LATITUDE': '1.29676950856585','LONGITUDE': '103.828065538017','LONGTITUDE': '103.828065538017'}]}'''InstallationpipinstallonemapsgCreditsThe OneMap team for a pretty nice APIAuthor: methylDragonSupport my efforts!Or leave a tip! ãƒ¾(Â°âˆ‡Â°*)Client InterfaceIncludes the full API as of February 2019, also supports a general API query in case of client depreciation:Client SpecificInitialise ClientClient = OneMapClient(email, password)Generates token on initGenerate New Tokenget_token(email=None, password=None)Returns:token, expiryGeneral Queryquery_api(endpoint, param_dict)Class MethodsRemember to use them as such!Client.method()Location SearchSearchsearch(search_val, return_geom=True, get_addr_details=True, page_num=1))Reverse Geocode (SVY21 and WGS84)reverse_geocode_SVY21(coordinates, buffer=10, address_type="All", other_features=False)reverse_geocode_WGS84(coordinates, buffer=10, address_type="All", other_features=False)Coordinate ConversionAll converters between WGS84, SVY21, and 3857WGS84_to_EPSG(coordinates)WGS84_to_SVY21(coordinates)SVY21_to_EPSG(coordinates)SVY21_to_WGS84(coordinates)EPSG_to_SVY21(coordinates)EPSG_to_WGS84(coordinates)ThemesCheck Theme Statuscheck_theme_status(query_name, date_time)Get Theme Infoget_theme_info(query_name)Get all Themesget_all_themes_info(more_info=False)Retrieve Themesretrieve_theme(query_name, extents=None)Planning AreasGet all Planning Areasget_all_planning_areas(year=None)Get Planning Area Namesget_planning_area_names(year=None)Get Planning Area Boundsget_planning_area_bounds(coordinates, year=None)Population QueriesEconomic Statusesget_economic_statuses(year, planning_area, gender=None)Education Attendanceget_education_attendance(year, planning_area)Ethnic Groupsget_ethnic_groups(year, planning_area, gender=None)Work Income For Household (Monthly)get_household_monthly_work_income(year, planning_area)Household Size Dataget_household_sizes(year, planning_area)Household Structure Dataget_household_structures(year, planning_area)Income from Work Dataget_work_income(year, planning_area)Population of Industriesget_industries(year, planning_area)Language Literacy Dataget_language_literacy(year, planning_area)Marital Status Dataget_marital_statuses(year, planning_area, gender=None)Mode of Transports to School Dataget_modes_of_transport_to_school(year, planning_area)Mode of Transport to Work Dataget_modes_of_transport_to_work(year, planning_area)Occupation Dataget_occupations(year, planning_area)Age Dataget_age_groups(year, planning_area)Religion Dataget_religious_groups(year, planning_area)Spoken Language Dataget_spoken_languages(year, planning_area)Tenancy Dataget_tenancy(year, planning_area)Dwelling Type Household Dataget_dwelling_types(year, planning_area)Dwelling Type Population Dataget_population_by_dwelling_types(year, planning_area)Routing ServiceGet Routeget_route(start_coordinates, end_coordinates, route_type)Get Public Transport Routeget_public_transport_route(start_coordinates, end_coordinates, date, time, mode, max_walk_distance=None, num_itineraries=1)Static Map GeneratorGenerate Static Mapgenerate_static_map(layer_chosen, location, zoom, width, height, polygons=None, lines=None, points=None, color=None, fill_color=None)OneMap API Client Changelogv1.0.3 - 2021_07_21Fixedget_token()updated for new JSON APIv1.0.2 - 2020_02_10FixedFix missingmodeparameter inget_public_transport_route()callv1.0.1 - 2020_02_10ChangedAllow functions that use onemap API tokens internally to continue running when token expiry is detected and token renewal occurs, instead of returning immediatelyFixedFix string formatting bug inget_route()andget_public_transport_route()v1.0.0 - 2019_07_09AddedInitial release:OneMapClient with full API