I am reading a table in from a Microsoft SQL database with a MSSQL_ADO Reader. The table has longitude and latitude attributes, read in as float data type. I would like to write this table into a geojson format, where the geometry of each feature is defined by the longitude and latitude coordinates. I have tried using a VertexCreator Transformer, but when I then write the table to a geojson, the geometry feature is null in the whole file. What do I need to do so the geojson writer writes non-null geometries?
Hi @vedika , I think the GeoJSON writer should write correct geometry if you have created point geometry with the VertexCreator successfully.
Did you check if the VertexCreater created point geometry correctly?
Just to confirm, are you setting the coordinate system on the writer or using a CoordinateSystemSetter after creating the points? I wonder if this is being caused by the lack of a coordinate system since the reader is non-spatial (unless you are reading from MS SQL Spatial?).
If you aren't specifying a coordinate system, could you try setting it with the CoordinateSystemSetter and checking the output again? If that doesn't work, you might want to check the Feature Information window (either in an Inspector or using Visual Preview) to confirm that the geometry is being created correctly.
Hi Takashi! Thank you for your response.
I believe the VertexCreator has created point geometries correctly because it says only a small portion of the rows were Rejected. How/where is the created point geometry stored in the output? I don't see a new attribute with the point geometry.
Thank you Chris at Takashi! I figured this out. There was a coordinate system, and the vertexcreator was working correctly. However, I merged the output of the VertexCreator with another dataset, and chose the Feature Merge Type as Attributes Only. I believe this was dropping the geometries created by the VertexCreator. When I changed this to Attributes and Geometry, this worked correctly! My mistake.
Thank you Chris at Takashi! I figured this out. There was a coordinate system, and the vertexcreator was working correctly. However, I merged the output of the VertexCreator with another dataset, and chose the Feature Merge Type as Attributes Only. I believe this was dropping the geometries created by the VertexCreator. When I changed this to Attributes and Geometry, this worked correctly! My mistake.
Good to hear you have solved the issue :-)
By the way, if it was a case where the FeatureMerger merges Supplier to Requester by 1:1, you can also swap the input connections, i.e. you can send the point features to the Requester port, send the other features to the Supplier port, and reset "Attributes Only" to the Feature Merge Type parameter.