Spatial Modeler Discussions

Gain, exchange, and share knowledge, or discuss topics with other Hexagon Geospatial Product pioneers and experts to get the most out of Hexagon Geospatial products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Frequent Contributor
Posts: 129
Registered: ‎11-10-2015
Accepted Solution

Geocoding data through Spatial Modeler operators

Hi,

 

Is it possible to connect to alphanuleric data through Spatial Modeler, create a new point geometry attribute, and populate this new geometry by geocoding process based on 2 numeric attributes from the alphanumeric sources?

 

If this operation is possible, has someone a .gmdx example?

 

Regards,

Benoît

Highlighted
Technical Evangelist
Technical Evangelist
Posts: 355
Registered: ‎02-03-2016

Re: Geocoding data through Spatial Modeler operators

If the two numeric attributes represent X/Y or lon/lat then you are referring to what GeoMedia calls "coordinate geocoding" rather than "address geocoding".  The functionality equivalent to the Geocode Coordinates command (and corresponding pipe) has not yet been made available in Spatial Modeler.  It would be reasonable to do so, and I would welcome the creation of an Idea to that effect on the Ideation board.  We would likely choose to implement it through a new expression function available in the Generate Functional Attributes operator, though we could also create a dedicated operator that uses GFA internally.

 

Others more knowledgeable of the complete set of offerings in Spatial Modeler may know of some other way to achieve your goal besides what I mention above.  - Hal

Highlighted
Frequent Contributor
Posts: 129
Registered: ‎11-10-2015

Re: Geocoding data through Spatial Modeler operators

Hi Hal,

 

Yes, it is exactly the need, an operator making the GeoCode Coordinates pipe query. For me, it is a very important operator, because a lot of input data doesn't contain geomerties, but prior coordinates

 

I will fill an Idea for it

 

Benoît

Highlighted
Technical Evangelist
Posts: 888
Registered: ‎10-01-2015

Re: Geocoding data through Spatial Modeler operators

[ Edited ]

A bit of experimentation has come up with a potential workflow. Or two.

 

If the data is in Excel spreadsheet format (as indicated in the Idea you posted) then you could save the spreadsheet to CSV and use the GeoCSV reader to convert to features with point geometries.

 

Otherwise I came up with the following. As an example I used a raster input which was a Clump result. So it contained attributes which represented the X Pixel, Y Pixel, X Map and Y Map coordinates of each clump (amongst other attributes). But you could instead be just reading a database table. I fed just the attributes from the raster to a Features Input operator which effectively converts the raster attribute table into a feature stream with just attributes (no geometries).  I then used a Remove Attributes to get rid of X Pixel and Y Pixel since they would just confuse matters. I wanted to make sure the X Map and Y Map values were the first numeric fields encountered. I then fed this feature stream to a Features Output to create a .csv temp file, but really all I wanted was the feature stream from that which has converted the X and Y coordinates into point geometries.

 

points.PNG

 

Does that help?

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Technical Evangelist
Posts: 888
Registered: ‎10-01-2015

Re: Geocoding data through Spatial Modeler operators

Oops - you do need ERDAS IMAGINE 2020 or Spatial Modeler 2020 to run the model I showed. Should be avaIilable in a couple of weeks! 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Frequent Contributor
Posts: 129
Registered: ‎11-10-2015

Re: Geocoding data through Spatial Modeler operators

Ian,

 

All the operators in the example below are available in 2018 version

 

I have used the following workflow to generate a .csv file :

  • Use GM to connect the sample data USSapleData.mdb
  • Work on the Cities (PointGeometry) feature class
  • Use GM Functional Attribute query to generate the X and Y coordinates from the geometry
  • Use the GM Attribute Selection query to keep only alphanumerics attributes (ID, name, name of state, X, Y)
  • Copy/Paste the query result from the GM DataWindow to Excel
  • Save the file in .csv using Excel

You will find the .csv file attached (zipped, .csv files can not be directly attached)

 

In Spatial Modeler, I have :

  • Read the .csv file using the Features Input operator
  • Create a new blank  .csv file using the Create Temp FileName
  • Export data in this new .csv file using the Features Output operator
  • Pluged a Feature Information operator before and after the Features Output operator

In both results, NO GEOMETRY is present, the Features Information has no PrimaryGeometryFieldName in the output ports

Geocode1.JPG

 

Can you make the same (plug a Feature Information operator after each operation) to be sure than you have no geometry after the Remove Attributes operator? Other test : can you execute your workflow on the .csv file attached to show me how to add a Point Geometry to this kind of data?

 

Regards,

Benoît

Highlighted
Technical Evangelist
Posts: 888
Registered: ‎10-01-2015

Re: Geocoding data through Spatial Modeler operators

Hi Benoît

 

I don't think you have a point CSV:

 

notCSV.PNG

 

 

Once you have your data formatted as a point GeoCSV all you should need to do is use Features Input to read it. Features Input should recongise appropriately named attribute columns(e.g. CoordX, CoordY) and turn them (and their attributes) directly into Features with geoemtry and other attributes. 

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Technical Evangelist
Posts: 888
Registered: ‎10-01-2015

Re: Geocoding data through Spatial Modeler operators

[ Edited ]

Is this a Locale thing with Windows? Decimal points (.) and commas (,) are getting swapped in floating point numbers, so semicolons ( ; ) are being used as a seperator instead of commas?

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Technical Evangelist
Posts: 888
Registered: ‎10-01-2015

Re: Geocoding data through Spatial Modeler operators

Yep, that was it. I used a text editor to replace , with . and then replaced ; with ,

 

I also added column titles, so everything in Excel now looks like this:

 

csv.PNG

 

And if I use Features Input I get point geometries:

 

geometries.PNG

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Highlighted
Frequent Contributor
Posts: 129
Registered: ‎11-10-2015

Re: Geocoding data through Spatial Modeler operators

Ian,

 

It is ok with correct separators. Sorry for it, I can visualize the point geometries

 

Regards

Benoît