OnlineMapMaker

TXT to Map: Convert Text Coordinates Into a Map

Open a .txt file with coordinates, or paste the lines. The tool finds the separator and the X and Y columns, shows every point on a map, and converts the file to point features you can download as Shapefile, GeoJSON, KML or CSV. It reads latitude and longitude, UTM and other projected XY coordinates. Open fullscreen ↗

Rate this tool:
Advertisement
Advertisement
Loading…
Need assistance with your GIS project?Explore Our Services

Display coordinates on a map from a text file

A text file is the oldest way to pass coordinates around. A GPS logger writes one, a total station exports one, a script prints one, and a colleague types one in Notepad. There is no standard for it: one file uses spaces, the next uses commas or semicolons, some have a header line and many do not. That is why loading such a file into a map program often takes longer than collecting the points.

This tool reads the text the way a person would. It skips comment lines, finds the separator, keeps a name such as Frankfurt am Main in one cell, and looks for the coordinate columns by their names (Latitude, lon, X, Easting, Rechtswert) or, when there is no header, by the numbers themselves. If the numbers are metres and not degrees, it asks you for the coordinate system before it draws anything.

I built it for the moment when someone sends you a file called points.txt and asks where those points are. You see the answer on the map in a few seconds, you can check the rows in a table, and you can hand back a real GIS file. The file is read in your browser and is never uploaded.

How to convert a TXT file with XY coordinates to point features

A point feature is a point with a position and a row of attributes, the way GIS software stores it. To turn the lines of a text file into point features with this tool:

  1. Click "Open TXT file" and choose your file, or drop it on the map.
  2. Check the separator and the first row in the File panel.
  3. Check that the X column holds the longitude or easting and the Y column the latitude or northing.
  4. Choose the coordinate system. For UTM, enter the zone and the hemisphere.
  5. Look at the points on the map. If they are in the wrong place, swap X and Y or change the coordinate system.
  6. Download the point features as Shapefile, GeoJSON or KML.

Every column of the text file becomes an attribute of the point. The Shapefile download is a ZIP with the .shp, .shx, .dbf, .prj and .cpg files, written in WGS84.

The same job in QGIS, ArcGIS Pro and Google Earth

QGIS. Use Layer > Add Layer > Add Delimited Text Layer. Choose the file, set "Custom delimiters" to match it, pick the X field and Y field, and set the geometry CRS. Then right-click the layer and use Export > Save Features As to write a Shapefile or GeoPackage.

ArcGIS Pro. Add the table to the project, then run the "XY Table To Point" geoprocessing tool. Select the X field and Y field and the coordinate system of the numbers. The result is a point feature class.

Google Earth. Google Earth needs latitude and longitude. Convert the file to KML here, then open the KML file in Google Earth. This also works for UTM files, because the download is already converted to WGS84.

With Python or GDAL

When the conversion has to run again and again, a script is the better choice. Both examples read a file in UTM zone 33 north.

# Python: read a text file and write a point Shapefile
import pandas as pd
import geopandas as gpd

# sep=None lets pandas find the separator; use sep=r"\s+" for spaces
df = pd.read_csv("points.txt", sep=None, engine="python", comment="#")
gdf = gpd.GeoDataFrame(
    df,
    geometry=gpd.points_from_xy(df["Easting"], df["Northing"]),
    crs="EPSG:32633",  # UTM zone 33 north
)
gdf.to_crs("EPSG:4326").to_file("points.shp")
# GDAL / OGR: comma separated text file to Shapefile in WGS84
ogr2ogr -f "ESRI Shapefile" points.shp CSV:points.txt \
  -oo X_POSSIBLE_NAMES=Easting -oo Y_POSSIBLE_NAMES=Northing \
  -s_srs EPSG:32633 -t_srs EPSG:4326

My take: use this page to check a file and convert it once, and use a script when the same export arrives every week.

Advertisement
Advertisement

Which text files work

The rule is simple: one point per line, with the same order of values in every line. Below are the first lines of the two sample files of this page, one with latitude and longitude separated by spaces and one with UTM XY coordinates separated by commas.

# Sample text file: cities with WGS84 decimal degrees, separated by spaces
Name Latitude Longitude Country
Berlin 52.5200 13.4050 Germany
Frankfurt am Main 50.1109 8.6821 Germany
Madrid 40.4168 -3.7038 Spain
PointID,Easting,Northing,Description
P01,389918.04,5819699.13,Brandenburg Gate
P02,389820.98,5819962.26,Reichstag
P03,392081.07,5820156.19,TV Tower
Column separator
Spaces, tabs, commas, semicolons or the pipe character |. It is detected automatically, and you can change it in the File panel.
Header line
Optional. The tool treats the first line as column names when it does not hold numbers in the same places as the second line.
Comments and title lines
Lines that start with # or // are ignored. For other title lines at the top of the file, set "Skip lines".
Names with spaces
In a space-separated file, neighbouring words are joined into one cell. Text in double quotes is also kept together.
Number formats
Decimal point or decimal comma (52.5200 or 52,5200), hemisphere letters (48.8566N 2.3522E) and degrees-minutes-seconds (48°51'24"N). Do not use thousands separators.
File types and size
.txt, .xyz, .dat, .pts, .csv and .tsv files up to 30 MB, or text pasted into the tool.

Degrees-minutes-seconds written with spaces, such as 48 51 24 N, are read correctly only when the columns are separated by tabs, commas or semicolons. With spaces as the separator, every number becomes its own column.

XY or latitude and longitude: choose the right coordinate system

The text file holds only numbers. It does not say what they mean, so this is the one choice that you have to get right.

Latitude / longitude (WGS84)
Degrees, latitude between −90 and 90, longitude between −180 and 180. In XY terms, X is the longitude and Y is the latitude. This is chosen automatically when the numbers fit.
UTM
Metres in one of 60 zones. The easting (X) usually has six digits and the northing (Y) up to seven. The file rarely names the zone, so ask the person who made it.
Web Mercator (EPSG:3857)
Metres used by web maps. Values reach about 20,037,508 in both directions.
Custom (PROJ string)
For a national grid or a local system, paste its PROJ definition. You can find the definition of an EPSG code on epsg.io.
Signs of a wrong choice
Points in the ocean or on another continent usually mean that X and Y are swapped. A shift of exactly 6 degrees east or west means the UTM zone is off by one.

All downloads are converted to WGS84, so they open in the right place in any GIS program.

Worked example: one UTM point

The first line of the UTM sample is the Brandenburg Gate in Berlin. Berlin lies in UTM zone 33 north. This is what happens to the two numbers:

Input      Easting  (X) = 389918.04 m
           Northing (Y) = 5819699.13 m
System     UTM zone 33 north, WGS84   (+proj=utm +zone=33 +datum=WGS84)
Central meridian of zone 33 = 6 x 33 - 183 = 15° E
Result     latitude  = 52.516275
           longitude = 13.377704

With zone 33 the point lands on the Brandenburg Gate. With zone 32 the latitude stays the same but the longitude becomes 7.377704, which is 6 degrees to the west, in western Germany. The numbers alone cannot tell the two apart, which is why the tool asks for the zone.

How to import coordinates from a .txt file, step by step

The whole workflow with the two built-in samples: 24 European cities in latitude and longitude, and 10 places in Berlin in UTM coordinates.

Empty TXT to Map tool with the Open TXT file, Paste text and sample buttons above a world map
1
Step 1: Open the tool

The map opens empty. Click "Open TXT file", "Paste text", drag a file onto the map, or load one of the samples.

European city points on a map with the File panel showing spaces as the detected separator
2
Step 2: Load a text file

Here is "Sample: lat/lon". The File panel shows 24 rows, 4 columns, the detected separator (spaces) and one ignored comment line. All 24 points are on the map.

Table view of the text file with highlighted latitude and longitude columns
3
Step 3: Check the rows in the table

Click "Table" to see every row. The X and Y columns are highlighted. The name Frankfurt am Main stayed in one cell. The ⌖ button jumps from a row to its point.

City points labelled with their names on a map of Europe with a popup open
4
Step 4: Label the points

Under "Label points with", choose a column, here Name. Change the color and size, and click a point to read its row.

Ten UTM points shown in central Berlin with UTM zone 33 north selected
5
Step 5: Plot XY coordinates in UTM

"Sample: UTM XY" holds metres. The coordinate system is UTM, zone 33, north, and the 10 points appear in central Berlin.

UTM text file waiting for a zone number with the export buttons in the side panel
6
Step 6: Enter the zone, then download

For your own UTM file the zone starts empty and a note asks for it. Enter it, check the map, and download Shapefile, GeoJSON, KML or CSV.

Advertisement
Advertisement

Technical details

What the tool accepts and what it produces.

Input
Plain text, UTF-8, up to 30 MB. Binary files are rejected.
Column detection
By name first, in several languages. Without a header, the first two numeric columns are used, a row counter such as 1, 2, 3 is skipped, and values above 90 are recognised as longitude.
Order without a header
Degrees are read as "latitude longitude", metres as "easting northing". The Swap button reverses it.
Rows left out
Rows without two readable numbers, and rows outside the valid range after conversion, are counted in the side panel.
Map
Up to 100,000 points are drawn. Labels are shown for up to 500 points.
Shapefile
Point Shapefile in a ZIP, WGS84. Column names longer than 10 characters are shortened, a limit of the format.
Other downloads
GeoJSON with all columns as properties, KML with the chosen label as the point name, and CSV with two added columns, wgs84_longitude and wgs84_latitude.
Privacy
The file is processed in your browser. Only the map tiles are loaded from the internet.

Who converts text coordinates into a map

The same job shows up in many kinds of work.

  1. Surveyors. Check a total station or GNSS export in UTM before drawing: one misplaced point is easy to see on a map.
  2. Field researchers. Turn sampling positions typed in a notebook file into a layer for a report or a thesis.
  3. GIS analysts. Create a quick point Shapefile from a client’s text file without writing an import definition.
  4. Engineers and contractors. Send borehole or manhole coordinates to a site team as a KML file for Google Earth.
  5. Developers. Test the output of a script by pasting the printed coordinates and looking at them.
  6. Students and teachers. See what X, Y, UTM zones and WGS84 mean by changing them and watching the points move.
Advertisement
Advertisement

Frequently asked questions

How to convert a TXT file with XY coordinates to point features?

Open the file in the tool, check the X and Y columns, choose the coordinate system of the numbers, and download a Shapefile or GeoJSON. In ArcGIS Pro the same job is done with "XY Table To Point", and in QGIS with "Add Delimited Text Layer".

How do I import coordinates from a .txt file?

Click "Open TXT file" or drop the file on the map. The separator, the header line and the coordinate columns are detected automatically. You can correct each of them in the side panel.

How can I display coordinates on a map from a text file?

Load the file or paste its lines. Latitude and longitude values appear on the map at once. For metre coordinates, choose UTM, Web Mercator or a custom system first.

Which comes first, latitude or longitude?

It depends on the file. With a header, the column names decide. Without one, degrees are read as latitude then longitude, and metres as X (easting) then Y (northing). If your points land in the wrong place, press "Swap X and Y".

Can I convert TXT to Shapefile?

Yes. After the points appear, click the Shapefile button. You get a ZIP with a point Shapefile in WGS84, with your columns in the attribute table.

Can I open the points in Google Earth?

Yes. Download KML and open it in Google Earth. Choose a label column first if you want each point to carry a name.

Why are my points in the wrong place?

The usual reasons are swapped X and Y, a wrong UTM zone, the wrong hemisphere, or metres read as a different coordinate system. Check the coordinate system panel and compare one point with a place you know.

My file uses a comma as the decimal sign. Does it work?

Yes, when the columns are separated by spaces, tabs or semicolons, for example 52,5200;13,4050. A comma cannot be both the decimal sign and the separator in the same file.

Does the file need a header line?

No. Without a header the columns are named Column 1, Column 2 and so on, and the tool picks the coordinate columns from the numbers.

Is my file uploaded to a server?

No. Your browser reads and converts the file. Nothing from the file is sent to the site.

What is the difference between this and a CSV to map tool?

A CSV tool expects a comma separated table with a header and latitude and longitude. This tool also reads space-separated and headerless text, skips comment lines, and converts UTM and other projected XY coordinates.

Open source and credits

This tool is built on the following projects.

  • Leaflet 1.9 · BSD-2-Clause · Volodymyr Agafonkin and contributors
    Draws the interactive map and the points.
  • Papa Parse 5 · MIT · Matt Holt and contributors
    Splits comma, tab, semicolon and pipe separated lines.
  • Proj4js · MIT · Proj4js contributors
    Converts UTM, Web Mercator and custom coordinates to WGS84.
  • JSZip · MIT · Stuart Knightley and contributors
    Packs the Shapefile into a ZIP file.
  • OpenStreetMap, Protomaps (hosted by KONAKTIVE), CARTO, Esri World Imagery · ODbL and provider terms · OpenStreetMap contributors, Protomaps, KONAKTIVE, CARTO, Esri
    Provide the street and satellite basemaps.

Related tools

Check converted positions against a known point before you use them for legal or engineering work. Map tiles © OpenStreetMap contributors, drawn with Protomaps (hosted by KONAKTIVE), with CARTO as the fallback. Satellite imagery: Esri.

Muhammad Gulraiz Khan, GIS Expert and Founder of KONAKTIVE and OnlineMapMaker.com

About the Author

Muhammad Gulraiz Khan

GIS Expert & Consultant · Founder, KONAKTIVE

Muhammad Gulraiz Khan is a GIS expert with over a decade of professional experience delivering geospatial solutions for the energy sector, including projects for the World Bank, the International Finance Corporation (IFC), and USAID. He built OnlineMapMaker.com to make professional-grade mapping tools free and accessible to everyone.

Comments

Questions, tips or feedback about this tool? Share them below. Every comment is checked before it appears.

Leave a comment

Your email is not shown to others. We use it to tell you when your comment is approved and when someone replies.

0/1000
Loading question...

Solve the sum in the picture and type the result. The digits are tilted on purpose.

Do not put links, email addresses or phone numbers in your comment. You can post one comment every 5 minutes.

Advertisement
Advertisement