Select to view content in your preferred language

Changing the data type of a field from a GeoJSON file

1198
4
Jump to solution
08-08-2023 04:01 AM
Labels (1)
RichardHolowczak
New Contributor II

Howdy folks:

I am working with ArcGIS Online and have imported a GeoJSON file we generated from some Drone metadata.  One of the fields in the data is the mission date for the drone flight.  This is stored in the GeoJSON file in the format:  YYYYMMDD    

For example:   20230612

When I create a Feature Layer from this GeoJSON file, the field is turned into an integer data type. When the data is displayed in a map, commas are inserted as if this were an integer. 

For example:   20,230,612

When I look at the Fields display and click on this field I can see the Type: Integer. I can change the Field Value Type to Description or Name but that does not influence how the data is displayed.

Is there a way to edit the underlying data types of fields in the GeoJSON file?

Any other tricks I can try to get the data to display without the commas?

Thanks in advance for any suggestions.

 

0 Kudos
2 Solutions

Accepted Solutions
AndreasHall
Esri Contributor

You can create a new field of type string or date in your feature layer, then use calculate to populate the new field based on your integer values. I´m not familiar with the import GeoJSON workflow, I guess you would have noticed if you in that workflow could set the date field to string or date type instead of integer.

Here is where you add a field:

AndreasHall_0-1691494103154.png

Click the field name and choose calculate:

AndreasHall_1-1691494228111.png

If the integer type is okay you could also just choose to not show thousand separators in you pop-up. That you can configure in the web map from the fields symbol:

AndreasHall_2-1691494672430.png

 

View solution in original post

AndreasHall
Esri Contributor

You would click Layers, then select your layer from the table of contents, and then the symbol you want will appear on the right hand side of the map.

View solution in original post

4 Replies
AndreasHall
Esri Contributor

You can create a new field of type string or date in your feature layer, then use calculate to populate the new field based on your integer values. I´m not familiar with the import GeoJSON workflow, I guess you would have noticed if you in that workflow could set the date field to string or date type instead of integer.

Here is where you add a field:

AndreasHall_0-1691494103154.png

Click the field name and choose calculate:

AndreasHall_1-1691494228111.png

If the integer type is okay you could also just choose to not show thousand separators in you pop-up. That you can configure in the web map from the fields symbol:

AndreasHall_2-1691494672430.png

 

RichardHolowczak
New Contributor II

Thanks - these are really great tips.  Too bad they don't have a TO_DATE function in Arcade or in SQL that will convert an integer to a Date.  I suppose I could convert the integer to a String and then pick apart the year, month and day (using Left, Mid and Right functions) and then pass that to the DATE function.

For the display options you mentioned last, where would I navigate to to find those?  In my map I only see icons for: Add, Layers, Tables, Basemap, Charts, Legend, Bookmarks, Save and Open, Map Properties, Share Map, etc.

RichardHolowczak_0-1691497530804.png

 

 

0 Kudos
AndreasHall
Esri Contributor

You would click Layers, then select your layer from the table of contents, and then the symbol you want will appear on the right hand side of the map.

RichardHolowczak
New Contributor II

Thanks - now I see those other options. Very helpful!

 

0 Kudos