Domanda

I have a CSV with columns that have gx_location, ints, and dollar amounts. I cannot figure out the proper VRT to accompany this file when uploading to Google Maps Engine so the dollar amounts show up correctly in GME.

The CSV looks like:

Name,gx_location,Units,Sales,Hour,TotalUnits,TotalSales
store #1,SPRINGFIELD VA 22150,1,"1,269.00",0:00:00,29,"16,424.00"
store #2,ATLANTA GA 30354,2,587.00,0:00:00,5,"1,865.00"

The VRT looks like:

<OGRVRTDataSource>
    <OGRVRTLayer name="a00">
    <SrcDataSource relativeToVrt="1">a00.csv</SrcDataSource>
    <GeometryType>wkbPoint</GeometryType>
    <GeometryField reportSrcColumn="false" encoding="WKB" field="gx_location" />
    <LayerSRS>WGS84</LayerSRS>
      <Field name="Name" src="Name" type="String" />
      <Field name="gx_location" src="gx_location" type="String" />
      <Field name="Units" src="Units" type="Integer" />
      <Field name="Sales" src="Sales" type="Real" precision="2" />
      <Field name="Hour" src="Hour" type="String" />
      <Field name="TotalUnits" src="TotalUnits" type="Integer" />
      <Field name="TotalSales" src="TotalSales" type="Real" precision="2" />
    </OGRVRTLayer>
</OGRVRTDataSource>

When it gets to Maps Engine, in the 'Edit vector data' page it looks like (imagine a table. I've used three spaces to separate entries):

store #1   SPRINGFIELD VA 22150   1   1     0:00:00   29   16
store #2   ATLANTA GA 30354       2   587   0:00:00    5    1

I am loading the dollar amounts with the formatting (the comma) because that's the format I would like in the info popup. Plus, I would like to do < (less than) and > (greater than) comparisons with the numbers in that field.

Thanks in advance for the assistance.

È stato utile?

Soluzione

The problem is the formatted dollar amount within the quotes ("16,424.00"). It seems GME interprets this as a string rather than a real or integer. Changing it to 16424.00 works with Real precision 2.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top