Select to view content in your preferred language

When adding CSV file to a webmap none of the data shows up in the layer

1033
5
06-19-2023 03:34 AM
SeanNagy1
Regular Contributor

I have a csv file with simple Lat/Long/Z/Type features but when i try to add it to the map it will create the file but all of the data is missing. If i look at the hosted layer content it just says data error and i cant append in the original content to the file either. Attached is the CSV file and a snip of what it looks like in Content.

SeanNagy1_0-1687170792202.png

 

0 Kudos
5 Replies
Clubdebambos
Frequent Contributor

What steps are you performing to add the csv? By providing us a step-by-step process we can better help troubleshoot.

Just to note, your csv file does not contain Lat/Long, yours are projected coordinates. Is the goal here to simply add the csv as a table, or do you want to create a point feature layer from the coordinates? if the latter, then you will need to convert these to Lat/Long if you are using the AGOL GUI to publish a csv as a hosted feature service. 

~ learn.finaldraftmapping.com
0 Kudos
SeanNagy1
Regular Contributor
I think that might be the problem then since I assumed they are Lat/Long points. Any quick way to do the conversion to make them Lat/Long in AGOL? I know how to do it using ArcMap but trying to make a simple process if possible for those in my company that only have access to AGOL
0 Kudos
Clubdebambos
Frequent Contributor

If you know the EPSG/WKID of the coordinate system used for your X and Y fields you can use the Python script below to add the csv to AGOL and publish. As far as I am aware, the GUI route with AGOL does not offer the customization to change the Lat/Long to X and Y.

 

from arcgis.gis import GIS

## connect to AGOL
## you can also connect using GIS("your_agol_url", "username", "password")
agol = GIS("home")

## the path to the csv file up upload
csv_filepath = r"C:\Users\******\Documents\test_upload.csv"

## upload properties dictionary for setting the title and item type
item_properties = {
    "title" : "CSV Upload",
    "type" : "CSV"
}

## add the csv to AGOL
csv_agol = agol.content.add(item_properties=item_properties, data=csv_filepath)

## set params for publishing using the x and y fields and correct srs
publish_parameters = {
    "type" : "csv",
    "name" : "CSV Upload",
    "locationType" : "coordinates",
    "longitudeFieldName" : "X", #the X coord field
    "latitudeFieldName" : "Y", #the Y coord field
    "sourceSR" : {
          "wkid": 2157, ## the EPSG / WKID code for the SRS
          "latestWkid": 2157 ## the EPSG / WKID code for the SRS
    }
}

## publish as hosted feature service
csv_agol.publish(publish_parameters=publish_parameters)

 

~ learn.finaldraftmapping.com
0 Kudos
Clubdebambos
Frequent Contributor

You would need to do the conversion prior to adding to AGOL. Is there somewhere in the data pipeline you can do this? What Spatial Reference System do the coordinates belong to?

~ learn.finaldraftmapping.com
0 Kudos
Ameliajhnson
New Contributor
  1. Check the CSV file format: Ensure that the CSV file is correctly formatted. Double-check that the file has the appropriate structure with headers in the first row and lorcana proxy data in subsequent rows. Make sure the columns are properly delimited, typically with commas.

  2. Verify the coordinate system: Confirm that the coordinate system used in the CSV file matches the coordinate system of the web map. Mismatched coordinate systems can cause the data to display incorrectly or appear in the wrong location. Ensure that the coordinate system is compatible, such as using WGS84 (EPSG:4326) for geographic data.

0 Kudos