You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Check whether network access for [resource file download](https://proj.org/resource_files.html#where-are-proj-resource-files-looked-for) is currently enabled or disabled.
@@ -544,7 +549,14 @@ impl Proj {
544
549
let south = unsafe{ out_south_lat_degree.assume_init()};
545
550
let east = unsafe{ out_east_lon_degree.assume_init()};
546
551
let north = unsafe{ out_north_lat_degree.assume_init()};
547
-
let name = unsafe{ out_area_name.assume_init()};
552
+
let name = unsafe{
553
+
let name = out_area_name.assume_init();
554
+
if !name.is_null(){
555
+
Some(_string(name)?)
556
+
}else{
557
+
None
558
+
}
559
+
};
548
560
549
561
let area = if west != -1000.0 && south != -1000.0 && east != -1000.0 && north != -1000.0
550
562
{
@@ -557,12 +569,36 @@ impl Proj {
557
569
}else{
558
570
None
559
571
};
560
-
let name = if !name.is_null(){
561
-
Some(_string(name)?)
572
+
Ok((area, name))
573
+
}
574
+
}
575
+
576
+
fnpj_info(&self) -> PjInfo{
577
+
unsafe{
578
+
let pj_info = proj_pj_info(self.c_proj);
579
+
let id = if pj_info.id.is_null(){
580
+
None
562
581
}else{
582
+
Some(_string(pj_info.id).expect("PROJ built an invalid string"))
583
+
};
584
+
let description = if pj_info.description.is_null(){
563
585
None
586
+
}else{
587
+
Some(_string(pj_info.description).expect("PROJ built an invalid string"))
564
588
};
565
-
Ok((area, name))
589
+
let definition = if pj_info.definition.is_null(){
590
+
None
591
+
}else{
592
+
Some(_string(pj_info.definition).expect("PROJ built an invalid string"))
593
+
};
594
+
let has_inverse = pj_info.has_inverse == 1;
595
+
PjInfo{
596
+
id,
597
+
description,
598
+
definition,
599
+
has_inverse,
600
+
accuracy: pj_info.accuracy,
601
+
}
566
602
}
567
603
}
568
604
@@ -571,8 +607,7 @@ impl Proj {
571
607
/// # Safety
572
608
/// This method contains unsafe code.
573
609
pubfndef(&self) -> Result<String,ProjError>{
574
-
let rv = unsafe{proj_pj_info(self.c_proj)};
575
-
_string(rv.definition)
610
+
Ok(self.pj_info().definition.expect("proj_pj_info did not provide a definition"))
576
611
}
577
612
578
613
/// Project geodetic coordinates (in radians) into the projection specified by `definition`
0 commit comments