Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Request for an App
-
I am in need of an app which can find the area of a space that is represented by a jpeg where at least one measurement is known. For example, I have a floor plan of an apt that purports to be a certain area. The floor plan has room sizes shown. I want to be able to simply enter one measurement to get the scale ratio and then trace the plan to find the area. This is easy to do using a program such as Adobe Acrobat Pro on a desktop but I have not seen anything similar for IOS (or Android). If someone knows of such a program, please let me know. It seems as if this should not be overly difficult to do using Pythonista and I could make it my project to write it but I fear that may take awhile given my (rusty) python skills not to mention the UI using Pythonista. If someone has the time and inclination, I (and I think others) would be most grateful for such an app/script.
-
So, you want to have an image, input one dimension for it, and get the area, based on scaling at that ratio? Or is it more complicated than this?
-
The best app on the app store for CAD is Touchdraw
-
@Webmaster40 Precisely.
@TutorialDoctor I believe that Touchdraw is more about drawing the floor plan where I am starting with a floorplan and merely want to compute the area of a (non rectangular) figure. For extra credit, it would be nice to be able to draw around the perimeter and then around areas to delete from the area calculation but that is less essential. -
It has that feature inside. You can scale irregular shapes and it computes the area dynamically. I can take a screenshot. Give me a second.
-
@TutorialDoctor From a jpeg, as opposed to something that was created using TouchDraw?
-
I suppose if you import the jpeg and trace it using the pen tool, that would be the faster way. To compute the area dynamically you just add a small bit of code to the traced object. Your case is very specific, but I think it should work for your purposes. I am working on that screenshot now.
Seems they have it documented:
-
@TutorialDoctor Unless I am mistaken, the doc shows how to compute area of a figure you have drawn in the app. Perhaps there is a way to import a JPEG and draw on it, but I didn't see that. Yes, my requirement is fairly specific but, I think, not unique. People often publish a floor plan as part of a house or apartment listing and assert that the area is x when in fact a measurement of the plan (or the space itself) shows otherwise.
-
Yes, you can import a photo and draw on it. You can also set the scale too.
An extended solution would be to trace the image using a program like Adobe Illustrator (the live trace feature) which converts an image to SVG. From there you import the image into Touchdraw and add the formula to the shape.
This all depends on how well the image is traced in Illustrator (Inkscape has a similar though buggier version of this).
I don't currently know of any quicker solutions though. Perhaps someone else may.
Also, you can set the length of a side and the scale will adjust accordingly. I have to see if I can remember how to do this first though:
Here is how to do dimensioning
I have an app called MyMeasures also.
https://itunes.apple.com/us/app/my-measures-pro/id325962257?mt=8
-
@ihf , I am not trying to be the gringe of Christmas.but I think what you are looking for is impractical. Maybe not, but my 2 cents worth is that depending on what country you are in a house/condo Sqm is calculated differently. Example in Australia with a condo, if you have a car space that is included in the advertised sqm. Totally legal. But depending on the type of title, a balcony maybe included or excluded from the advertised sqm. So that's just a few gotchas. You would also assume your floor plan is too scale. But unless you have the a0 paper plan from the architect, reproductions can get so bad on scaling. They will be relative, mostly. But to try an accurately measure them digitally in my opinion not easy. If from the drawings you have, you can put a scale ruler on top of it and get good readings, maybe you have a chance. But the practical side of it is not easy
-
This is incredibly easy to do with Pythonista if that's what you're asking for.
from PIL import Image import photos im = photos.pick_image() # Load the image with whatever method you'd like dimension = 1 if raw_input("Which dimension are you inputting?\n").lower() == "width" else 0 dimension_value = int(raw_input("Value: ")) """ We can use the proportion: image_width your_width ------------ = ----------------- image_height unknown_dimension and with this, cross-multiply""" if dimension: # We're solving for the height print im.size[1]*dimension_value / float(im.size[0]) else: print im.size[0]*dimension_value / float(im.size[1])
If this isn't what you're looking for, please elaborate. If my code is wrong, tell me, I wrote it without testing :)
P. S. @Phuket2 it's "grinch" ;)
-
@Webmaster4o Thank you. I think this is a wonderful start but what I want to be able to do is draw a straight line on the jpeg (e.g. one side of a room) and input what the drawing says that is in feet. Then I want to be able to trace the perimeter of the entire plan) and get the area in sq ft. In Adobe Acrobat this is done by measuring one known dimension and setting the scale ratio so that, for example, 1.2in = 14 ft (or whatever the plan says). Then I click at any place on the jpeg and a straight line is drawn until I close the polygon and the area in sq ft is displayed.
-
Right. This is harder, but still doable with proportions and Pythagorean theorem. Use the distance formula (which is really just Pythagorean theorem rewritten) to find diagonal distance between 2 points:
, then use that as a proportion to the known distance.
-
is your goal for something that auto-detects walls and computes area? Or you set scale, thrn manually trace, or perhaps set a series of corner points using a zoomed view for accuracy?
-
The latter. If still unclear: I want to do in Pythonista what is shown in this video using Acrobat Pro. (https://www.youtube.com/watch?v=5Ra4kgOGq9Q)
-
and do you want to aquire your image via camera? or scan? i.e, do we need to "flatten" image and take out perspective errors?
https://www.mathsisfun.com/geometry/area-irregular-polygons.html is a good summary of how to calculate area from a set of ordered coordinates. I would probably do everything in pixel units, then scale the area by (ft/pixel)**2 at the end.
-
No need to flatten anything as I will be starting with floor plans. I have no trouble with the math involved. It's really the Pythonista UI (getting the points, drawing the lines on the image, recognizing and closing the polygon. I'm sure that all of this is easy for someone (not me) who has used the UI. The calculations are really quite straightforward. I suppose it will be a good learning experience :-)
-
@ihf Make a new repo, name it RoomAreaFinder and add a jpg or png file of a floor plan. Look at https://github.com/humberry/photo_text and get enough code to grab your floor plan from the camera roll and display it within a Pythonista UI. If you then provide the URL to that repo, we can provide improvement suggestions until you have your app.
-
-
Sounds like a plan. Thanks guys!