Skip to main content

Hello,

I have a project that involves creating maps and custom outputs with the HTMLReportGenerator and would like some help with GeoJSON. I am utilizing custom code to add a second geojson layer to the map. is there a way to take an imported file (ex: ESRISHAPE) and convert it to geojson inline (maybe as an attribute?), and then use that geojson output(text) as a parameter in my custom code.

Edit:

A good example of a perfect geoJSON output is how the HTMLReportGenerator converts both attributes and geometry to geojson.

The GeometryExtractor can take the geometry of a feature and store that in an attribute, encoded as GeoJSON (or one of several other formats)


The GeometryExtractor can take the geometry of a feature and store that in an attribute, encoded as GeoJSON (or one of several other formats)

I tried this method, but I was only able to create an output of separate attributes consisting of GeoJSON that only represented the geometry of the feature.

 

 

 


You can use the JSONTemplater to create a JSON document conforming to the GeoJSON specifications, which contains a geometry string created with the GeometryExtractor and properties corresponding to feature attributes.

If you aren't familiar with the GeoJSON specifications, another way is:

  1. Once write the feature into a temporary GeoJSON dataset with a FeatureWriter (Format: GeoJSON),
  2. read it with a FeatureReader (Format: Text File, Read Whole File at Once: Yes) or an AttributeFileReader,
  3. then merge the GeoJSON document to the original feature.

Here, the TempPathnameCreator could be used effectively to make a temporary file path for saving the GeoJSON document. It's very convenient since FME will remove automatically the temporary file saved into the path created by the TempPathnameCreator after the translation completed.


You can use the JSONTemplater to create a JSON document conforming to the GeoJSON specifications, which contains a geometry string created with the GeometryExtractor and properties corresponding to feature attributes.

If you aren't familiar with the GeoJSON specifications, another way is:

  1. Once write the feature into a temporary GeoJSON dataset with a FeatureWriter (Format: GeoJSON),
  2. read it with a FeatureReader (Format: Text File, Read Whole File at Once: Yes) or an AttributeFileReader,
  3. then merge the GeoJSON document to the original feature.

Here, the TempPathnameCreator could be used effectively to make a temporary file path for saving the GeoJSON document. It's very convenient since FME will remove automatically the temporary file saved into the path created by the TempPathnameCreator after the translation completed.

I can always count on @takashi to save the day. Thank you.

 


You can use the JSONTemplater to create a JSON document conforming to the GeoJSON specifications, which contains a geometry string created with the GeometryExtractor and properties corresponding to feature attributes.

If you aren't familiar with the GeoJSON specifications, another way is:

  1. Once write the feature into a temporary GeoJSON dataset with a FeatureWriter (Format: GeoJSON),
  2. read it with a FeatureReader (Format: Text File, Read Whole File at Once: Yes) or an AttributeFileReader,
  3. then merge the GeoJSON document to the original feature.

Here, the TempPathnameCreator could be used effectively to make a temporary file path for saving the GeoJSON document. It's very convenient since FME will remove automatically the temporary file saved into the path created by the TempPathnameCreator after the translation completed.

Despite my efforts, I am still having a fair bit of trouble with this method. While finishing routing my features through the FeatureReader, i am trying to replace a portion of html_content with the string replacer; And it is successfully replacing the selected string with a blank value from the text_line_data. When I inspect the path from the FR to the StringReplacer, it shows that the text_line_data attribute is correctly written. I have provided the screen capture below to help explain what I am trying to do.

 

 


You can use the JSONTemplater to create a JSON document conforming to the GeoJSON specifications, which contains a geometry string created with the GeometryExtractor and properties corresponding to feature attributes.

If you aren't familiar with the GeoJSON specifications, another way is:

  1. Once write the feature into a temporary GeoJSON dataset with a FeatureWriter (Format: GeoJSON),
  2. read it with a FeatureReader (Format: Text File, Read Whole File at Once: Yes) or an AttributeFileReader,
  3. then merge the GeoJSON document to the original feature.

Here, the TempPathnameCreator could be used effectively to make a temporary file path for saving the GeoJSON document. It's very convenient since FME will remove automatically the temporary file saved into the path created by the TempPathnameCreator after the translation completed.

You have to merge the JSON document to the feature containing "html_content".

 

If the workspace processes just one feature always, you can merge the JSON to the feature unconditionally i.e. use the FeatureMerger with setting an identical constant (e.g. 1) to Join On for both Requestor and Supplier.

 

Otherwise, need to see the entire overview of the workspace to find an appropriate way.

 

 


Reply