Question

Is it possible to plot lat/long from text file onto a map?

  • 13 August 2018
  • 6 replies
  • 23 views

Badge

Hi,

I have a list of lat/long points in a text file and I would like to see where they fall onto a map. Is it possible to plot them over an existing shp file? How would I do it?

Thank you!


6 replies

Badge +2

Hi @jitkam,

You can use a Vertex Creator to create points, depending on how your lat/long points are recorded in the text file, you may need to split these into separate x and y attributes first. How is each lat/long written? To plot them over an existing shapefile you will have to set them to the same Coordinate System using a CoordinateSystemSetter and then you should be able to view both the points and the shp file in the Data Inspector.

If your data is recorded as WKT e.g POINT (x,y) you could instead use the GeometryReplacer and set the Geometry Encoding to OGC Well Known Text.

Badge

Hi @jitkam,

You can use a Vertex Creator to create points, depending on how your lat/long points are recorded in the text file, you may need to split these into separate x and y attributes first. How is each lat/long written? To plot them over an existing shapefile you will have to set them to the same Coordinate System using a CoordinateSystemSetter and then you should be able to view both the points and the shp file in the Data Inspector.

If your data is recorded as WKT e.g POINT (x,y) you could instead use the GeometryReplacer and set the Geometry Encoding to OGC Well Known Text.

Thank you hollyatsafe,

 

I have converted my file to excel to separate x from y. I am using the same coordinate system for my map as the lat/long in this file, so that is not an issue.

 

I have used the Vertex Creator, but all of the excel features were rejected. Could you please let me know how exactly should I plug in the shapefile with my map and the excel with the coordinates to be able to plot it in one file?

 

Thank you

 

 

 

Badge +2
Thank you hollyatsafe,

 

I have converted my file to excel to separate x from y. I am using the same coordinate system for my map as the lat/long in this file, so that is not an issue.

 

I have used the Vertex Creator, but all of the excel features were rejected. Could you please let me know how exactly should I plug in the shapefile with my map and the excel with the coordinates to be able to plot it in one file?

 

Thank you

 

 

 

Hi @jitkam,

 

Are you able to provide a sample of your text file or excel sheet so I can see why the data may have been rejected from the Vertex Creator?

 

Is the shapefile you are trying to write these points to also made up of point geometry. Since you have said it is a map it doesn't sound like it but shapefiles can only store a single geometry type so if not then you will have to write the points out to a new layer, however you should still be able to view these layers together. It would be useful if you could also provide a sample dataset of the shapefile you are working with and I can take a look at the best way to go about this.
Badge
Hi @jitkam,

 

Are you able to provide a sample of your text file or excel sheet so I can see why the data may have been rejected from the Vertex Creator?

 

Is the shapefile you are trying to write these points to also made up of point geometry. Since you have said it is a map it doesn't sound like it but shapefiles can only store a single geometry type so if not then you will have to write the points out to a new layer, however you should still be able to view these layers together. It would be useful if you could also provide a sample dataset of the shapefile you are working with and I can take a look at the best way to go about this.
Hi @hollyatsafe,thank you for your help, here are both datasets samples.

 

thank you!

 

fme-issue-sample.xlsx

 

archive.zip

 

Badge +2
Hi @hollyatsafe,thank you for your help, here are both datasets samples.

 

thank you!

 

fme-issue-sample.xlsx

 

archive.zip

 

Hi @jitkam,

 

As first suggested you should definitely be able to create points from your excel sheet using the VertexCreator followed by the CoordinateSystemSetter, setting your CS to LL-WGS84 the same as the shapefile. You will be able to view these two layers on top of each other in the Data Inspector by exposing the fme_dataset under Format Attributes in both of the readers, routing both the outputs to an Inspector and setting the Group By parameter to the fme_dataset (alternatively just adding an Inspector to the end of the CSS and the shapefile should work the same).

 

In the Inspector if the points are two small to see you can change the point size and colour in the Display Control > right click on the layer > select drawing style

 

However as suspected since the it is polygon vs point with different schemas you will not be able to write the points out to the same layer as a shapefile. However you should be able to write the points out to a new shapefile and can work with both of those together. Alternatively if you want both layers to be contained in a single file you could write them out to for example .gdb however they would still be two separate layers. Hopefully that all makes sense!
Badge +4

Run this and you can see the pointfeatures on top of your shape features.

sample.fmwt

Reply