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

Unable to detect CRS, GeoJSON has no "crs" property #186

Open
jfoclpf opened this issue Jan 14, 2023 · 1 comment
Open

Unable to detect CRS, GeoJSON has no "crs" property #186

jfoclpf opened this issue Jan 14, 2023 · 1 comment

Comments

@jfoclpf
Copy link

jfoclpf commented Jan 14, 2023

I am getting this error

Error parsing Geometry Error: Unable to detect CRS, GeoJSON has no "crs" property.
    at detectCrs (/home/joao/dev/geoapi.pt/node_modules/@ngageoint/geopackage/node_modules/reproject/index.js:57:11)
    at Object.reproject (/home/joao/dev/geoapi.pt/node_modules/@ngageoint/geopackage/node_modules/reproject/index.js:98:12)
    at Function.FeatureDao.reprojectFeature (/home/joao/dev/geoapi.pt/node_modules/@ngageoint/geopackage/dist/lib/features/user/featureDao.js:446:44)
    at Object._a.next (/home/joao/dev/geoapi.pt/node_modules/@ngageoint/geopackage/dist/lib/features/user/featureDao.js:389:51)
    at generateMunicipalityCensosJsonFIle (/home/joao/dev/geoapi.pt/routines/censos/generateCensosData.js:260:14)
    at generateJsonData (/home/joao/dev/geoapi.pt/routines/censos/generateCensosData.js:236:5)

with

GeoPackageAPI.open(file).then(geoPackage => {
  const table = geoPackage.getFeatureTables()[0]
  const featureDao = geoPackage.getFeatureDao(table)

  // colums which have statistical numbers to aggregate on the municipality
  const countableColumns = featureDao.columns.filter(c => c.startsWith('N_'))

  // statistical sum for all municipalities
  const sum = {}
  countableColumns.forEach(el => {
    sum[el] = 0
  })

  const geoPackageIterator = geoPackage.iterateGeoJSONFeatures(table)
  for (const feature of geoPackageIterator) { // <= ****** HERE *************
    for (const el in sum) {
      sum[el] += feature.properties[el]
    }
  }
})

I'm using the latest NPM version 4.2.3, and node v16.19.0

Any idea what the problem is?

@vgeorge
Copy link

vgeorge commented Jun 24, 2024

@jfoclpf your file probably doesn't have a CRS set for the table you are querying. I recommend opening it in QGIS to confirm if it is not set and then set it.

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