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

OGR/GMT: Error when parsing strings that contain the special @ characters #7712

Closed
seisman opened this issue Aug 11, 2023 · 0 comments · Fixed by #7713
Closed

OGR/GMT: Error when parsing strings that contain the special @ characters #7712

seisman opened this issue Aug 11, 2023 · 0 comments · Fixed by #7713
Labels
bug Something isn't working
Milestone

Comments

@seisman
Copy link
Member

seisman commented Aug 11, 2023

Description of the problem

Original reported in GenericMappingTools/pygmt#2592 (comment).

pygmt-2m6nvbqu.gmt.txt

Attached above is an OGR/GMT file generated by the Fiona package. The first few lines of the file are:

# @VGMT1.0 @GPOLYGON
# @R-4506555.399/-3052902.89568/3804018.88695/5612191.52675               
# @Je3857
# @Jp"+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs"
# @Jw"PROJCS[\"WGS 84 / Pseudo-Mercator\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Mercator_1SP\"],PARAMETER[\"central_meridian\",0],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],EXTENSION[\"PROJ4\",\"+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs\"],AUTHORITY[\"EPSG\",\"3857\"]]"
# @NNPOINTS
# @Tstring
# FEATURE_DATA
>

Plotting the file (gmt plot pygmt-2m6nvbqu.gmt -pdf map) results in errors:

gmtinfo [ERROR]: Bad OGR/GMT: @n not allowed before FEATURE_DATA
plot [ERROR]: Bad OGR/GMT: @n not allowed before FEATURE_DATA

The error is because GMT incorrectly parse the @null string as an invalid ORG/GMT code (@n).

System information

  • Operating system: Linux
  • GMT version (gmt --version): 6.4.0
@seisman seisman added the bug Something isn't working label Aug 11, 2023
PaulWessel added a commit that referenced this issue Aug 11, 2023
Closes #7712. Must allow strings starting with @ once the initial line-check finds a @ code.
@seisman seisman added this to the 6.5.0 milestone Aug 11, 2023
PaulWessel added a commit that referenced this issue Aug 11, 2023
* Check if @n etc is at start of OGR/GMT line

Closes #7712. Must allow strings starting with @ once the initial line-check finds a @ code.

* Update gmt_io.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant