Skip to content

Commit

Permalink
add wkt output to json format
Browse files Browse the repository at this point in the history
  • Loading branch information
kritibirda26 committed Aug 3, 2024
1 parent 13cebe6 commit fbde695
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion general/g.proj/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ void print_proj4(int dontprettify)
#ifdef HAVE_OGR
void print_wkt(int esristyle, int dontprettify)
{
JSON_Value *value;
JSON_Object *object;
char *outwkt;

if (check_xy(FALSE))
Expand Down Expand Up @@ -312,7 +314,17 @@ void print_wkt(int esristyle, int dontprettify)
#endif

if (outwkt != NULL) {
fprintf(stdout, "%s\n", outwkt);
switch (format) {
case JSON:
value = json_value_init_object();
object = json_object(value);
json_object_set_string(object, "wkt", outwkt);
print_json(value);
break;
default:
fprintf(stdout, "%s\n", outwkt);
break;
}
CPLFree(outwkt);
}
else
Expand Down

0 comments on commit fbde695

Please sign in to comment.