stata-geoflow

A Stata module for generating spatial flow arcs.

https://github.com/asjadnaqvi/stata-geoflow

Science Score: 44.0%

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

  • CITATION.cff file
    Found 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 (13.8%) to scientific vocabulary

Keywords

ado arcs flow geo networks spatial stata
Last synced: 6 months ago · JSON representation ·

Repository

A Stata module for generating spatial flow arcs.

Basic Info
  • Host: GitHub
  • Owner: asjadnaqvi
  • License: mit
  • Language: Stata
  • Default Branch: main
  • Homepage:
  • Size: 1.05 MB
Statistics
  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 1
Topics
ado arcs flow geo networks spatial stata
Created about 1 year ago · Last pushed 11 months ago
Metadata Files
Readme License Citation

README.md

StataMin issues license Stars version release

Installation | Syntax | Examples | Feedback | Disclaimer | Change log


geoflow_banner

geoflow v1.0

(12 Jan 2025)

A Stata module for generating spatial flow arcs.

Installation

The package can be installed via SSC or GitHub. The GitHub version, might be more recent due to bug fixes, feature updates etc, and may contain syntax improvements and changes in default values. See version numbers below. Eventually the GitHub version is published on SSC.

The SSC version (v1.0):

stata ssc install geoflow, replace

Or it can be installed from GitHub (v1.0):

stata net install geoflow, from("https://raw.githubusercontent.com/asjadnaqvi/stata-geoflow/main/installation/") replace

Install the following dependencies:

stata ssc install graphfunctions, replace

Additional code for the maps shown below:

```stata ssc install schemepack, replace set scheme white_tableau

graph set window fontface "Arial Narrow" ```

Citation guidelines

Software packages take countless hours of programming, testing, and bug fixing. If you use this package, then a citation would be highly appreciated:

Click here for the latest SSC citation.

otherwise the following BibTeX citation can be used:

BibTeX @software{geoflow, author = {Naqvi, Asjad}, title = {Stata package ``geoflow''}, url = {https://github.com/asjadnaqvi/stata-geoflow}, version = {1.0}, date = {2025-01-12} }

Syntax

```stata geoflow numvar [if] [in] {using}, from(varname) to(varname) key(var) saving(filename) [ replace cuts(num) top(num) points(num) ]

```

The package assumes that the users have the following two files:

  • file1: This file should contain a numeric numvar flow variable defined by from() and to() identifiers. This file should already be loaded before using the command.
  • file2: This file should contain a unique key() variable for which coordinates are defined and can be merged with from() and to() variables in file1.

The coordinates should be in the form _CX and _CY. These are generated by default if spshape2dta is used.

See help geoflow for details.

Examples

Get the global boundary data using the latest version of the geoboundary package:

stata geoboundary WLD, replace convert remove source(worldbank)

Clean it up a up since ISO3 values have duplicates due to territories:

``` use WBADM0, clear duplicates list ISOA3 drop if ISOA3=="-99" drop if TYPE=="Dependency" drop if inlist(WBA3, "BES", "TKL")

compress save iso_meta, replace ```

This create our master node attributes file that also contains the coordinates.

Load the sample trade data file derived from COMTRADE BACI for 2022:

use "https://github.com/asjadnaqvi/stata-geoflow/blob/main/GIS/baci_2022.dta?raw=true", clear

Create flow arcs for the top 20 values:

stata geoflow value using iso_meta, from(ex_iso3) to(im_iso3) key(ISO_A3) top(20) save(links) geoframe replace mark

Also see return list that stores the radius value in local r(georadius). Since we specified the geoframe option, we can view the data by switching to this frame: frame change links.

Now create another frame that contains the boundaries and the node attributes:

stata geoframe create metadata iso_meta, replace shp(WB_ADM0_shp)

Note here that we are using the our cleaned up file for the attributes. You can view the data by switching to this frame frame change metadata.

Plot the information:

stata geoplot /// (area metadata i.REGION_WB, color(%40) lw(0.1) lc(white)) /// (line links i._ID, lwidth(0.4) color(black) ) /// (point metadata [w=GDP_MD_EST] if _mark==1, color(white%95) msize(1.6) mlcolor(black) ) /// (label metadata ISO_A3 if _mark==1, color(black) size(1.5) ) /// , tight legend(pos(7)) /// title("Top 20 trade flows in 2022") note("Source: COMTRADE BACI")

Feedback

Please open an issue to report errors, feature enhancements, and/or other requests.

Change log

v1.0 (12 Jan 2025) - First release

Owner

  • Name: Asjad Naqvi
  • Login: asjadnaqvi
  • Kind: user
  • Location: Vienna
  • Company: WIFO

Vienna, Austria

Citation (CITATION.cff)

cff-version: 1.2.0
authors:
- family-names: "Naqvi"
  given-names: "Asjad"
title: "Stata package ``geoflow''"
version: 1.0
date-released: 2025-01-12
url: "https://github.com/asjadnaqvi/stata-geoflow"

GitHub Events

Total
  • Release event: 1
  • Watch event: 3
  • Push event: 3
  • Public event: 1
  • Fork event: 2
  • Create event: 3
Last Year
  • Release event: 1
  • Watch event: 3
  • Push event: 3
  • Public event: 1
  • Fork event: 2
  • Create event: 3

Issues and Pull Requests

Last synced: 11 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