Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Join "Unable to export object-type data, writing null values" #591

Closed
2803media opened this issue Jun 25, 2023 · 3 comments
Closed

Join "Unable to export object-type data, writing null values" #591

2803media opened this issue Jun 25, 2023 · 3 comments

Comments

@2803media
Copy link

Hi

I have the following command:

mapshaper test.shp \
	-join PM_010.csv keys='id,id' calc='data = collect("Groupe personne"), COUNT = count()' \
	-filter 'COUNT > 0' \
	-o out2.shp

With the CSV file like that:

Département,CODGEO,Nom Commune,parcelle,adresse,Contenance,Nature culture,Code droit,SIREN,Groupe personne,Forme juridique,Forme juridique abrégée,Dénomination
01,01001,L'ABERGEMENT-CLEMENCIAT,010010000017,CHAMP MACONNAIS,000000120,BS,P,U21651623,0,9900,AUPM,PROPRIETAIRES DU BND 001 A0017
01,01001,L'ABERGEMENT-CLEMENCIAT,010010000A0017,CHAMP MACONNAIS,000000120,BS,P,U21651623,0,9900,AUPM,PROPRIETAIRES DU BND 001 A0017
01,01001,L'ABERGEMENT-CLEMENCIAT,010010000A0017,CHAMP MACONNAIS,000000120,BS,P,U21651623,0,9900,AUPM,PROPRIETAIRES DU BND 001 A0017
01,01001,L'ABERGEMENT-CLEMENCIAT,010010000A0018,CHAMP MACONNAIS,000000060,BS,P,U21651730,0,9900,AUPM,PROPRIETAIRES DU BND 001 A0018

But I got this error:

[join] Auto-detected number fields: Département, CODGEO, Contenance, Groupe personne, Forme juridique
[join] Joined data from 285,993 source records to 239,477 target records
[join] 1119191 target records received no data
[join] 3217/289210 source records could not be joined
[join] 32725/1358668 target records were matched by multiple source records (many-to-one relationship)
[filter] Retained 239,477 of 1,358,668 features
[o] [data] Unable to export object-type data, writing null values

I don't know why there is a "Unable to export object-type data, writing null values" error on this?

Any idea?

Thanks in advance!

@2803media
Copy link
Author

The problem exist with the SHP output but is not present with the JSON output. Is this a shapefile limitation?

@mbloch
Copy link
Owner

mbloch commented Jun 26, 2023

Hi, yes, this is a Shapefile limitation. The expression data = collect("Groupe personne") creates a field named "data" containing arrays of integers (in this case). GeoJSON supports array data but Shapefile doesn't. You could use another command to transform the arrays to strings, for example:

-each 'groups = JSON.stringify(data)'

Also, you need to change data = collect("Groupe personne") to data = collect(d["Groupe personne"]) for the command to work correctly (see issue #592)

@2803media
Copy link
Author

Thanks for the proposition !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants