openwisp / django-rest-framework-gis

Geographic add-ons for Django REST Framework. Maintained by the OpenWISP Project.
http://openwisp.org
MIT License
1.07k stars 200 forks source link

GEOS_ERROR when using empty Point in GeometryField #258

Open daanvaningen opened 3 years ago

daanvaningen commented 3 years ago

Hi,

When a user submits an empty point request: POINT ( ) this validation error is raised: Invalid format: string or unicode input unrecognized as GeoJSON, WKT EWKT or HEXEWKB.'

Only internally we also see this error: django.contrib.gis:100 ERROR GEOS_ERROR: ParseException: Expected number but encountered ')'

As this is the only information we are given it is a bit difficult to see what exactly caused the error but I believe it is coming from your package. If so, it would be great if you could catch this error :) otherwise please let me know what else caused it and feel free to close the issue.

Example code:

class RasterPointSerializer(serializers.Serializer):
    geom = GeometryField()
    ....

Example request: ?geom=POINT ( )