GeoMedia Discussions

Search for an answer, post a question, or answer other users' questions in our GeoMedia support discussions. This discussion board is a great way to collaborate with industry peers around the world. It is intended for discussion and support of the GeoMedia Desktop and Add-on applications.
Showing results for 
Search instead for 
Do you mean 
Occasional Contributor
Posts: 5
Registered: ‎08-07-2017
Accepted Solution

How to use the SpatialQueryPipe in GeoMedia automation to perform a spatial query?



I'm trying to automate a spatial query in Geomedia. From the docs it looks like a spatial query pipe is the correct pipe/service to use, but the documentation seems to be missing some key details. There only seems to be a definition for the SpatialQueryPipe in the GeoMedia Object Reference manual. I can't seem to find the section of the manual that lists the methods, properties and example use cases of the object (like the pages that there are for other pipes and services). Normally the missing details would be under a page titled something like "SpatialQueryPipe Object".


The definition of the SpatialQueryPipe from the Reference Manual:

Spatial Query Pipe


The SpatialSubsetPipe Object (SSP) is probably the closest in terms of properties and functionality that I could find, so I tried to set up a test case with the SpatialQueryPipe based on what I found on the SSP, but I could not assign anything to the listed properties without getting an error [sorry, I don't have the exact error message right now, but it's in regard to the property not being valid]. To use the pipe I was using a bit of code like:


SQP = GeoApp.CreateService("Geomedia.SpatialQueryPipe")
SQP.FirstRecordset = myrecordsetobj # <--- errors here with a msg about FirstRecordset not being a recognised property
print SQP.SpatialOperator # errors here too... throws an error for all properties

Which works well for all the other pipes/services I've tested (SpatialSubsetPipe, OutputToTableService, EquijoinPipe, BufferPipe etc.)



So, is there a working example I can inspect and try out? Is this the correct pipe/service to use for "spatial queries" i.e. queries where you want to get all the line sections that are contained by (or touch) an area polygon? I initially thought that the SPP would do it, but it doesn't output any results except for when I negate the query (use the NOT operator) and then I get the entire input recordset back, so it's clearly not the same as the "spatial query" one can perform using the GUI. 


Technical Evangelist
Posts: 567
Registered: ‎09-11-2015

Re: How to use the SpatialQueryPipe in GeoMedia automation to perform a spatial query?



SpatialQueryPipe object has been deprecated. If there are some notes about it in the on-line documentation, then it is a help bug. The object has been replaced by SpatialSubsetPipe, and for some cases with SpatialIntersectionPipe and SpatialDifferencePipe. If you want to get all geometries, which are in a sptaial relation with one given polygon, you can either set the sptaial filter property on an OriginatingPipe, or you can use SpatialSubsetPipe. If the polygon is stored somewhere in the database, you can filter the "filter recordset" to get that particular record. If the polygon is not in your data, for example you want a window extent or whatever, you can use CustomDataPipe, to create "in-memory" recordset and use it as the filter in SpatialSubsetPipe.



Occasional Contributor
Posts: 5
Registered: ‎08-07-2017

Re: How to use the SpatialQueryPipe in GeoMedia automation to perform a spatial query?

Thanks for clearing up the details around the SpatialQueryPipe. I'm using the help file "GeoMediaObjectReference_Help.chm" which looks like it references some online pages, but yea I didn't see a remark indicating that the pipe had been deprecated when I tried a search.


It turns out that my earlier SSP queries were in fact working (after trying to display them in a map view). I was initially just checking the datawindow view and doing a check with the RecordCount property and both were showing zero records were being outputted, but after displaying the results in the map window the records suddenly appear in the data view.