Solved

Can I use PythonCaller for Coverage/annotation import?


Hi!

 

I hope you can help with this very basic problem of mine..(although too much to handle for me).

 

So, what I want to do is load data into a sde database. It´s annotations, in coverage format. And what I have seen so far of the result when I only use a simple ”in-data to out-data”-workspace in FME is that the texts don´t end up in a correct way. There are overlaps for example. Then I thought that the only way to do it correctly is with the ”Import Coverage”-tool in ArcGIS. So I created a simple Model Builder model which I then exported to a python script. Below is a screen shot of the model and further down is the script.

 

Script from model export:

# Import arcpy module

import arcpy

 

# Local variables:

tx_24_annotation_tx_24 = "D:\\\\Vagkarta\\\\Shape\\\\vk_24_Sweref_99_TM_shape\\\\vagk\\\\24\\\\tx_24\\\\annotation.tx_24"

tx_25_annotation_tx_25 = "D:\\\\Vagkarta\\\\Shape\\\\vk_25_Sweref_99_TM_shape\\\\vagk\\\\25\\\\tx_25\\\\annotation.tx_25"

sde_gsd_GNG_vk_tx_anno_modelb = "O:\\\\Kartor\\\\Vagkarta\\\\Anslutning till dsgeosecma_sde_gsd@gng.sde\\\\sde_gsd.GNG.Johan_Anders_test_Vagkarta\\\\sde_gsd.GNG.vk_tx_anno_modelb"

 

# Process: Import Coverage Annotation

arcpy.ImportCoverageAnnotation_conversion("D:\\\\Vagkarta\\\\Shape\\\\vk_24_Sweref_99_TM_shape\\\\vagk\\\\24\\\\tx_24\\\\annotation.tx_24;D:\\\\Vagkarta\\\\Shape\\\\vk_25_Sweref_99_TM_shape\\\\vagk\\\\25\\\\tx_25\\\\annotation.tx_25", sde_gsd_GNG_vk_tx_anno_modelb, "100000", "CLASSES_FROM_LEVELS", "NO_MATCH", "REQUIRE_SYMBOL", "STANDARD", "", "AUTO_CREATE", "AUTO_UPDATE")

 

 

 

 

 

This is a part of a load process and I would like the whole process to be in the FME workspace, so I thought the PythonCaller could help. But I understand now that I can´t use the script in the form it is above (copy the script in the .py-file and paste in to PythonCaller). I also want to be clear with one thing: I´m totally new to Python, that´s why I seek basic assistance. I read som documents about Python in FME but I just can´t incorporate that into how I should write the script in a proper way. I guess there should be some corrections and adjustments to make it work. For example import fmeobjects and some "def" or "class"? And is it even possible when the script consists of two feature classes (the in-data)?

Also, I don´t understand what to write in the ”Class or Function to Process” box either. As I said, Python is new to me.

 

I hope you understand what I’m trying to do. Perhaps I don´t even need to use the PythonCaller or Model Builder.

 

Thanks in advance

Johan

icon

Best answer by markatsafe 1 June 2020, 18:22

View original

4 replies

Badge +2

@johanb as far as I can tell the import coverage annotation tools converts an ArcInfo Coverage to Geodatabase. So I think you could probably use the FME Coverage reader and the Geodatabase writer.

 

This might be worth discussing in more detail with your FME provider's support team if the FME annotation placement doesn't give you what you need. Or include some sample data and expected results here.

@markatsafe Ok, but that's exactly what I tried at first. At least I think it was. Here's the workspace I used at the beginning:

That resulted in these annotations:

 

Here's what it looks like when I add the original coverage file to the map:

 

So, that's the reason I tried the tool in ArcMap which gave a better result. And another "funny" thing is that when I tried the Python solution it resulted in errors BUT when I checked the database it had the annotations loaded into it. And it looked ok. But as I've mentioned, it would be nice to know how to avoid the errors in any case.

/ Johan

Badge +2

@johanb From you images, it looks like it might be text justification is getting lost in translation. But there might be other subtleties. There were three types of Arc Coverage text - see the FME documentation. Annotation in Geodatabase is also complex.

There is no direct alignment between Arc Coverage Text justification (represented as e00_text_just in FME) and the annotation alignment in Geodatabase (represented as geodb_h_align & geodb_v_align in FME).

So you probably need to build a lookup between the e00_text_just & try and map those 12 possible value to geodb_h_align & geodb_v_align (left, right, center, full & baseline, bottom, center, top).

Use data inspector to look at your Coverage text features to see if the e00_text_just varies and then set the equivalent geodb_h_align & geodb_v_align values

(assuming it is text justification that is the problem!)

@johanb From you images, it looks like it might be text justification is getting lost in translation. But there might be other subtleties. There were three types of Arc Coverage text - see the FME documentation. Annotation in Geodatabase is also complex.

There is no direct alignment between Arc Coverage Text justification (represented as e00_text_just in FME) and the annotation alignment in Geodatabase (represented as geodb_h_align & geodb_v_align in FME).

So you probably need to build a lookup between the e00_text_just & try and map those 12 possible value to geodb_h_align & geodb_v_align (left, right, center, full & baseline, bottom, center, top).

Use data inspector to look at your Coverage text features to see if the e00_text_just varies and then set the equivalent geodb_h_align & geodb_v_align values

(assuming it is text justification that is the problem!)

@markatsafe Thanks, that did it. After some testing (in workbench) and comparing (in the data inspector) I managed to get the annotations where I wanted them. I used the Attribute manager to assign values to "h_align" and "v_align", based on values in "text_just". It takes a lot of time to write to the database though. But probably that's normal, since it's annotations and also a lot of objects?

/ Johan

Reply