[GIS] Check if a point is inside a polygon from .shp file

go-golangpolygonshapefile

I'm trying to build an application that will resolve the corresponding "region" of a point. So basically if a lat-lng point is inside Polygon-A or Polygon-B.

I have all the files (I hope at least), a .shp, a .prj and two more binary files.
I'm trying to do it in Go, I've found a library that is able to read the shp file (go-shp: https://github.com/jonas-p/go-shp ) but I'm not sure how to derive the coordinates.

Is it possible or am I missing something? Do I need to convert it in GeoJSON or something like that?

Sorry but I'm pretty noob about GIS!

EDIT:
Reading the Polygon object returned by the library the points associated are in the form of something like this:

[
    {984002.7992000002 4.6707144145e+06}
    {985067.0396999996 4.670245166999999e+06}
    {985239.5382000003 4.670172667400001e+06}
    ...
]

and I'm not sure on how to use it.

The .prj file contains these informations:

PROJCS[
    "WGS_1984_UTM_Zone_32N",
    GEOGCS[
        "GCS_WGS_1984",
        DATUM[
            "D_WGS_1984",
            SPHEROID["WGS_1984",6378137.0,298.257223563]
        ],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]
    ],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["False_Easting",500000.0],
    PARAMETER["False_Northing",0.0],
    PARAMETER["Central_Meridian",9.0],
    PARAMETER["Scale_Factor",0.9996],
    PARAMETER["Latitude_Of_Origin",0.0],
    UNIT["Meter",1.0]
]

Best Answer

As stated in the docs for go-shp (https://godoc.org/github.com/jonas-p/go-shp#Polygon), Polygon structure is similar to PolyLine (which is defined as https://godoc.org/github.com/jonas-p/go-shp#PolyLine).

You can iterate over the features of the shapefile similar to the example in the README.md of the github page and use the function Shape() to get the ShapeType as well as the object. Since your object would be Polygon (whose structure is similar to PolyLine), you should be able to derive the co-ordinates of the polygon by accessing the array Points defined in the structure.