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

Type error in terraformer #40

Open
nsotelo opened this issue Mar 8, 2018 · 2 comments
Open

Type error in terraformer #40

nsotelo opened this issue Mar 8, 2018 · 2 comments

Comments

@nsotelo
Copy link

nsotelo commented Mar 8, 2018

The program is failing to download all of the json files from a particular server, for me it keeps crashing at the 33rd file.
error_output.txt
services.txt

@vahtos
Copy link

vahtos commented Mar 28, 2019

This is old, but I am also having this issue.

agsout -s ./services.txt -o . -S
Number of features for service i07_WellCompletionReports: 994757
Getting chunks of 100 features, will make 9948 total requests
/usr/local/lib/node_modules/agsout/node_modules/terraformer/terraformer.js:674
        throw new Error("Unknown type: " + geojson.type);
        ^

Error: Unknown type: undefined
    at new Primitive (/usr/local/lib/node_modules/agsout/node_modules/terraformer/terraformer.js:674:15)
    at Object.parse (/usr/local/lib/node_modules/agsout/node_modules/terraformer-arcgis-parser/terraformer-arcgis-parser.js:330:12)
    at convert (/usr/local/lib/node_modules/agsout/index.js:166:33)
    at Parser.parser.onValue (/usr/local/lib/node_modules/agsout/node_modules/JSONStream/index.js:109:32)
    at Parser.proto.emit (/usr/local/lib/node_modules/agsout/node_modules/jsonparse/jsonparse.js:337:8)
    at Parser.proto.pop (/usr/local/lib/node_modules/agsout/node_modules/jsonparse/jsonparse.js:332:8)
    at Parser.proto.onToken (/usr/local/lib/node_modules/agsout/node_modules/jsonparse/jsonparse.js:402:12)
    at Parser.parser.onToken (/usr/local/lib/node_modules/agsout/node_modules/JSONStream/index.js:128:12)
    at Parser.proto.write (/usr/local/lib/node_modules/agsout/node_modules/jsonparse/jsonparse.js:135:34)
    at Stream.<anonymous> (/usr/local/lib/node_modules/agsout/node_modules/JSONStream/index.js:23:12)
    at Stream.stream.write (/usr/local/lib/node_modules/agsout/node_modules/through/index.js:26:11)
    at Request.ondata (internal/streams/legacy.js:16:26)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/agsout/node_modules/request/request.js:1080:12)
    at emitOne (events.js:96:13)
    at IncomingMessage.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at IncomingMessage.Readable.push (_stream_readable.js:134:10)
    at HTTPParser.parserOnBody (_http_common.js:123:22)
    at TLSSocket.socketOnData (_http_client.js:377:20)
    at emitOne (events.js:96:13)

Services.txt
http://gis-proxy.water.ca.gov/arcgis/rest/services/Environment/i07_WellCompletionReports/FeatureServer/0|i07_WellCompletionReports|100

@vahtos
Copy link

vahtos commented Mar 28, 2019

After reviewing the error and source code, it looks like the it is happening in this function:

			if(!feature.geometry) {
				console.log("Feature Missing Geometry and is Omitted: ", JSON.stringify(feature))
				return null;
			}
			const gj = {
				type: 'Feature',
				properties: feature.attributes,
				geometry: TerraformerArcGIS.parse(feature.geometry)
			}
			return gj
		}

If a feature in the dataset does not have geometry(feature.geometry is undefined), then TerraformerArcGIS.parse is being passed undefined, instead of a geometry object. But I am confused because it looks like that's being checked for, so I don't understand how this error is happening...

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