Let me describe the scenario. I have to make a statistical maps for a bunch of countries. The FME workbench is going to use ESRI Reprojector to reproject the shape of given country to Lambert Azimuthal equal area and after generate regular grid. Is there any way FME can pick up automatically the values of central meridian, latitute of origin for the country that the map is going to be created ? Could the information about the country center be passed to the Reprojector automatically ? I would like to avoid situation where I have to manually pass the parameters each time the new country is going to be processed.
3 Answers
If you are not too attached to the ESRI reprojection engine the simplest solution is to use the CsmapReprojector instead. The _AZMEA_
dynamic coordinate system will automatically determine the origin point of each feature and reproject accordingly.
However, Alex Markov is on the right track when he suggests it is possible to use @Reproject to do this using the ESRI engine.
Assuming you have set central_meridian
and lat_origin
attributes on your features you can pass them to an FMEFunctionCaller transformer that contains this string:
@Reproject(ESRI,"ESRIWKT|GCS_WGS_1984|GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]","ESRIWKT|esri_azmea|PROJCS["esri_azmea",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",@Value(central_meridian)],PARAMETER["Latitude_Of_Origin",@Value(lat_origin)],UNIT["Meter",1.0]]",,Forward,--,NearestNeighbor,PreserveCells)
- Note the @Value function being used to substitute your origin values into the WKT string that represents the ESRI coordinate system.
- I generated the @Reproject parameters by creating an EsriReprojector with a specific input coordinate system and custom AZMEA target, then copied the transformer into a text editor to examine the underlying function.
- If you are not working with WGS84 data you will need to pass different WKT to @Reproject.
I think in order to get central meridian or latitute of origin we have to get centroid coordinates for our area of interest. Or may be min/max coordinates for all features. And then use this coordinates to calculate central meridian or latitute of origin.
I will try to describe main ideas:
- Take some input features from your map (roads, vegetation, etc). Or may be all of them.
- Generate one bounding box for all these features (for all roads, for example). In FME it can be done using BoundingBoxAccumulator transformer. Or instead of bounding box you can use ConvexHull polygon for more precise calculations. In FME: HullAccumulator.
- Extract centroid coordinates of this one polygon. FME: InsidePointExtractor. Or if you want to use min/max coordinates you can use BoundsExtractor transformer.
- Use centroid coordinates for your calculations to determine values of your central meridian, zone number and other needed values.
EDIT1 (answer to first comment):
As far as I see there is no straight way to link coordinate systems parameter in ESRIReprojector transformer to external parameter.
But I believe there is a possibility to use @Reproject function. It has parameter to choose ESRI reprojection engine. And all other parameters you can pass to it in run-time.
I think you can try to use transformer TCLCaller in order to use this function.
-
>from user6501 but edited the answer, not posted a comment< >Hello Alex, Thanks for an swift answer. I'm aware how to calculate the center point of my AOI. Maybe I was not too much clear in my original post but the problem actually is how to automatically pass the values of earlier calculated projection focal point (this is the case you describe) to reprojector trasnformer. Do i have to do it manually via parameterfetcher (would love to avoid it) or EsriReprojector can somehow pick up it automatically ?– Mapperz ♦Commented Mar 22, 2012 at 13:28
-
@user6501 Ok, I see. Some misunderstanding from my side :) I've added some info to my answer. Commented Mar 22, 2012 at 13:50
i would do it like this:
-input-->(calculations *1->point)---->reproject ->("other work done here" )-^
Where *1 ends with transformer which returns only one feature(x,y values) , which is then transformed to point and reprojected