1

I need to calculate the area of the Building (which the coordinates represents). I used transform() to calculate the area, but the calculated area is not accurate. Please help me calculating the area using the lat/lon coordinates.

          Class Parcel(models.Model):
              geom = models.MultiPolygonField(srid=3492)
              street_nbr = models.CharField(max_length=80)

          Class Primary(models.Model):
              geom  = models.MultiPolygonField(srid=4326)


      >>>parcel = Parcel.objects.filter(street_nbr__contains="2730", street_nam__contains="11TH AVE",city__contains="SACRA").values()
      >>>parcel[0]['geom'].geojson


     >>>build = Primary.objects.filter(goem__contained= parcel[0]['geom'].geojson).values()

     >>>build[0]['geom'].geojson
     '{"coordinates": [[[[-121.476756, 38.542154], [-121.47686, 38.542152], [-121.47686, 38.542136], [-121.476904, 38.542135], [-121.476904, 38.542132], [-121.476962, 38.542131], [-121.476966, 38.542295], [-121.476893, 38.542296], [-121.476892, 38.542278], [-121.476845, 38.542279], [-121.476845, 38.542281], [-121.476759, 38.542282], [-121.476756, 38.542154]]]], "type": "MultiPolygon"}'


      >>>x = build[0]['geom']
      >>>y = x.transform(3492,Clone=True)
      >>>y.area
      1636.8046 

Here i'm getting the area as 1636.8046, I was supposed to get 2,327 sqft . I'm not able to find what I am doing wrong.

0

If your coordinates are in lat/long, then the SRID should be 4326. So just change the transformation parameter in x.transform.

Try changing y = x.transform(3492,Clone=True) to y = x.transform(4326,Clone=True)

  • >>> x = build[0]['geom'] >>> y = x.transform(4326,clone=True) >>> y.area 2.9458000000913017e-08 thanks for suggesting me , I tried as you mentioned the above but I'm not aware of Units of the result . Could you please explain me what the result is ? – Ballipalli Narendra Jul 26 '18 at 6:45
  • @BallipalliNarendra 2.9458000000913017e-08 is scientific notation for describing very large numbers. In this case it translates to 0.00000002945800000091302, which doesn't seem correct for an area – Sam Comber Jul 26 '18 at 8:13
  • 1
    Yes dude area is wrong. I am not getting what i am doing wrong – Ballipalli Narendra Jul 26 '18 at 8:15
  • the units for that number is square degrees. Not sure how to fix, though – Teddy Ward Jul 16 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.