Giter Club home page Giter Club logo

Comments (3)

larsbutler avatar larsbutler commented on June 1, 2024

Hey @dave-nm, I think there's an error in the input.

0101000020e61000003cdba337dcc351c06d37c1374d374840 does not contain a valid geometry type. (See https://github.com/geomet/geomet/blob/master/wkb_detail.md#point).

I think the problem is that you're missing a byte from the type field:

  • the first byte (2 hex chars) is the endianness --> 01
  • the next 4 bytes are the geometry type --> 01000020, which is not a valid geometry type (at least none that I'm aware of)
  • the rest should be 8 byte chunks, each chunk containing a coordinate value

The first (working) example should convert to {'type': 'Point', 'coordinates': [-71.060316, 48.432044]}, but I don't understand what the other geometry is supposed to be. Can you please clarify?

from geomet.

larsbutler avatar larsbutler commented on June 1, 2024

@dave-nm Ah, I see what it is. The SRID is encoded in there; that's why.

I figured this out by playing with postgis:

postgres=# SELECT ST_GeomFromEWKT('POINT(-71.060316 48.432044)');
              st_geomfromewkt               
--------------------------------------------
 01010000003CDBA337DCC351C06D37C1374D374840
(1 row)

postgres=# SELECT ST_GeomFromEWKT('SRID=4326;POINT(-71.060316 48.432044)');
                  st_geomfromewkt                   
----------------------------------------------------
 0101000020E61000003CDBA337DCC351C06D37C1374D374840
(1 row)

Let me find the documentation on that encoding. This seems to be a PostGIS-specific thing (https://gis.stackexchange.com/questions/143230/i-cant-understand-this-ewkb-type-mask) but I see no reason to not support it.

from geomet.

larsbutler avatar larsbutler commented on June 1, 2024

Closing this issue, moving it to #31 (since it more precisely characterizes the issue/feature).

from geomet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.