{"id":32164477,"url":"https://github.com/ohhi-vn/location_simulator","last_synced_at":"2026-03-08T09:02:02.351Z","repository":{"id":166468063,"uuid":"641194931","full_name":"ohhi-vn/location_simulator","owner":"ohhi-vn","description":"GPS generator, can simulate a sport game \u0026 scalable for test/dev","archived":false,"fork":false,"pushed_at":"2024-12-28T15:55:02.000Z","size":40,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-21T20:13:41.176Z","etag":null,"topics":["disport","gps","hex-package","location","tracking"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ohhi-vn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-16T01:30:06.000Z","updated_at":"2025-03-07T02:47:36.000Z","dependencies_parsed_at":"2024-04-20T05:26:53.984Z","dependency_job_id":"d03e1e5e-8fe7-4392-8f7d-7e9d625f0898","html_url":"https://github.com/ohhi-vn/location_simulator","commit_stats":null,"previous_names":["ohhi-vn/location_simulator"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/ohhi-vn/location_simulator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohhi-vn%2Flocation_simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohhi-vn%2Flocation_simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohhi-vn%2Flocation_simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohhi-vn%2Flocation_simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ohhi-vn","download_url":"https://codeload.github.com/ohhi-vn/location_simulator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohhi-vn%2Flocation_simulator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29596125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T20:59:56.587Z","status":"ssl_error","status_checked_at":"2026-02-18T20:58:41.434Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["disport","gps","hex-package","location","tracking"],"created_at":"2025-10-21T14:46:38.049Z","updated_at":"2026-02-18T21:02:28.331Z","avatar_url":"https://github.com/ohhi-vn.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Docs](https://img.shields.io/badge/api-docs-green.svg?style=flat)](https://hexdocs.pm/location_simulator)\n[![Hex.pm](https://img.shields.io/hexpm/v/location_simulator.svg?style=flat\u0026color=blue)](https://hex.pm/packages/location_simulator)\n\n# LocationSimulator\n\n*Important: We updated attribute for compatible with GPX. If you go to from older version, you need change attribue in state follow: :lati -\u003e :lat, :long -\u003e :lon, :elev -\u003e :ele . Sorry for the inconvenience!*\n\nUse for simulating location/GPS (longitude, latitude, elevation) data. Support scalable for test workload.\n\nSource code is available on [Github](https://github.com/ohhi-vn/location_simulator)\n\nPackage for using on [Hex.pm](https://hex.pm/packages/location_simulator)\n\n## Achitecture\n\nThe library has 3 main part:\n\n1. Supervisor. Lib uses `PartitionSupervisor` for creating worker from config\n2. Worker. Generating GPS with user config\n3. Callback module. This is defined by user to handle event from worker\n\n### Api call flow\n\n```mermaid\nsequenceDiagram\n    participant CallbackModule\n    participant Worker\n    participant Api\n    participant Supervisor\n\n    Api-\u003e\u003eSupervisor: Start with workers from config\n    Supervisor-\u003e\u003eWorker: Start GPS generator\n    Worker-\u003e\u003eCallbackModule: call start event\n    Worker-\u003e\u003eCallbackModule: call gps event\n    Worker-\u003e\u003eCallbackModule: call stop event\n```\n\n*(for in local you need install extension support for mermaid to view flow)*\n\n## Installation\n\nLibrary can be installed\nby adding `location_simulator` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:location_simulator, \"~\u003e 0.6\"}\n  ]\nend\n```\n\nLibrary need to start before using APIs. If you need start with your app, you could add to `application` function:\n\n```elixir\ndef application do\n  [\n    mod: {YourApp.Application, []},\n    extra_applications: [:logger, :location_simulator]\n  ]\nend\n```\n\nIf you need to modify source please go to [Github](https://github.com/ohhi-vn/location_simulator) and clone repo or contribute our repo.\n\n## Guide\n\nStart LocationSimulator with default config:\n\n```elixir\nLocationSimulator.start()\n```\n\nWith default config simulator will print location to console by Logger.\n\nStart with your callback \u0026 config:\n\n### Generate fake GPS data\n\n```elixir\nconfig =\n    %{\n      worker: 3,\n      event: 100,\n      interval: 1000,\n      random_range: 0,\n      direction: :random,\n      elevation: 100,\n      elevation_way: :up,\n      callback: MyCallbackModule\n    }\n\nLocationSimulator.start(config)\n```\n\nSimulator support directions:\n\n:north, :south, :east, :west, :north_east, :north_west, :south_east, :south_west\n\nIf :direction is missed or equal :random, simulator will random a direction for each worker.\n\nWith elevation, you can set start level and way :up or :down or no move up/down by any value.\n\nIf you want all worker started from same point, you can add :started_gps. In this case elevation config from outside will be ignored.\n\n```elixir\nconfig =\n  %{\n    ...\n    started_gps: {20.95991288388162, 107.06662537952286, 0}\n  }\n\n```\n\n### Load GPS from GPX file\n\nFor load GPS data just add a file path with supported wildcard by config `gpx_file`. Some configs are related to GPS can be ignored.\n\n```elixir\nconfig =\n    %{\n      worker: 3,\n      interval: :gpx_time,\n      gpx_file: \"data/*.gpx\"\n      callback: MyCallbackModule\n    }\n\nLocationSimulator.start(config)\n```\n\ninterval can match with gpx file by set interval to `:gpx_time` or set interval by an integer.\n\nIf you have multi GPX file matched with `gpx_file` worker will get file depended matched order and rotate if number of files is not enough for workers.\n\n## Example\n\nStart library in Elixir's shell:\n\n```bash\nmix deps.get\n\niex -S mix\n\niex(1)\u003e LocationSimulator.start()\n```\n\nFor writing callback module please go to `LocationSimulator.Event` document.\n\nWe provide simple demo that generate a GPX file. You can get from [repo](https://github.com/ohhi-vn/location_simulator/tree/main/example/generate_gpx)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohhi-vn%2Flocation_simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fohhi-vn%2Flocation_simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohhi-vn%2Flocation_simulator/lists"}