Skip to main content
improved formatting
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

I am new to geoDjango. I have a polygon field defined in the model like this:

my_poly = models.PolygonField(null=True, blank=True, spatial_index=True, geography=True, srid=4326)

I am getting the record set in view like this:

rset = TestUnit.objects.extra(select={'o':'my_poly'}).filter(reduce(operator.and_, criteria)).values('o')

I see it is returning polygon data looks like this format:

0103000020E610000001000000090000004AB6BA9C127557C060915F3FC4C64440C7BDF90D137557C0187D0569C6C644408690F3FE3F7557C0E35295B6B8CA44403ECA880B407557C05F402FDCB9CA44400F46EC13407557C07D259012BBCA4440F7031E18407557C0C98E8D40BCCA444021B1DD3D407557C03D0CAD4ECECA4440BFB9BF7ADC7457C0D525E318C9D044404AB6BA9C127557C060915F3FC4C64440

I need it to return WKT or GeoJsonGeoJSON format so that I can draw polygons using leafletLeaflet. What are my options?

I am new to geoDjango. I have a polygon field defined in the model like this:

my_poly = models.PolygonField(null=True, blank=True, spatial_index=True, geography=True, srid=4326)

I am getting the record set in view like this:

rset = TestUnit.objects.extra(select={'o':'my_poly'}).filter(reduce(operator.and_, criteria)).values('o')

I see it is returning polygon data looks like this format:

0103000020E610000001000000090000004AB6BA9C127557C060915F3FC4C64440C7BDF90D137557C0187D0569C6C644408690F3FE3F7557C0E35295B6B8CA44403ECA880B407557C05F402FDCB9CA44400F46EC13407557C07D259012BBCA4440F7031E18407557C0C98E8D40BCCA444021B1DD3D407557C03D0CAD4ECECA4440BFB9BF7ADC7457C0D525E318C9D044404AB6BA9C127557C060915F3FC4C64440

I need it to return WKT or GeoJson format so that I can draw polygons using leaflet. What are my options?

I am new to geoDjango. I have a polygon field defined in the model like this:

my_poly = models.PolygonField(null=True, blank=True, spatial_index=True, geography=True, srid=4326)

I am getting the record set in view like this:

rset = TestUnit.objects.extra(select={'o':'my_poly'}).filter(reduce(operator.and_, criteria)).values('o')

I see it is returning polygon data looks like this format:

0103000020E610000001000000090000004AB6BA9C127557C060915F3FC4C64440C7BDF90D137557C0187D0569C6C644408690F3FE3F7557C0E35295B6B8CA44403ECA880B407557C05F402FDCB9CA44400F46EC13407557C07D259012BBCA4440F7031E18407557C0C98E8D40BCCA444021B1DD3D407557C03D0CAD4ECECA4440BFB9BF7ADC7457C0D525E318C9D044404AB6BA9C127557C060915F3FC4C64440

I need it to return WKT or GeoJSON format so that I can draw polygons using Leaflet. What are my options?

I am new to geoDjango.

  I have a polygon field defined in the model like this:

my_poly = models.PolygonField(null=True, blank=True, spatial_index=True, geography=True, srid=4326)

my_poly = models.PolygonField(null=True, blank=True, spatial_index=True, geography=True, srid=4326)

I am getting the record set in view like this:

rset = TestUnit.objects.extra(select={'o':'my_poly'}).filter(reduce(operator.and_, criteria)).values('o')

rset = TestUnit.objects.extra(select={'o':'my_poly'}).filter(reduce(operator.and_, criteria)).values('o')

I see it is returning polygon data looks like this format:

0103000020E610000001000000090000004AB6BA9C127557C060915F3FC4C64440C7BDF90D137557C0187D0569C6C644408690F3FE3F7557C0E35295B6B8CA44403ECA880B407557C05F402FDCB9CA44400F46EC13407557C07D259012BBCA4440F7031E18407557C0C98E8D40BCCA444021B1DD3D407557C03D0CAD4ECECA4440BFB9BF7ADC7457C0D525E318C9D044404AB6BA9C127557C060915F3FC4C64440

0103000020E610000001000000090000004AB6BA9C127557C060915F3FC4C64440C7BDF90D137557C0187D0569C6C644408690F3FE3F7557C0E35295B6B8CA44403ECA880B407557C05F402FDCB9CA44400F46EC13407557C07D259012BBCA4440F7031E18407557C0C98E8D40BCCA444021B1DD3D407557C03D0CAD4ECECA4440BFB9BF7ADC7457C0D525E318C9D044404AB6BA9C127557C060915F3FC4C64440

I need it to return WKT or GeoJson format so that I can draw polygons using leaflet. What are my options?

I am new to geoDjango.

  I have a polygon field defined in the model like this:

my_poly = models.PolygonField(null=True, blank=True, spatial_index=True, geography=True, srid=4326)

I am getting the record set in view like this:

rset = TestUnit.objects.extra(select={'o':'my_poly'}).filter(reduce(operator.and_, criteria)).values('o')

I see it is returning polygon data looks like this format:

0103000020E610000001000000090000004AB6BA9C127557C060915F3FC4C64440C7BDF90D137557C0187D0569C6C644408690F3FE3F7557C0E35295B6B8CA44403ECA880B407557C05F402FDCB9CA44400F46EC13407557C07D259012BBCA4440F7031E18407557C0C98E8D40BCCA444021B1DD3D407557C03D0CAD4ECECA4440BFB9BF7ADC7457C0D525E318C9D044404AB6BA9C127557C060915F3FC4C64440

I need it to return WKT or GeoJson format so that I can draw polygons using leaflet. What are my options?

I am new to geoDjango. I have a polygon field defined in the model like this:

my_poly = models.PolygonField(null=True, blank=True, spatial_index=True, geography=True, srid=4326)

I am getting the record set in view like this:

rset = TestUnit.objects.extra(select={'o':'my_poly'}).filter(reduce(operator.and_, criteria)).values('o')

I see it is returning polygon data looks like this format:

0103000020E610000001000000090000004AB6BA9C127557C060915F3FC4C64440C7BDF90D137557C0187D0569C6C644408690F3FE3F7557C0E35295B6B8CA44403ECA880B407557C05F402FDCB9CA44400F46EC13407557C07D259012BBCA4440F7031E18407557C0C98E8D40BCCA444021B1DD3D407557C03D0CAD4ECECA4440BFB9BF7ADC7457C0D525E318C9D044404AB6BA9C127557C060915F3FC4C64440

I need it to return WKT or GeoJson format so that I can draw polygons using leaflet. What are my options?

edited title
Link
ahmadhanb
  • 41.4k
  • 5
  • 54
  • 109

convert Convert GIS DB PolygonField to WKT or GeoJson in Django

Source Link
Annie C
  • 143
  • 5
Loading