Skip to main content
Solved

Table name of a SourceDataset geopackage in the command-line

  • July 22, 2020
  • 2 replies
  • 24 views

Hi,

Is it possible to see the table name of a SourceDataset geopackage in the command-line ?

I have a geopackage 'biotopes.gpkg' containing several biotopes tables.

The command-line only indicates the geopackage as source :

--SourceDataset_OGCGEOPACKAGE "E:\\biotopes.gpkg"

I would like to see something like

--SourceDataset_OGCGEOPACKAGE "E:\\biotopes.gpkg\\biotope1"

so I could choose the table of the geopackage in order to do some batch proccessing with a loop on the biotopes.

Any idea ?

 

Thanks.

Best answer by arnovananrooij

I have some python code that uploads a file to FME Server and then runs a webhook

 

 

filename = outfile
_file = os.path.basename(filename)
token = ""
fmehndlr = FMEHandler.FMEHandlerClass()
fmehndlr.filename = _file 
## set token
fmehndlr.token = token
## set upload location
fmehndlr.upurl = "http://000.00.0.103:8080/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_TEMP/filesys"
#### set parameter values
rowtype = name.replace(" ",'%20')
projectname = project.replace(" ",'%20')
projectnumber = projectnum.replace(" ",'%20')
scale = "1000"
dwgname = _file.replace('.gdb',"").replace('.zip',"")+".dwg"
dwgpath = os.path.join(projectfolder,dwgname)
## url for webhook with parameters in it, you have to set this before upload if used with the AP41 flag
fmehndlr.runurl = f"http://000.00.0:8080/fmedatastreaming/PlatFactory/conchoEasementCenterline.fmw?TEMPLATE=%24(FME_MF_DIR)CONCHO_TEMPLATE_CENTERLINE_EASEMENT.dwg&SCALE={scale}&SourceDataset_FILEGDB=%24(FME_SHAREDRESOURCE_TEMP)%2F{_file}&SPACE=PAGE%202%20OF%202&WIDTH={str(width)}&EASEMENT_TYPE={rowtype}&PROJECT_NAME={projectname}&PROJECT_NUMBER={projectnumber}&token=token"
### upload and print response status
resp = fmehndlr.upload(filename)
arcpy.AddMessage(resp.status_code)
if resp.status_code==201:
## run webhook and catch response
    resp = fmehndlr.runwebhook()
    arcpy.AddMessage(resp.status_code)
    if resp.status_code==200:
        fmehndlr.savefilestream(dwgpath,resp)

 

This code works fine on my machine but when I run it from another computer, after the file is uploaded to FME Server the webhook fails. This is what I don't understand, if the file is uploaded successfully and returns status 201 why is FME then refusing the webhook and returning status 401?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

arnovananrooij
Contributor
Forum|alt.badge.img+5
  • Contributor
  • 73 replies
  • Best Answer
  • July 22, 2020

I have some python code that uploads a file to FME Server and then runs a webhook

 

 

filename = outfile
_file = os.path.basename(filename)
token = ""
fmehndlr = FMEHandler.FMEHandlerClass()
fmehndlr.filename = _file 
## set token
fmehndlr.token = token
## set upload location
fmehndlr.upurl = "http://000.00.0.103:8080/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_TEMP/filesys"
#### set parameter values
rowtype = name.replace(" ",'%20')
projectname = project.replace(" ",'%20')
projectnumber = projectnum.replace(" ",'%20')
scale = "1000"
dwgname = _file.replace('.gdb',"").replace('.zip',"")+".dwg"
dwgpath = os.path.join(projectfolder,dwgname)
## url for webhook with parameters in it, you have to set this before upload if used with the AP41 flag
fmehndlr.runurl = f"http://000.00.0:8080/fmedatastreaming/PlatFactory/conchoEasementCenterline.fmw?TEMPLATE=%24(FME_MF_DIR)CONCHO_TEMPLATE_CENTERLINE_EASEMENT.dwg&SCALE={scale}&SourceDataset_FILEGDB=%24(FME_SHAREDRESOURCE_TEMP)%2F{_file}&SPACE=PAGE%202%20OF%202&WIDTH={str(width)}&EASEMENT_TYPE={rowtype}&PROJECT_NAME={projectname}&PROJECT_NUMBER={projectnumber}&token=token"
### upload and print response status
resp = fmehndlr.upload(filename)
arcpy.AddMessage(resp.status_code)
if resp.status_code==201:
## run webhook and catch response
    resp = fmehndlr.runwebhook()
    arcpy.AddMessage(resp.status_code)
    if resp.status_code==200:
        fmehndlr.savefilestream(dwgpath,resp)

 

This code works fine on my machine but when I run it from another computer, after the file is uploaded to FME Server the webhook fails. This is what I don't understand, if the file is uploaded successfully and returns status 201 why is FME then refusing the webhook and returning status 401?


  • Author
  • 1 reply
  • July 22, 2020

Hi

On the command line you can use any published parameter. By default only the Dataset of the source and the destionation is published. If you choose single merged feature type then also 'feature type to read' is published as a parameter.

 

So when you add a geopackage reader

You choose one table as an example

Then choose 'Single Merged Feature Type'

In the navigator you will see 2 published parameters.

This means you can use them both in a command line engine:

--SourceDataset_OGCGEOPACKAGE "C:\\Temp\\Delft\\BGT.gpkg" --FEATURE_TYPES "<quote>Pand <openparen>vlak<closeparen><quote>"

 

PLease keep in mind that if you choose another feature type to read it will have to have the same attributes in order to work.

Hi,

Thanks for your answer ; it works perfect with the 'single merged feature type' option !