{"id":26848947,"url":"https://github.com/brycejohnston/ex_pyshp","last_synced_at":"2025-03-30T21:23:48.268Z","repository":{"id":284621937,"uuid":"955528282","full_name":"brycejohnston/ex_pyshp","owner":"brycejohnston","description":"Read and write shapefiles using pyshp from Elixir","archived":false,"fork":false,"pushed_at":"2025-03-26T19:54:29.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T20:43:47.396Z","etag":null,"topics":["elixir","pyshp","pythonx","shapefile"],"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/brycejohnston.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":"2025-03-26T19:28:33.000Z","updated_at":"2025-03-26T20:13:52.000Z","dependencies_parsed_at":"2025-03-26T20:44:36.607Z","dependency_job_id":"920ed465-46c6-4db9-80d7-4a37924c96db","html_url":"https://github.com/brycejohnston/ex_pyshp","commit_stats":null,"previous_names":["brycejohnston/ex_pyshp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brycejohnston%2Fex_pyshp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brycejohnston%2Fex_pyshp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brycejohnston%2Fex_pyshp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brycejohnston%2Fex_pyshp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brycejohnston","download_url":"https://codeload.github.com/brycejohnston/ex_pyshp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246380798,"owners_count":20767908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["elixir","pyshp","pythonx","shapefile"],"created_at":"2025-03-30T21:23:47.790Z","updated_at":"2025-03-30T21:23:48.255Z","avatar_url":"https://github.com/brycejohnston.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExPyshp\n\nRead and write shapefiles using [pyshp](https://github.com/GeospatialPython/pyshp) from Elixir with [pythonx](https://github.com/livebook-dev/pythonx).\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `ex_pyshp` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_pyshp, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Usage\n\n### Reading\n\n```elixir\n# Extract from the ZIP file and get list of files\nextraction_result = ExPyshp.extract(\"shp.zip\")\n\n# Process the extraction result and read each shapefile group\nshapefile_results =\n  case extraction_result do\n    {:ok, shapefile_pairs} -\u003e\n      # For each shapefile group, call read and capture the result in a list\n      Enum.map(shapefile_pairs, fn %{shp: shp_path, dbf: dbf_path, shx: shx_path} -\u003e\n        case ExPyshp.read(shp_path, dbf_path, shx_path) do\n          {:ok, base_name, data} -\u003e {:ok, base_name, data}\n          {:error, base_name, reason} -\u003e {:error, base_name, reason}\n        end\n      end)\n\n    {:error, reason} -\u003e\n      IO.puts(\"Error extracting shapefiles: #{reason}\")\n      []\n  end\n\n# Process and inspect each result:\nEnum.each(shapefile_results, fn\n  {:ok, base_name, shapefile_data} -\u003e\n    IO.inspect(shapefile_data, label: \"Shapefile data from #{base_name}\")\n  {:error, base_name, reason} -\u003e\n    IO.puts(\"Error reading shapefile for #{base_name}: #{reason}\")\nend)\n```\n\n### Writing\n\n```elixir\ndata = [\n  %{\n    \"record\" =\u003e %{\"name\" =\u003e \"Feature1\", \"value\" =\u003e 123},\n    \"geometry\" =\u003e %Geo.Point{coordinates: {1.0, 2.0}}\n  },\n  %{\n    \"record\" =\u003e %{\"name\" =\u003e \"Feature2\", \"value\" =\u003e 456},\n    \"geometry\" =\u003e %Geo.Point{coordinates: {3.0, 4.0}}\n  }\n]\n\nExPyshp.write(\"output_path\", \"name\", data)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrycejohnston%2Fex_pyshp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrycejohnston%2Fex_pyshp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrycejohnston%2Fex_pyshp/lists"}