https://github.com/brycejohnston/ex_pyshp

Read and write shapefiles using pyshp from Elixir

https://github.com/brycejohnston/ex_pyshp

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (6.4%) to scientific vocabulary

Keywords

elixir pyshp pythonx shapefile
Last synced: 5 months ago · JSON representation

Repository

Read and write shapefiles using pyshp from Elixir

Basic Info
  • Host: GitHub
  • Owner: brycejohnston
  • License: mit
  • Language: Elixir
  • Default Branch: master
  • Homepage:
  • Size: 10.7 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
elixir pyshp pythonx shapefile
Created 11 months ago · Last pushed 11 months ago
Metadata Files
Readme License

README.md

ExPyshp

Read and write shapefiles using pyshp from Elixir with pythonx.

Installation

If available in Hex, the package can be installed by adding ex_pyshp to your list of dependencies in mix.exs:

elixir def deps do [ {:ex_pyshp, "~> 0.1.0"} ] end

Usage

Reading

```elixir

Extract from the ZIP file and get list of files

extraction_result = ExPyshp.extract("shp.zip")

Process the extraction result and read each shapefile group

shapefileresults = case extractionresult do {:ok, shapefilepairs} -> # For each shapefile group, call read and capture the result in a list Enum.map(shapefilepairs, fn %{shp: shppath, dbf: dbfpath, shx: shxpath} -> case ExPyshp.read(shppath, dbfpath, shxpath) do {:ok, basename, data} -> {:ok, basename, data} {:error, basename, reason} -> {:error, basename, reason} end end)

{:error, reason} ->
  IO.puts("Error extracting shapefiles: #{reason}")
  []

end

Process and inspect each result:

Enum.each(shapefileresults, fn {:ok, basename, shapefiledata} -> IO.inspect(shapefiledata, label: "Shapefile data from #{basename}") {:error, basename, reason} -> IO.puts("Error reading shapefile for #{base_name}: #{reason}") end) ```

Writing

```elixir data = [ %{ "record" => %{"name" => "Feature1", "value" => 123}, "geometry" => %Geo.Point{coordinates: {1.0, 2.0}} }, %{ "record" => %{"name" => "Feature2", "value" => 456}, "geometry" => %Geo.Point{coordinates: {3.0, 4.0}} } ]

ExPyshp.write("output_path", "name", data) ```

Add shapefiles to zip archive

```elixir file_paths = [ "/path/to/file1.shp", "/path/to/file1.dbf", "/path/to/file1.shx" ]

case ExPyshp.archive("/output/directory", "shapefilearchive", filepaths) do {:ok, zippath} -> IO.puts("ZIP archive created at: #{zippath}")

{:error, reason} -> IO.puts("Failed to create ZIP archive: #{reason}") end ```

Owner

  • Name: bryce
  • Login: brycejohnston
  • Kind: user

GitHub Events

Total
  • Push event: 4
  • Create event: 2
Last Year
  • Push event: 4
  • Create event: 2

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

mix.exs hex
  • geo ~> 4.0
  • jason ~> 1.4
  • pythonx ~> 0.4.4
mix.lock hex