Hi,
DISCLAIMER: This might be a very niche problem peculiar to trying to mapping New Zealand territory with the GeoRegion object in SAS Viya 3.5 and Visual Analytics 8.5.2. The Map Service in use is OpenStreetMap. All data shown in screenshots are dummy data created just for illustration.
Quick Summary
We are trying to create a VA report with the GeoRegion object to map our business data to each of the regions defined by the shape files supplied by Statistics New Zealand (Stats NZ Geographic Data Service).
What We Need
We are looking for a way to instruct the VA GeoRegion map object to centre itself on the 180-degree line of longitude, and not the zero-degrees line of longitude, so that all of the territory of New Zealand appears together when the report opens. We would need to do this for all of our reports, not just as a one-off.
More Detailed Bits
New Zealand consists of four main islands, North Island, South Island, Stewart Island and The Chatham Islands.
The problem that we have seems to be due to The Chatham Islands being located on the other side of the 180-degree line of longitude, separate from the remainder of New Zealand, as shown in the screenshot below where the red vertical line is an approximation of the 180-degree line of longitude.
The result of this positioning is that, when we need to represent business data across all of New Zealand territory (including the Chatham Islands), the GeoRegion map opens to show the entire world map, with The Chatham Islands completely separated from the rest of the mapped instance New Zealand, as shown in the screenshot below.
We know that by simply filtering out the regions that make up The Chatham Islands our report opens nicely zoomed in to just the main body of New Zealand territory. However, our users must include The Chatham Islands in their reports, so filtering their data out is not an option.
We believe that this separation is happening because the GeoRegion map object draws the land masses in a left-to-right pattern from West 180-degrees (on the far left) to East 180-degrees (on the far right) and thus zero-degrees in the middle of the map.
We have tried several different projections offered by Statistics New Zealand to drive our Geographic Data Provider used for this report, but all of them, so far adopt this same layout (the example report above is using EPSG:4326).
I think that New Zealand may be the only country that has close-by territory (800kms in the case of The Chathams), but where territory is separated by the 180-degree line of longitude, but I am optimistic that someone out there has seen this problem and resolved it.
Any bright ideas out there, ironically, in the rest of the world ?😃
Many thanks,
Downunder Dave
Wellington
Hi Dave,
Yeah - that is caused by 360-degree longitude range being split in -180 .. 180 and unfortunately Chatham Isl being on the 'other side' of the longitude split. I guess they had to draw the line somewhere ;_)
Easiest work-around is to adjust the longitude values for the regions in questions. I have done a super quick test using the NZ SA's:
%let root=C:\SAS\Data\CustomShapes\NewZealand;
libname data "&root.";
/* Source: Stats NZ -> https://datafinder.stats.govt.nz/layer/111227-statistical-area-2-2023-generalised */
proc mapimport datafile="&root.\statistical-area-2-2023-generalised.shp" out=work.nz_sa_shapes;
id SA22023_V1;
run;
proc greduce data=work.nz_sa_shapes out=work.nz_sa_shapes;
id SA22023_V1;
run;
data data.nz_sa_shapes;
set work.nz_sa_shapes;
sequence = _n_;
/* make sure SA 'Oceanic Chatham Islands' appears on the same side as main land */
if sa22023_v1 in ('342900','343000') then do;
x = x + 360;
end;
where density < 2;
run;
Note, the adjustment for 'Chatham Islands' and related addition of 360 in order to 'move' them to the right side of the mainland. Not ideal - but should work for you. We are already doing similar special handling for some islands in Russia and Alaska - so I will feed this back to the R&D folks add that island to the list. If all goes well - this should be addressed in one of the map updates. But given you seem to already use custom shapes - the solution above should be straight forward.
Let us know how you go.
Downunder Falko
Brisbane
Hi Dave,
Yeah - that is caused by 360-degree longitude range being split in -180 .. 180 and unfortunately Chatham Isl being on the 'other side' of the longitude split. I guess they had to draw the line somewhere ;_)
Easiest work-around is to adjust the longitude values for the regions in questions. I have done a super quick test using the NZ SA's:
%let root=C:\SAS\Data\CustomShapes\NewZealand;
libname data "&root.";
/* Source: Stats NZ -> https://datafinder.stats.govt.nz/layer/111227-statistical-area-2-2023-generalised */
proc mapimport datafile="&root.\statistical-area-2-2023-generalised.shp" out=work.nz_sa_shapes;
id SA22023_V1;
run;
proc greduce data=work.nz_sa_shapes out=work.nz_sa_shapes;
id SA22023_V1;
run;
data data.nz_sa_shapes;
set work.nz_sa_shapes;
sequence = _n_;
/* make sure SA 'Oceanic Chatham Islands' appears on the same side as main land */
if sa22023_v1 in ('342900','343000') then do;
x = x + 360;
end;
where density < 2;
run;
Note, the adjustment for 'Chatham Islands' and related addition of 360 in order to 'move' them to the right side of the mainland. Not ideal - but should work for you. We are already doing similar special handling for some islands in Russia and Alaska - so I will feed this back to the R&D folks add that island to the list. If all goes well - this should be addressed in one of the map updates. But given you seem to already use custom shapes - the solution above should be straight forward.
Let us know how you go.
Downunder Falko
Brisbane
One of the things we've done in the past when trying to force regions into the same hemisphere, rather than looking at a specific identifier, which certainly works in this case, but to simply check the longitude value. If you want everything in the eastern hemisphere, then just do the +360 adjustment for any value of the longitude that is < 0. The only time this did not work well was dealing with Russia, which has a single land mass that spans the 180 meridian. Obviously, if you want everything to appear in the western hemisphere, do the opposite adjustment.
Hi Jeff,
Thank you too for your contribution. As you will see, you and Falko have offered the same solution and as you will see, I am delighted with my results.
Thank you for you help.
Downunder Dave
Wellington
Hi Falko,
This is fantastic, and just what was needed.
My SAS and non-SAS colleagues are delighted that The Chatham Islands have now been moved back to their correct location in the Pacific !
Many thanks for such a great solution and for showing the whole start-to-finish process in your posted code.
Downunder Dave
Wellington
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.