Giter Club home page Giter Club logo

Comments (10)

randallwhitman avatar randallwhitman commented on August 22, 2024

Thanks for reporting this, and in a while we will respond in more detail.

from spatial-framework-for-hadoop.

randallwhitman avatar randallwhitman commented on August 22, 2024

Here are the results of what I tried out related to this query:

SELECT ST_AREA(ST_POLYGON('MULTIPOLYGON ... '))

returned NULL due to the mismatch between Polygon and MultiPolygon, and logged "ST_Polygon ... Invalid geometry type. Expecting ST_POLYGON".

SELECT ST_AREA(ST_MULTIPOLYGON('MULTIPOLYGON ... '))
1.445076485E8
SELECT ST_AREA(ST_GeomFromText('MULTIPOLYGON ... '))
1.445076485E8

Convert to Esri-JSON, and import the geometry into ArcMap: the shape area is 144507648.5 .

In the fourth vertex X coordinate, is that correct, 001498 with leading zeroes, or is that meant to be 1001498? If I change that coordinate, then i get 507648.5 in Hive (using ST_GeomFromText as the constructor), and likewise 507648.5 upon import to ArcMap.

from spatial-framework-for-hadoop.

kelevraZero avatar kelevraZero commented on August 22, 2024

Thanks Randall.
You're right for the ST_POLYGON/ST_MULTIPOLYGON but I only make this error when I have write this report. When I have try to make readable this shape I should have delete the first digit of fourth vertex... I'm sorry. This one it's ok :

SELECT
ST_AREA(ST_MULTIPOLYGON('
 MULTIPOLYGON (((1001200 2432900, 1001420 2432691, 1001250 2432388, 1001498 2432325, 1001100 2432100, 1001500 2431900, 1002044 2431764, 1002059 2432120, 1002182 2432003, 1002400 2432300, 1002650 2432150, 1002610 2432323, 1002772 2432434, 1002410 2432821, 1002700 2433000, 1001824 2432866, 1001600 2433150, 1001200 2432900)), ((1000393 2433983, 1000914 2434018, 1000933 2433817, 1000568 2433834, 1000580 2433584, 1000700 2433750, 1000800 2433650, 1000700 2433450, 1000600 2433550, 1000200 2433350, 1000100 2433900, 1000393 2433983)), ((1001200 2432900, 1000878 2432891, 1000900 2433300, 1001659 2433509, 1001600 2433150, 1001200 2432900)), ((1002450 2431650, 1002300 2431650, 1002300 2431900, 1002500 2432100, 1002600 2431800, 1002450 2431800, 1002450 2431650)), ((999750 2433550, 999850 2433600, 999900 2433350, 999780 2433433, 999750 2433550)), ((1002950 2432050, 1003005 2431932, 1002850 2432250, 1002928 2432210, 1002950 2432050)), ((1002600 2431750, 1002642 2431882, 1002750 2431900, 1002750 2431750, 1002600 2431750)), ((1002950 2431750, 1003050 2431650, 1002968 2431609, 1002950 2431750)))'))
FROM source.dual;
> 507648.5m (0.5km^2)

But still I have an issue because when I try to display this shape in QGIS (in NTF (Paris) / Lambert zone II). It's said that this shape have an area of 2.038km^2
image

Why I'm thinking that 2.038km^2 is the good area ? When I try the intersection with this shape I have an new shape with an area of 1.2km^2

POLYGON ((998547 2429897, 998499 2430103, 998527 2430175, 998503 2430185, 998503 2430243, 998456 2430280, 998457 2430324, 998406 2430332, 998388 2430287, 998327 2430265, 998329 2430154, 998118 2430159, 998126 2430362, 998090 2430402, 998064 2430459, 998028 2430450, 998031 2430350, 997996 2430348, 997973 2430471, 997935 2430481, 997926 2430626, 997798 2430742, 997864 2430812, 997890 2430902, 997903 2430937, 998013 2430898, 998220 2431060, 998370 2431194, 998283 2431278, 998431 2431449, 998428 2431473, 998489 2431537, 998407 2431602, 998656 2431846, 998565 2431912, 998755 2432140, 998663 2432164, 998864 2432439, 998647 2432424, 998560 2432735, 998690 2432853, 998744 2433041, 998853 2433257, 998937 2433375, 999045 2433494, 999051 2433515, 998865 2433710, 998535 2433919, 998413 2433991, 998357 2434012, 998259 2434188, 998184 2434238, 998131 2434268, 998092 2434317, 998102 2434320, 998187 2434346, 998438 2434443, 998572 2434467, 998650 2434514, 998893 2434517, 999141 2434460, 999348 2434324, 999573 2434232, 999624 2434235, 999688 2434258, 999779 2434315, 999815 2434276, 999831 2434261, 999887 2434285, 999924 2434321, 1000142 2434427, 1000182 2434423, 1000180 2434386, 1000626 2434384, 1000646 2434469, 1000703 2434509, 1000809 2434521, 1000871 2434565, 1001004 2434524, 1000976 2434070, 1000999 2433886, 1001058 2433879, 1001097 2433909, 1001177 2433949, 1001272 2433990, 1001377 2434053, 1001439 2434100, 1001485 2434140, 1001530 2434161, 1001569 2434166, 1001617 2434164, 1001735 2434151, 1001738 2434146, 1001743 2434138, 1001785 2434078, 1001885 2434056, 1001936 2434031, 1001962 2434024, 1001994 2433994, 1002024 2434011, 1002049 2434001, 1002141 2433958, 1002313 2433911, 1002452 2433920, 1002399 2433633, 1002379 2433502, 1002354 2433282, 1002300 2433265, 1002181 2433121, 1002105 2432899, 1002042 2432815, 1002006 2432742, 1001958 2432659, 1001889 2432455, 1001679 2432227, 1001615 2432119, 1001631 2431938, 1001638 2431809, 1001639 2431649, 1001587 2431653, 1001587 2431563, 1001506 2431561, 1001411 2431547, 1001419 2431376, 1001471 2431174, 1001451 2431162, 1001522 2431056, 1001393 2430990, 1001479 2430787, 1001447 2430777, 1001458 2430752, 1001197 2430646, 1001234 2430594, 1001143 2430452, 1001183 2430361, 1001117 2430344, 1001123 2430228, 1001171 2430232, 1001238 2430130, 1001204 2430121, 1001055 2430083, 1001063 2430049, 1001111 2429931, 1001141 2429834, 1001045 2429807, 1001056 2429753, 1001236 2429765, 1001246 2429651, 1001213 2429577, 1001213 2429560, 1000875 2429563, 1000895 2429673, 1000843 2429674, 1000804 2429470, 1000764 2429462, 1000786 2429320, 1000765 2429201, 1000258 2429217, 1000180 2429233, 999867 2429249, 999841 2429252, 999832 2429256, 999834 2429412, 999766 2429375, 999758 2429377, 999792 2429542, 999592 2429608, 999650 2429746, 999615 2429756, 999576 2429673, 999570 2429669, 999560 2429671, 999573 2429853, 999505 2429864, 999484 2430026, 999422 2429968, 999413 2429964, 999396 2429960, 999367 2429976, 999327 2430023, 999136 2430010, 999095 2429983, 999073 2429977, 999002 2429985, 998845 2429971, 998828 2429962, 998549 2429887, 998547 2429897))

Here the code :

SELECT
ST_AREA(ST_INTERSECTION(
ST_POLYGON('POLYGON ((998547 2429897, 998499 2430103, 998527 2430175, 998503 2430185, 998503 2430243, 998456 2430280, 998457 2430324, 998406 2430332, 998388 2430287, 998327 2430265, 998329 2430154, 998118 2430159, 998126 2430362, 998090 2430402, 998064 2430459, 998028 2430450, 998031 2430350, 997996 2430348, 997973 2430471, 997935 2430481, 997926 2430626, 997798 2430742, 997864 2430812, 997890 2430902, 997903 2430937, 998013 2430898, 998220 2431060, 998370 2431194, 998283 2431278, 998431 2431449, 998428 2431473, 998489 2431537, 998407 2431602, 998656 2431846, 998565 2431912, 998755 2432140, 998663 2432164, 998864 2432439, 998647 2432424, 998560 2432735, 998690 2432853, 998744 2433041, 998853 2433257, 998937 2433375, 999045 2433494, 999051 2433515, 998865 2433710, 998535 2433919, 998413 2433991, 998357 2434012, 998259 2434188, 998184 2434238, 998131 2434268, 998092 2434317, 998102 2434320, 998187 2434346, 998438 2434443, 998572 2434467, 998650 2434514, 998893 2434517, 999141 2434460, 999348 2434324, 999573 2434232, 999624 2434235, 999688 2434258, 999779 2434315, 999815 2434276, 999831 2434261, 999887 2434285, 999924 2434321, 1000142 2434427, 1000182 2434423, 1000180 2434386, 1000626 2434384, 1000646 2434469, 1000703 2434509, 1000809 2434521, 1000871 2434565, 1001004 2434524, 1000976 2434070, 1000999 2433886, 1001058 2433879, 1001097 2433909, 1001177 2433949, 1001272 2433990, 1001377 2434053, 1001439 2434100, 1001485 2434140, 1001530 2434161, 1001569 2434166, 1001617 2434164, 1001735 2434151, 1001738 2434146, 1001743 2434138, 1001785 2434078, 1001885 2434056, 1001936 2434031, 1001962 2434024, 1001994 2433994, 1002024 2434011, 1002049 2434001, 1002141 2433958, 1002313 2433911, 1002452 2433920, 1002399 2433633, 1002379 2433502, 1002354 2433282, 1002300 2433265, 1002181 2433121, 1002105 2432899, 1002042 2432815, 1002006 2432742, 1001958 2432659, 1001889 2432455, 1001679 2432227, 1001615 2432119, 1001631 2431938, 1001638 2431809, 1001639 2431649, 1001587 2431653, 1001587 2431563, 1001506 2431561, 1001411 2431547, 1001419 2431376, 1001471 2431174, 1001451 2431162, 1001522 2431056, 1001393 2430990, 1001479 2430787, 1001447 2430777, 1001458 2430752, 1001197 2430646, 1001234 2430594, 1001143 2430452, 1001183 2430361, 1001117 2430344, 1001123 2430228, 1001171 2430232, 1001238 2430130, 1001204 2430121, 1001055 2430083, 1001063 2430049, 1001111 2429931, 1001141 2429834, 1001045 2429807, 1001056 2429753, 1001236 2429765, 1001246 2429651, 1001213 2429577, 1001213 2429560, 1000875 2429563, 1000895 2429673, 1000843 2429674, 1000804 2429470, 1000764 2429462, 1000786 2429320, 1000765 2429201, 1000258 2429217, 1000180 2429233, 999867 2429249, 999841 2429252, 999832 2429256, 999834 2429412, 999766 2429375, 999758 2429377, 999792 2429542, 999592 2429608, 999650 2429746, 999615 2429756, 999576 2429673, 999570 2429669, 999560 2429671, 999573 2429853, 999505 2429864, 999484 2430026, 999422 2429968, 999413 2429964, 999396 2429960, 999367 2429976, 999327 2430023, 999136 2430010, 999095 2429983, 999073 2429977, 999002 2429985, 998845 2429971, 998828 2429962, 998549 2429887, 998547 2429897))'),
ST_MULTIPOLYGON('MULTIPOLYGON (((1001200 2432900, 1001420 2432691, 1001250 2432388, 1001498 2432325, 1001100 2432100, 1001500 2431900, 1002044 2431764, 1002059 2432120, 1002182 2432003, 1002400 2432300, 1002650 2432150, 1002610 2432323, 1002772 2432434, 1002410 2432821, 1002700 2433000, 1001824 2432866, 1001600 2433150, 1001200 2432900)), ((1000393 2433983, 1000914 2434018, 1000933 2433817, 1000568 2433834, 1000580 2433584, 1000700 2433750, 1000800 2433650, 1000700 2433450, 1000600 2433550, 1000200 2433350, 1000100 2433900, 1000393 2433983)), ((1001200 2432900, 1000878 2432891, 1000900 2433300, 1001659 2433509, 1001600 2433150, 1001200 2432900)), ((1002450 2431650, 1002300 2431650, 1002300 2431900, 1002500 2432100, 1002600 2431800, 1002450 2431800, 1002450 2431650)), ((999750 2433550, 999850 2433600, 999900 2433350, 999780 2433433, 999750 2433550)), ((1002950 2432050, 1003005 2431932, 1002850 2432250, 1002928 2432210, 1002950 2432050)), ((1002600 2431750, 1002642 2431882, 1002750 2431900, 1002750 2431750, 1002600 2431750)), ((1002950 2431750, 1003050 2431650, 1002968 2431609, 1002950 2431750)))')))
FROM source.dual;
> 1234289.0624624107m^2 (1.2km^2)

It's return exactly the same result with QGIS :
image

So I'm pretty sure that you're ok with me : it's impossible to have an intersection between two shape bigger that one of these (1.2km2 > 0.5km^2)... I hope I have explain more clearly my issue :)

Kelevra.

from spatial-framework-for-hadoop.

randallwhitman avatar randallwhitman commented on August 22, 2024

Kelevra - thanks for the additional explanation. As you can see, I have asked the Esri/geometry-api-java team to comment.

from spatial-framework-for-hadoop.

kelevraZero avatar kelevraZero commented on August 22, 2024

Thanks Randall.
Here an additional and interesting information. The intesection between this shape with itself give the good area...

SELECT
ST_AREA(ST_INTERSECTION(
ST_MULTIPOLYGON('MULTIPOLYGON (((1001200 2432900, 1001420 2432691, 1001250 2432388, 1001498 2432325, 1001100 2432100, 1001500 2431900, 1002044 2431764, 1002059 2432120, 1002182 2432003, 1002400 2432300, 1002650 2432150, 1002610 2432323, 1002772 2432434, 1002410 2432821, 1002700 2433000, 1001824 2432866, 1001600 2433150, 1001200 2432900)), ((1000393 2433983, 1000914 2434018, 1000933 2433817, 1000568 2433834, 1000580 2433584, 1000700 2433750, 1000800 2433650, 1000700 2433450, 1000600 2433550, 1000200 2433350, 1000100 2433900, 1000393 2433983)), ((1001200 2432900, 1000878 2432891, 1000900 2433300, 1001659 2433509, 1001600 2433150, 1001200 2432900)), ((1002450 2431650, 1002300 2431650, 1002300 2431900, 1002500 2432100, 1002600 2431800, 1002450 2431800, 1002450 2431650)), ((999750 2433550, 999850 2433600, 999900 2433350, 999780 2433433, 999750 2433550)), ((1002950 2432050, 1003005 2431932, 1002850 2432250, 1002928 2432210, 1002950 2432050)), ((1002600 2431750, 1002642 2431882, 1002750 2431900, 1002750 2431750, 1002600 2431750)), ((1002950 2431750, 1003050 2431650, 1002968 2431609, 1002950 2431750)))'),
ST_MULTIPOLYGON('MULTIPOLYGON (((1001200 2432900, 1001420 2432691, 1001250 2432388, 1001498 2432325, 1001100 2432100, 1001500 2431900, 1002044 2431764, 1002059 2432120, 1002182 2432003, 1002400 2432300, 1002650 2432150, 1002610 2432323, 1002772 2432434, 1002410 2432821, 1002700 2433000, 1001824 2432866, 1001600 2433150, 1001200 2432900)), ((1000393 2433983, 1000914 2434018, 1000933 2433817, 1000568 2433834, 1000580 2433584, 1000700 2433750, 1000800 2433650, 1000700 2433450, 1000600 2433550, 1000200 2433350, 1000100 2433900, 1000393 2433983)), ((1001200 2432900, 1000878 2432891, 1000900 2433300, 1001659 2433509, 1001600 2433150, 1001200 2432900)), ((1002450 2431650, 1002300 2431650, 1002300 2431900, 1002500 2432100, 1002600 2431800, 1002450 2431800, 1002450 2431650)), ((999750 2433550, 999850 2433600, 999900 2433350, 999780 2433433, 999750 2433550)), ((1002950 2432050, 1003005 2431932, 1002850 2432250, 1002928 2432210, 1002950 2432050)), ((1002600 2431750, 1002642 2431882, 1002750 2431900, 1002750 2431750, 1002600 2431750)), ((1002950 2431750, 1003050 2431650, 1002968 2431609, 1002950 2431750)))')
))
FROM source.dual;
> 2037634.5m^2 (2.038km^2)

Kelevra

from spatial-framework-for-hadoop.

randallwhitman avatar randallwhitman commented on August 22, 2024

That is a good observation indeed.

The geometry-api team is planning to fix this in the geometry-api-java layer.

from spatial-framework-for-hadoop.

randallwhitman avatar randallwhitman commented on August 22, 2024

@kelevraZero If you are in position to build geometry-api from branch, you can try out the patched branch.

from spatial-framework-for-hadoop.

randallwhitman avatar randallwhitman commented on August 22, 2024

@kelevraZero The patch is now merged into geometry-api master. Please confirm the patch. Thanks.

from spatial-framework-for-hadoop.

kelevraZero avatar kelevraZero commented on August 22, 2024

Hello @randallwhitman, Ok no problem I will testing the new version. Thanks.

from spatial-framework-for-hadoop.

randallwhitman avatar randallwhitman commented on August 22, 2024

Fixed in Esri/geometry-api-java version 1.2

from spatial-framework-for-hadoop.

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.