Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g.proj: Add JSON support #5419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NishantBansal2003
Copy link
Contributor

ref: #4104

This pull request integrates to add JSON output support to the g.proj module. With these changes, g.proj now supports output in JSON format when invoked with the -p, -j, or -w flags.

The behaviour is as follows:

  • -p flag:

    {
        "name": "Lambert Conformal Conic",
        "proj": "lcc",
        "datum": "nad83",
        "a": "6378137.0",
        "es": "0.006694380022900787",
        "lat_1": "36.16666666666666",
        "lat_2": "34.33333333333334",
        "lat_0": "33.75",
        "lon_0": "-79",
        "x_0": "609601.22",
        "y_0": "0",
        "no_defs": "defined",
        "unit": "Meter",
        "units": "Meters",
        "meters": "1"
    }
  • -j flag:

    {
        "proj4": "+proj=lcc +lat_1=36.16666666666666 +lat_2=34.33333333333334 +lat_0=33.75 +lon_0=-79 +x_0=609601.22 +y_0=0 +no_defs +a=6378137 +rf=298.257222101 +towgs84=0.000,0.000,0.000 +type=crs  +to_meter=1"
    }
  • -w flag:

    {
        "wkt": "PROJCRS[\"unknown\",\n    BASEGEOGCRS[\"grs80\",\n        DATUM[\"North American Datum 1983\",\n            ELLIPSOID[\"Geodetic_Reference_System_1980\",6378137,298.257222101,\n                LENGTHUNIT[\"metre\",1]],\n            ID[\"EPSG\",6269]],\n        PRIMEM[\"Greenwich\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8901]]],\n    CONVERSION[\"unnamed\",\n        METHOD[\"Lambert Conic Conformal (2SP)\",\n            ID[\"EPSG\",9802]],\n        PARAMETER[\"Latitude of false origin\",33.75,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8821]],\n        PARAMETER[\"Longitude of false origin\",-79,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8822]],\n        PARAMETER[\"Latitude of 1st standard parallel\",36.1666666666667,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8823]],\n        PARAMETER[\"Latitude of 2nd standard parallel\",34.3333333333333,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8824]],\n        PARAMETER[\"Easting at false origin\",609601.22,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8826]],\n        PARAMETER[\"Northing at false origin\",0,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8827]]],\n    CS[Cartesian,2],\n        AXIS[\"easting\",east,\n            ORDER[1],\n            LENGTHUNIT[\"metre\",1,\n                ID[\"EPSG\",9001]]],\n        AXIS[\"northing\",north,\n            ORDER[2],\n            LENGTHUNIT[\"metre\",1,\n                ID[\"EPSG\",9001]]]]"
    }

NOTES: The code changes are largely based on the modifications introduced in #4104 with additional tweaks to address all review comments.

Signed-off-by: Nishant Bansal <[email protected]>
@github-actions github-actions bot added Python Related code is in Python C Related code is in C module docs markdown Related to markdown, markdown files general tests Related to Test Suite CMake labels Mar 20, 2025
@NishantBansal2003
Copy link
Contributor Author

Could we re-run this CI? The error does not seem to be related.

Errors in:
/d/a/grass/grass/lib/db/dbmi_driver
/d/a/grass/grass/db/drivers/sqlite
/d/a/grass/grass/db/drivers/postgres
/d/a/grass/grass/db/drivers/dbf
/d/a/grass/grass/db/drivers/ogr
/d/a/grass/grass/db/drivers/odbc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Related code is in C CMake docs general markdown Related to markdown, markdown files module Python Related code is in Python tests Related to Test Suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant